import os

def generate_nop_function(filename="sharedlib.c"):
    with open(filename, "w") as f:
        f.write("#include \"sharedlib.h\"\n\n")
        
        f.write("void padding_before(void) { asm volatile (\n")
        for _ in range(64):
            f.write("    \"nop\\n\\t\"\n")
        f.write("    :::\n); }\n\n")
    
        f.write("void function(void)\n{")
        f.write("    asm volatile (\n")
        
        size = 64 * 256
        for _ in range(size):
            f.write("        \"nop\\n\\t\"\n")
        
        f.write("        :::\n    );\n}")
        
        f.write("\n\nvoid padding_after(void) { asm volatile (\n")
        for _ in range(64):
            f.write("    \"nop\\n\\t\"\n")
        f.write("    :::\n); }\n")

if __name__ == "__main__":
    generate_nop_function()