LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/Astor-Bizard[P]ProjetS5_Groupe2/src/ecritureSH.c
// Function: writeSectionsHeadersToFile
void writeSectionsHeadersToFile(FILE *f, Elf32_Ehdr elfHeader, SectionsHeadersList shList) {
	int i;

	fseek(f, elfHeader.e_shoff, 0);
	for(i=0; i<shList.size; i++) {
		fwrite32(f, elfHeader.e_ident[EI_DATA], shList.headers[i].sh_name);
		fwrite32(f, elfHeader.e_ident[EI_DATA], shList.headers[i].sh_type);
		fwrite32(f, elfHeader.e_ident[EI_DATA], shList.headers[i].sh_flags);
		fwrite32(f, elfHeader.e_ident[EI_DATA], shList.headers[i].sh_addr);
		fwrite32(f, elfHeader.e_ident[EI_DATA], shList.headers[i].sh_offset);
		fwrite32(f, elfHeader.e_ident[EI_DATA], shList.headers[i].sh_size);
		fwrite32(f, elfHeader.e_ident[EI_DATA], shList.headers[i].sh_link);
		fwrite32(f, elfHeader.e_ident[EI_DATA], shList.headers[i].sh_info);
		fwrite32(f, elfHeader.e_ident[EI_DATA], shList.headers[i].sh_addralign);
		fwrite32(f, elfHeader.e_ident[EI_DATA], shList.headers[i].sh_entsize);
	}

	printf("%d en-têtes de sections écrites\n", i);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdi, %rbx
movl 0x50(%rsp), %esi
xorl %r14d, %r14d
xorl %edx, %edx
callq 0x1110
movslq 0x78(%rsp), %r15
testq %r15, %r15
jle 0x46ac
leaq 0x68(%rsp), %rax
leaq 0x30(%rsp), %rcx
movzbl 0x5(%rcx), %ebp
movq (%rax), %r12
addq $0x24, %r12
xorl %r14d, %r14d
movl -0x24(%r12), %edx
movq %rbx, %rdi
movl %ebp, %esi
callq 0x3ba0
movl -0x20(%r12), %edx
movq %rbx, %rdi
movl %ebp, %esi
callq 0x3ba0
movl -0x1c(%r12), %edx
movq %rbx, %rdi
movl %ebp, %esi
callq 0x3ba0
movl -0x18(%r12), %edx
movq %rbx, %rdi
movl %ebp, %esi
callq 0x3ba0
movl -0x14(%r12), %edx
movq %rbx, %rdi
movl %ebp, %esi
callq 0x3ba0
movl -0x10(%r12), %edx
movq %rbx, %rdi
movl %ebp, %esi
callq 0x3ba0
movl -0xc(%r12), %edx
movq %rbx, %rdi
movl %ebp, %esi
callq 0x3ba0
movl -0x8(%r12), %edx
movq %rbx, %rdi
movl %ebp, %esi
callq 0x3ba0
movl -0x4(%r12), %edx
movq %rbx, %rdi
movl %ebp, %esi
callq 0x3ba0
movl (%r12), %edx
movq %rbx, %rdi
movl %ebp, %esi
callq 0x3ba0
incq %r14
addq $0x28, %r12
cmpq %r14, %r15
jne 0x4607
leaq 0x1cae(%rip), %rdi      # 0x6361
movl %r14d, %esi
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x1090
// File: /workspace/github_c_makefile_star2_O1/Arlu[P]RDMA-Hello-World/client.c
// Function: chat
void chat()
{
    struct RemoteMR remote_mr = {
            .remote_addr = (uint64_t)ib_res.buf,
            .rkey = ib_res.mr->rkey
    };

    // Send Hello World via send and receive request:
    memcpy(ib_res.buf, MSG_SEND_RECV, sizeof(MSG_SEND_RECV));
    post_send(BUFFER_SIZE);
    wait_completions(SEND_WRID);

    // Send remote address and rkey:
    memcpy(ib_res.buf, &remote_mr, sizeof(struct RemoteMR));
    post_send(sizeof(struct RemoteMR));
    wait_completions(SEND_WRID);

    // Send Hello World via RDMA Read:
    memcpy(ib_res.buf, MSG_READ, sizeof(MSG_READ));
    post_send(1); // Notify the server for read.
    wait_completions(SEND_WRID);

    // Get remote address and rkey:
    post_recv(sizeof(struct RemoteMR));
    wait_completions(RECV_WRID);
    memcpy(&remote_mr, ib_res.buf, sizeof(struct RemoteMR));

    // Send Hello World via RDMA Write:
    memcpy(ib_res.buf, MSG_WRITE, sizeof(MSG_WRITE));
    post_send_write(remote_mr, BUFFER_SIZE);
    wait_completions(WRITE_WRID);

    post_send(1); // Notify the server for continue.
    wait_completions(SEND_WRID);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
leaq 0x2d6b(%rip), %rbx      # 0x4188
movq 0x10(%rbx), %rax
movq 0x60(%rbx), %r14
movl 0x28(%rax), %r15d
movups 0xbe4(%rip), %xmm0      # 0x2014
movups %xmm0, 0x10(%r14)
movups 0xbc8(%rip), %xmm0      # 0x2004
movups %xmm0, (%r14)
movl $0xa2165, 0x1f(%r14)    # imm = 0xA2165
movl $0x400, %edi            # imm = 0x400
callq 0x1d54
movl $0x2, %edi
callq 0x1ef9
movq 0x60(%rbx), %rax
movq %r14, (%rax)
movl %r15d, 0x8(%rax)
movl $0x10, %edi
callq 0x1d54
movl $0x2, %edi
callq 0x1ef9
movq 0x60(%rbx), %rax
movups 0xba1(%rip), %xmm0      # 0x2027
movups %xmm0, (%rax)
movups 0xba3(%rip), %xmm0      # 0x2033
movups %xmm0, 0xc(%rax)
movl $0x1, %edi
callq 0x1d54
movl $0x2, %edi
callq 0x1ef9
movl $0x10, %edi
callq 0x1cf8
movl $0x1, %edi
callq 0x1ef9
movq 0x60(%rbx), %rax
movq (%rax), %rdi
movl 0x8(%rax), %esi
movups 0xb83(%rip), %xmm0      # 0x2050
movups %xmm0, 0xd(%rax)
movups 0xb6b(%rip), %xmm0      # 0x2043
movups %xmm0, (%rax)
movl $0x400, %edx            # imm = 0x400
callq 0x1e6e
movl $0x8, %edi
callq 0x1ef9
movl $0x1, %edi
callq 0x1d54
movl $0x2, %edi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x1ef9
// File: /workspace/github_c_makefile_star2_O1/Arlu[P]RDMA-Hello-World/client.c
// Function: main
int main(int argc, char *argv[])
{
    if (argc < 2)
    {
        printf("It must get hostname!\n");
        exit(EXIT_FAILURE);
    }

    server_name = strdup(argv[1]);

    if (setup_ib())
    {
        perror("Failed to setup IB.");
    }

    chat();

    close_ib_connection();

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
cmpl $0x1, %edi
jle 0x1552
movq 0x8(%rsi), %rdi
callq 0x1270
leaq 0x2c42(%rip), %rcx      # 0x4168
movq %rax, (%rcx)
xorl %eax, %eax
callq 0x18cb
testl %eax, %eax
jne 0x1544
callq 0x140c
xorl %eax, %eax
callq 0x1c88
xorl %eax, %eax
popq %rbp
retq
leaq 0xb15(%rip), %rdi       # 0x2060
callq 0x11d0
jmp 0x1534
leaq 0xb1b(%rip), %rdi       # 0x2074
callq 0x1070
movl $0x1, %edi
callq 0x1200
// File: /workspace/github_c_makefile_star2_O1/Arlu[P]RDMA-Hello-World/setup_ib.c
// Function: get_server_dest
int get_server_dest()
{
    int sockfd;
    struct addrinfo hints, *result, *rp;

    memset(&hints, 0, sizeof(struct addrinfo));
    hints.ai_family = AF_UNSPEC; // Allow IPv4 or IPv6.
    hints.ai_socktype = SOCK_STREAM; // TCP

    if (getaddrinfo(server_name, PORT_STR, &hints, &result))
    {
        perror("Found address failed!\n");
        return 1;
    }

    // Start connection:
    for (rp = result; rp; rp = rp->ai_next)
    {
        sockfd = socket(rp->ai_family, rp->ai_socktype, rp->ai_protocol);

        if (sockfd == -1)
            continue;

        if (!connect(sockfd, rp->ai_addr, rp->ai_addrlen))
            break; // Success.

        close(sockfd);
    }

    if (!rp)
    {
        perror("Connection with the server failed.\n");
        return 1;
    }

    freeaddrinfo(result);

    // Get server details:
    {
        char *buf;
        buf = (char *)malloc(sizeof(struct IBDest));
        int offset = 0;

        // Send my details:
        memcpy(buf, &local_dest, sizeof(struct IBDest));
        write(sockfd, buf, sizeof(struct IBDest));

        // Get him details:
        memset(buf, 0, sizeof(struct IBDest));
        offset = 0;

        while (offset < sizeof(struct IBDest))
            offset += read(sockfd, buf + offset, sizeof(struct IBDest) - offset);

        memcpy(&remote_dest, buf, sizeof(struct IBDest));
    }

    // Finish connection:
    close(sockfd);

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x38, %rsp
xorps %xmm0, %xmm0
leaq -0x50(%rbp), %rdx
movaps %xmm0, (%rdx)
movaps %xmm0, 0x10(%rdx)
movaps %xmm0, 0x20(%rdx)
movl $0x1, 0x8(%rdx)
movq 0x2bd3(%rip), %rdi      # 0x4168
leaq 0xb04(%rip), %rsi       # 0x20a0
leaq -0x20(%rbp), %rcx
callq 0x1260
testl %eax, %eax
jne 0x1697
movq -0x20(%rbp), %r15
testq %r15, %r15
sete %r14b
je 0x15fb
movl 0x4(%r15), %edi
movl 0x8(%r15), %esi
movl 0xc(%r15), %edx
callq 0x1290
movl %eax, %ebx
cmpl $-0x1, %eax
je 0x15ec
movq 0x18(%r15), %rsi
movl 0x10(%r15), %edx
movl %ebx, %edi
callq 0x1210
testl %eax, %eax
je 0x15fb
movl %ebx, %edi
callq 0x10f0
movq 0x28(%r15), %r15
testq %r15, %r15
sete %r14b
jne 0x15ba
jmp 0x15fb
testb $0x1, %r14b
jne 0x16a0
movq -0x20(%rbp), %rdi
callq 0x1280
movl $0xc, %edi
callq 0x1160
movq %rax, %r14
movq 0x2b4e(%rip), %rax      # 0x4170
movq %rax, (%r14)
movl 0x2b4d(%rip), %eax      # 0x4178
movl %eax, 0x8(%r14)
movl $0xc, %edx
movl %ebx, %edi
movq %r14, %rsi
callq 0x1080
movq $0x0, (%r14)
movl $0x0, 0x8(%r14)
xorl %r15d, %r15d
leaq (%r14,%r15), %rsi
movl $0xc, %edx
subq %r15, %rdx
movl %ebx, %edi
callq 0x1110
addl %eax, %r15d
movslq %r15d, %r15
cmpq $0xc, %r15
jb 0x1650
movl 0x8(%r14), %eax
movl %eax, 0x2b0b(%rip)      # 0x4184
movq (%r14), %rax
movq %rax, 0x2af9(%rip)      # 0x417c
movl %ebx, %edi
callq 0x10f0
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0xa07(%rip), %rdi       # 0x20a5
jmp 0x16a7
leaq 0xa15(%rip), %rdi       # 0x20bc
callq 0x11d0
movl $0x1, %eax
jmp 0x168c
// File: /workspace/github_c_makefile_star2_O1/Arlu[P]RDMA-Hello-World/setup_ib.c
// Function: get_client_dest
int get_client_dest()
{
    int sockfd, connfd, len;
    struct sockaddr_in server_address, client_address;

    // Start connection:
    sockfd = socket(AF_INET, SOCK_STREAM, 0);
    if (sockfd == -1)
    {
        perror("Socket creation failed!\n");
        return 1;
    }

    memset(&server_address, 0, sizeof(server_address));
    server_address.sin_family = AF_INET;
    server_address.sin_addr.s_addr = htonl(INADDR_ANY);
    server_address.sin_port = htons(PORT);

    if (bind(sockfd, (struct sockaddr*)&server_address, sizeof(server_address)))
    {
        perror("Socket bind failed!\n");
        return 1;
    }

    if (listen(sockfd, 5))
    {
        perror("Listen failed...\n");
        return 1;
    }

    len = sizeof(client_address);

    connfd = accept(sockfd, (struct sockaddr*)&client_address, &len);
    if (connfd < 0)
    {
        perror("Server accept failed!\n");
        return 1;
    }

    // Get client details:
    {
        char *buf;
        buf = (char*)malloc(sizeof(struct IBDest));
        int offset = 0;

        // Get him details.
        while (offset < sizeof(struct IBDest))
            offset += read(connfd, buf + offset, sizeof(struct IBDest) - offset);

        memcpy(&remote_dest, buf, sizeof(struct IBDest));

        // Send my details:
        memset(buf, 0, sizeof(struct IBDest));
        offset = 0;

        memcpy(buf, &local_dest, sizeof(struct IBDest));
        write(connfd, buf, sizeof(struct IBDest));
    }

    // Finish connection:
    close(sockfd);

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x30, %rsp
movl $0x1, %r14d
movl $0x2, %edi
movl $0x1, %esi
xorl %edx, %edx
callq 0x1290
cmpl $-0x1, %eax
je 0x17b2
movl %eax, %ebx
xorps %xmm0, %xmm0
leaq -0x40(%rbp), %rsi
movaps %xmm0, (%rsi)
movl $0x901f0002, %eax       # imm = 0x901F0002
movq %rax, (%rsi)
movl %ebx, %edi
movl $0x10, %edx
callq 0x11c0
testl %eax, %eax
jne 0x17bb
movl %ebx, %edi
movl $0x5, %esi
callq 0x1170
testl %eax, %eax
jne 0x17c4
leaq -0x24(%rbp), %rdx
movl $0x10, (%rdx)
leaq -0x50(%rbp), %rsi
movl %ebx, %edi
callq 0x11f0
testl %eax, %eax
js 0x17cd
movl %eax, %r14d
movl $0xc, %edi
callq 0x1160
movq %rax, %r15
xorl %r12d, %r12d
leaq (%r15,%r12), %rsi
movl $0xc, %edx
subq %r12, %rdx
movl %r14d, %edi
callq 0x1110
addl %eax, %r12d
movslq %r12d, %r12
cmpq $0xc, %r12
jb 0x174e
movl 0x8(%r15), %eax
movl %eax, 0x2a0c(%rip)      # 0x4184
movq (%r15), %rax
movq %rax, 0x29fa(%rip)      # 0x417c
movq 0x29e7(%rip), %rax      # 0x4170
movq %rax, (%r15)
movl 0x29e6(%rip), %eax      # 0x4178
movl %eax, 0x8(%r15)
movl $0xc, %edx
movl %r14d, %edi
movq %r15, %rsi
callq 0x1080
movl %ebx, %edi
callq 0x10f0
xorl %r14d, %r14d
jmp 0x17d9
leaq 0x927(%rip), %rdi       # 0x20e0
jmp 0x17d4
leaq 0x937(%rip), %rdi       # 0x20f9
jmp 0x17d4
leaq 0x943(%rip), %rdi       # 0x210e
jmp 0x17d4
leaq 0x94c(%rip), %rdi       # 0x2120
callq 0x11d0
movl %r14d, %eax
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Arlu[P]RDMA-Hello-World/setup_ib.c
// Function: connect_between_qps
int connect_between_qps()
{
    struct ibv_qp_attr qp_attr = {
            .qp_state		= IBV_QPS_RTR,
            .path_mtu		= MTU,
            .dest_qp_num	= remote_dest.qpn,
            .rq_psn			= remote_dest.psn,
            .max_dest_rd_atomic	= 1,
            .min_rnr_timer		= 12,
            .ah_attr		= {
                    .is_global	= 0,
                    .dlid		= remote_dest.lid,
                    .sl		= 0,
                    .src_path_bits	= 0,
                    .port_num	= IB_PORT
            }
    };

    if (ibv_modify_qp(ib_res.qp, &qp_attr, IBV_QP_STATE | IBV_QP_PATH_MTU | IBV_QP_DEST_QPN | IBV_QP_RQ_PSN |
                                           IBV_QP_MAX_DEST_RD_ATOMIC | IBV_QP_MIN_RNR_TIMER | IBV_QP_AV)) {
        perror("Failed to modify QP to RTR.\n");
        return 1;
    }

    qp_attr.qp_state	    = IBV_QPS_RTS;
    qp_attr.timeout	    = 14;
    qp_attr.retry_cnt	    = 7;
    qp_attr.rnr_retry	    = 7;
    qp_attr.sq_psn	        = local_dest.psn;
    qp_attr.max_rd_atomic  = 1;
    if (ibv_modify_qp(ib_res.qp, &qp_attr, IBV_QP_STATE | IBV_QP_TIMEOUT | IBV_QP_RETRY_CNT |
                                           IBV_QP_RNR_RETRY | IBV_QP_SQ_PSN | IBV_QP_MAX_QP_RD_ATOMIC))
    {
        perror("Failed to modify QP to RTS.\n");
        return 1;
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x90, %rsp
leaq -0xa0(%rbp), %r14
xorl %ebx, %ebx
movl $0x90, %edx
movq %r14, %rdi
xorl %esi, %esi
callq 0x10e0
movl $0x2, (%r14)
movl $0x5, 0x8(%r14)
movl 0x2960(%rip), %eax      # 0x4184
movl %eax, 0x14(%r14)
movl 0x2952(%rip), %eax      # 0x4180
movl %eax, 0x1c(%r14)
movzwl 0x2943(%rip), %eax      # 0x417c
movw %ax, 0x50(%r14)
movb $0x1, 0x56(%r14)
movw $0xc01, 0x7f(%r14)      # imm = 0xC01
movq 0x2957(%rip), %rdi      # 0x41a8
movq %r14, %rsi
movl $0x129181, %edx         # imm = 0x129181
callq 0x1050
testl %eax, %eax
jne 0x18af
leaq -0xa0(%rbp), %rsi
movl $0x3, (%rsi)
movw $0x70e, 0x82(%rsi)      # imm = 0x70E
movb $0x7, 0x84(%rsi)
movl 0x28f3(%rip), %eax      # 0x4178
movl %eax, 0x18(%rsi)
movb $0x1, 0x7e(%rsi)
movq 0x2915(%rip), %rdi      # 0x41a8
movl $0x12e01, %edx          # imm = 0x12E01
callq 0x1050
testl %eax, %eax
jne 0x18b8
movl %ebx, %eax
addq $0x90, %rsp
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x881(%rip), %rdi       # 0x2137
jmp 0x18bf
leaq 0x895(%rip), %rdi       # 0x2154
callq 0x11d0
movl $0x1, %ebx
jmp 0x18a1
// File: /workspace/github_c_makefile_star2_O1/Arlu[P]RDMA-Hello-World/helper.c
// Function: post_recv
int post_recv(int size)
{
    struct ibv_sge list = {
            .addr	= (uint64_t)ib_res.buf,
            .length = size,
            .lkey	= ib_res.mr->lkey
    };

    struct ibv_recv_wr *bad_wr, wr = {
            .wr_id	    = RECV_WRID,
            .sg_list    = &list,
            .num_sge    = 1,
            .next       = NULL
    };

    ibv_post_recv(ib_res.qp, &wr, &bad_wr);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
leaq 0x2481(%rip), %rax      # 0x4188
movq 0x60(%rax), %rcx
leaq -0x18(%rbp), %rdx
movq %rcx, (%rdx)
movl %edi, 0x8(%rdx)
movq 0x10(%rax), %rcx
movq 0x20(%rax), %rdi
movl 0x24(%rcx), %eax
movl %eax, 0xc(%rdx)
leaq -0x38(%rbp), %rsi
movq $0x1, (%rsi)
movq $0x0, 0x8(%rsi)
movq %rdx, 0x10(%rsi)
movl $0x1, 0x18(%rsi)
movq (%rdi), %rax
leaq -0x8(%rbp), %rdx
callq *0xd8(%rax)
addq $0x40, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Arlu[P]RDMA-Hello-World/helper.c
// Function: post_send
int post_send(int size)
{
    struct ibv_sge list = {
            .addr	= (uint64_t)ib_res.buf,
            .length = size,
            .lkey	= ib_res.mr->lkey
    };

    struct ibv_send_wr *bad_wr, wr = {
            .wr_id	    = SEND_WRID,
            .sg_list    = &list,
            .num_sge    = 1,
            .opcode     = IBV_WR_SEND,
            .send_flags = IBV_SEND_SIGNALED,
            .next       = NULL
    };

    return ibv_post_send(ib_res.qp, &wr, &bad_wr);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
leaq 0x2422(%rip), %rax      # 0x4188
movq 0x10(%rax), %rcx
movq 0x60(%rax), %rdx
leaq -0x18(%rbp), %r8
movq %rdx, (%r8)
movl %edi, 0x8(%r8)
movl 0x24(%rcx), %ecx
movl %ecx, 0xc(%r8)
xorps %xmm0, %xmm0
leaq -0xa0(%rbp), %rsi
movaps %xmm0, (%rsi)
movaps %xmm0, 0x10(%rsi)
movaps %xmm0, 0x20(%rsi)
movaps %xmm0, 0x70(%rsi)
movaps %xmm0, 0x60(%rsi)
movaps %xmm0, 0x50(%rsi)
movaps %xmm0, 0x40(%rsi)
movaps %xmm0, 0x30(%rsi)
movq $0x2, (%rsi)
movq %r8, 0x10(%rsi)
movabsq $0x200000001, %rcx      # imm = 0x200000001
movq %rcx, 0x18(%rsi)
movl $0x2, 0x20(%rsi)
movq 0x20(%rax), %rdi
movq (%rdi), %rax
leaq -0x8(%rbp), %rdx
callq *0xd0(%rax)
addq $0xa0, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Arlu[P]RDMA-Hello-World/helper.c
// Function: post_send_read
int post_send_read(struct RemoteMR remote_mr, int size)
{
    struct ibv_sge list = {
            .addr	= (uint64_t)ib_res.buf,
            .length = size,
            .lkey	= ib_res.mr->lkey
    };

    struct ibv_send_wr *bad_wr, wr = {
            .wr_id	    = READ_WRID,
            .sg_list    = &list,
            .num_sge    = 1,
            .opcode     = IBV_WR_RDMA_READ,
            .send_flags = IBV_SEND_SIGNALED,
            .wr.rdma.remote_addr = remote_mr.remote_addr,
            .wr.rdma.rkey = remote_mr.rkey,
            .next       = NULL
    };

    ibv_post_send(ib_res.qp, &wr, &bad_wr);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
leaq 0x2393(%rip), %rcx      # 0x4188
movq 0x10(%rcx), %rax
movq 0x60(%rcx), %r8
leaq -0x18(%rbp), %r9
movq %r8, (%r9)
movl %edx, 0x8(%r9)
movl 0x24(%rax), %eax
movl %eax, 0xc(%r9)
leaq -0x98(%rbp), %rax
movq $0x4, (%rax)
movq $0x0, 0x8(%rax)
movq %r9, 0x10(%rax)
movaps 0x500(%rip), %xmm0      # 0x2330
movups %xmm0, 0x18(%rax)
movq %rdi, 0x28(%rax)
movl %esi, 0x30(%rax)
movl $0x0, 0x48(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x50(%rax)
movups %xmm0, 0x60(%rax)
movups %xmm0, 0x70(%rax)
movq 0x20(%rcx), %rdi
movq (%rdi), %rcx
leaq -0x8(%rbp), %rdx
movq %rax, %rsi
callq *0xd0(%rcx)
addq $0xa0, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Arlu[P]RDMA-Hello-World/helper.c
// Function: post_send_write
int post_send_write(struct RemoteMR remote_mr, int size)
{
    struct ibv_sge list = {
            .addr	= (uint64_t)ib_res.buf,
            .length = size,
            .lkey	= ib_res.mr->lkey
    };

    struct ibv_send_wr *bad_wr, wr = {
            .wr_id	    = WRITE_WRID,
            .sg_list    = &list,
            .num_sge    = 1,
            .opcode     = IBV_WR_RDMA_WRITE,
            .send_flags = IBV_SEND_SIGNALED,
            .wr.rdma.remote_addr = remote_mr.remote_addr,
            .wr.rdma.rkey = remote_mr.rkey,
            .next       = NULL
    };

    ibv_post_send(ib_res.qp, &wr, &bad_wr);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xa0, %rsp
leaq 0x2308(%rip), %rcx      # 0x4188
movq 0x10(%rcx), %rax
movq 0x60(%rcx), %r8
leaq -0x18(%rbp), %r9
movq %r8, (%r9)
movl %edx, 0x8(%r9)
movl 0x24(%rax), %eax
movl %eax, 0xc(%r9)
leaq -0x98(%rbp), %rax
movq $0x8, (%rax)
movq $0x0, 0x8(%rax)
movq %r9, 0x10(%rax)
movaps 0x485(%rip), %xmm0      # 0x2340
movups %xmm0, 0x18(%rax)
movq %rdi, 0x28(%rax)
movl %esi, 0x30(%rax)
movl $0x0, 0x48(%rax)
xorps %xmm0, %xmm0
movups %xmm0, 0x50(%rax)
movups %xmm0, 0x60(%rax)
movups %xmm0, 0x70(%rax)
movq 0x20(%rcx), %rdi
movq (%rdi), %rcx
leaq -0x8(%rbp), %rdx
movq %rax, %rsi
callq *0xd0(%rcx)
addq $0xa0, %rsp
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Arlu[P]RDMA-Hello-World/helper.c
// Function: wait_completions
int wait_completions(int wr_id)
{
    int finished = 0, count = 1;

    while (finished < count)
    {
        struct ibv_wc wc[WC_BATCH];
        int n;
        do {
            n = ibv_poll_cq(ib_res.cq, WC_BATCH, wc);

            if (n < 0)
            {
                fprintf(stderr, "Poll CQ failed %d\n", n);
                return 1;
            }
        } while (n < 1);

        for (int i = 0; i < n; i++)
        {
            if (wc[i].status != IBV_WC_SUCCESS)
            {
                fprintf(stderr, "Failed status %s (%d) for wr_id %d\n",
                        ibv_wc_status_str(wc[i].status), wc[i].status, (int)wc[i].wr_id);
                return 1;
            }

            if (wc[i].wr_id == wr_id)
                finished++;
        }
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x12c8, %rsp           # imm = 0x12C8
movslq %edi, %r12
leaq 0x2271(%rip), %r13      # 0x4188
leaq -0x12f0(%rbp), %r14
xorl %r15d, %r15d
testl %r15d, %r15d
jg 0x1f93
movq 0x18(%r13), %rdi
movq (%rdi), %rax
movl $0x64, %esi
movq %r14, %rdx
callq *0x60(%rax)
testl %eax, %eax
js 0x1f6c
je 0x1f26
movl %eax, %eax
movq %r14, %rdi
xorl %ecx, %ecx
movl 0x8(%rdi), %esi
testl %esi, %esi
jne 0x1f8a
xorl %edx, %edx
cmpq %r12, (%rdi)
sete %dl
addl %edx, %r15d
incq %rcx
addq $0x30, %rdi
cmpq %rcx, %rax
jne 0x1f45
setbe %bl
testb %bl, %bl
jne 0x1f21
jmp 0x1f97
movq 0x2085(%rip), %rcx      # 0x3ff8
movq (%rcx), %rdi
xorl %ebx, %ebx
leaq 0x3d1(%rip), %rsi       # 0x2350
movl %eax, %edx
xorl %eax, %eax
callq 0x1120
jmp 0x1f66
callq 0x12df
xorl %ebx, %ebx
jmp 0x1f66
xorl %eax, %eax
jmp 0x1f9c
movl $0x1, %eax
addq $0x12c8, %rsp           # imm = 0x12C8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/0xADE1A1DE[P]MeasureSuite/lib/src/measuresuite.c
// Function: ms_initialize
int ms_initialize(measuresuite_t *dest_ms, int arg_width, int num_arg_in,
                  int num_arg_out) {

  measuresuite_t ms = create_default_ms();
  *dest_ms = ms;

  if (ms == NULL                     // alloc ok?
      || set_argwidth(ms, arg_width) // set arg width
      || set_argin(ms, num_arg_in)   // set arg in
      || set_argout(ms, num_arg_out) // set arg out
      || validate_num_args(ms)       // validate arg counts
      || init_random(ms)             // initialize randomness structures
      || init_json(ms)               // initialize measure structs
      || init_timer(ms)              // initialize timer structures
  ) {
    return 1;
  }

  ms->errorno = E_SUCCESS;
  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl %ecx, %ebp
movl %edx, %r15d
movl %esi, %r12d
movq %rdi, %rbx
xorl %eax, %eax
callq 0x2ede
movq %rax, (%rbx)
movl $0x1, %ebx
testq %rax, %rax
je 0x298b
movq %rax, %r14
movq %rax, %rdi
movl %r12d, %esi
callq 0x2e60
testl %eax, %eax
jne 0x298b
movq %r14, %rdi
movl %r15d, %esi
callq 0x2e7c
testl %eax, %eax
jne 0x298b
movq %r14, %rdi
movl %ebp, %esi
callq 0x2e9d
testl %eax, %eax
jne 0x298b
movq %r14, %rdi
callq 0x2ebe
testl %eax, %eax
jne 0x298b
movq %r14, %rdi
callq 0x2c20
testl %eax, %eax
jne 0x298b
movq %r14, %rdi
callq 0x328a
testl %eax, %eax
jne 0x298b
movq %r14, %rdi
callq 0x3328
testl %eax, %eax
jne 0x298b
movl $0x0, 0x88(%r14)
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/0xADE1A1DE[P]MeasureSuite/lib/src/measuresuite.c
// Function: ms_unload_all
int ms_unload_all(measuresuite_t ms) {
  for (size_t i = ms->num_functions; i > 0; i--) {
    if (ms_unload_last(ms)) {
      return 1;
    }
  }
  ms->errorno = E_SUCCESS;
  return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x80(%rdi), %r14
testq %r14, %r14
sete %bpl
je 0x2a11
movq 0x80(%rbx), %rsi
testq %rsi, %rsi
je 0x29fc
decq %rsi
movq %rbx, %rdi
callq 0x38ec
testl %eax, %eax
jne 0x2a06
movl $0x0, 0x88(%rbx)
decq %r14
jmp 0x29cc
movl $0x18, 0x88(%rbx)
movl $0x1, %eax
testb $0x1, %bpl
je 0x2a1d
movl $0x0, 0x88(%rbx)
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/0xADE1A1DE[P]MeasureSuite/lib/src/measuresuite.c
// Function: ms_measure
int ms_measure(measuresuite_t ms, int batch_size, int num_batches) {

  if (set_num_batches(ms, num_batches)  // set number of batches
      || set_batch_size(ms, batch_size) // set batch size
      || run_measurement(ms)            // measure
  ) {
    return 1;
  }

  ms->errorno = E_SUCCESS;
  return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebp
movq %rdi, %r14
movl %edx, %esi
callq 0x2ff5
movl $0x1, %ebx
testl %eax, %eax
jne 0x2aa0
movq %r14, %rdi
movl %ebp, %esi
callq 0x3012
testl %eax, %eax
jne 0x2aa0
movq %r14, %rdi
callq 0x35d0
testl %eax, %eax
jne 0x2aa0
movl $0x0, 0x88(%r14)
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/0xADE1A1DE[P]MeasureSuite/lib/src/measuresuite.c
// Function: ms_terminate
int ms_terminate(measuresuite_t ms) {
  if (ms == NULL) {
    return 0;
  }
  if (ms_unload_all(ms) // unload all the loaded functions
      || end_random(ms) // free random data spot
      || end_timer(ms)  // free all timer related data
  ) {
    return 1;
  }

  free(ms->json);
  free(ms->functions);
  free(ms->bounds);
  free(ms);
  return 0;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
xorl %ebp, %ebp
testq %rdi, %rdi
je 0x2b4d
movq %rdi, %rbx
callq 0x29bb
movl $0x1, %ebp
testl %eax, %eax
jne 0x2b4d
movq %rbx, %rdi
callq 0x2d63
testl %eax, %eax
jne 0x2b4d
movq %rbx, %rdi
callq 0x349a
testl %eax, %eax
jne 0x2b4d
movq 0x38(%rbx), %rdi
callq 0x2040
movq 0x70(%rbx), %rdi
callq 0x2040
movq 0x18(%rbx), %rdi
callq 0x2040
movq %rbx, %rdi
callq 0x2040
xorl %ebp, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/0xADE1A1DE[P]MeasureSuite/lib/src/randomizer.c
// Function: init_random
int init_random(struct measuresuite *ms) {

  size_t count_uint64s = ms->arg_width * ms->num_arg_in;
  // for the measurement / get_one_random_qword
  ms->random_data_len = count_uint64s + 1;

  // sanity check size
  const size_t size_of_random_bin = 102400;
  if (ms->random_data_len > size_of_random_bin) {
    ms->errorno = E_INVALID_INPUT__IN_TOO_LARGE;
    return 1;
  }

  ms->random_data_fd = -1;
  ms->random_data_fd = open(randomfile_name, O_RDONLY);

  if (ms->random_data_fd == -1) {
    ms->errorno = E_INTERNAL_RANDOMNESS__AI__OPEN_FILE;
    ms->additional_info = strerror(errno);
    return 1;
  }

  // allocate data
  ms->random_data = malloc(ms->random_data_len * sizeof(uint64_t));
  if (ms->random_data == NULL) {
    ms->errorno = E_INTERNAL_RANDOMNESS__AI__MALLOC;
    ms->additional_info = strerror(errno);
    return 1;
  }

  // fill
  if (randomize(ms)) {
    return 1;
  }
  return 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x8(%rdi), %rax
imulq (%rdi), %rax
incq %rax
movq %rax, 0x50(%rdi)
cmpq $0x19001, %rax          # imm = 0x19001
jb 0x2c47
movl $0x9, 0x88(%rbx)
jmp 0x2cae
movl $0xffffffff, 0x58(%rbx) # imm = 0xFFFFFFFF
leaq 0x2a3c(%rip), %rdi      # 0x5691
xorl %esi, %esi
xorl %eax, %eax
callq 0x21f0
movl %eax, 0x58(%rbx)
cmpl $-0x1, %eax
je 0x2c85
movq 0x50(%rbx), %rdi
shlq $0x3, %rdi
callq 0x21c0
movq %rax, 0x48(%rbx)
testq %rax, %rax
je 0x2c91
movq %rbx, %rdi
popq %rbx
jmp 0x2cb5
movl $0xd, 0x88(%rbx)
jmp 0x2c9b
movl $0xc, 0x88(%rbx)
callq 0x2060
movl (%rax), %edi
callq 0x2260
movq %rax, 0x90(%rbx)
movl $0x1, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/0xADE1A1DE[P]MeasureSuite/lib/src/randomizer.c
// Function: randomize
int randomize(struct measuresuite *ms) {
  if (ms->random_data_fd == -1) {
    ms->errorno = E_INTERNAL_RANDOMNESS__UNINITIALIZED;
    return 1;
  }

  size_t len = ms->random_data_len * sizeof(uint64_t);
  size_t bytes_read = read(ms->random_data_fd, ms->random_data, len);
  if (len != bytes_read) {
    // don't care if its EOF (bytes_read == 0) or fail (bytes_read == -1)
    ms->errorno = E_INTERNAL_RANDOMNESS__AI__READ;
    ms->additional_info = strerror(errno);
    return 1;
  }

  if (ms->bounds != NULL) {
    // only set the bound for the data required. otherwise, It will overwrite
    // data somewhere...
    for (size_t i_na = 0; i_na < ms->num_arg_in; i_na++) {
      for (size_t i_w = 0; i_w < ms->arg_width; i_w++) {
        uint64_t *data = ms->random_data + (i_na * ms->arg_width) + i_w;
        *data &= ms->bounds[i_w];
      }
    }
  }
  return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0x58(%rdi), %edi
cmpl $-0x1, %edi
je 0x2d2d
movq 0x48(%rbx), %rsi
movq 0x50(%rbx), %r14
shlq $0x3, %r14
movq %r14, %rdx
callq 0x2150
cmpq %rax, %r14
jne 0x2d39
movq 0x18(%rbx), %rcx
xorl %eax, %eax
testq %rcx, %rcx
je 0x2d5b
cmpq $0x0, 0x8(%rbx)
je 0x2d5b
xorl %eax, %eax
xorl %edx, %edx
movq (%rbx), %rsi
testq %rsi, %rsi
je 0x2d1c
movq 0x48(%rbx), %rdi
xorl %r8d, %r8d
imulq %rax, %rsi
addq %rdi, %rsi
movq (%rcx,%r8,8), %r9
andq %r9, (%rsi,%r8,8)
incq %r8
movq (%rbx), %rsi
cmpq %rsi, %r8
jb 0x2d02
incq %rdx
addq $0x8, %rax
cmpq 0x8(%rbx), %rdx
jb 0x2cf3
xorl %eax, %eax
jmp 0x2d5b
movl $0x10, 0x88(%rbx)
jmp 0x2d56
movl $0xe, 0x88(%rbx)
callq 0x2060
movl (%rax), %edi
callq 0x2260
movq %rax, 0x90(%rbx)
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/0xADE1A1DE[P]MeasureSuite/lib/src/randomizer.c
// Function: end_random
int end_random(struct measuresuite *ms) {
  // free field
  free(ms->random_data);
  ms->random_data = NULL;

  // sanity check
  if (ms->random_data_fd != -1) {
    if (close(ms->random_data_fd)) {
      ms->errorno = E_INTERNAL_RANDOMNESS__AI__CLOSE_FILE;
      ms->additional_info = strerror(errno);
      return 1;
    }
  }
  ms->random_data_fd = -1;
  ms->random_data_len = 0;
  return 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x48(%rdi), %rdi
callq 0x2040
movq $0x0, 0x48(%rbx)
movl 0x58(%rbx), %edi
cmpl $-0x1, %edi
je 0x2dad
callq 0x2140
testl %eax, %eax
je 0x2dad
movl $0xf, 0x88(%rbx)
callq 0x2060
movl (%rax), %edi
callq 0x2260
movq %rax, 0x90(%rbx)
movl $0x1, %eax
jmp 0x2dbe
movl $0xffffffff, 0x58(%rbx) # imm = 0xFFFFFFFF
movq $0x0, 0x50(%rbx)
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/0xADE1A1DE[P]MeasureSuite/lib/src/randomizer.c
// Function: get_random_qword
int get_random_qword(struct measuresuite *ms, uint64_t *dest) {
  if (ms->random_data == NULL ||
      ms->random_data_len < 1 // because it would be more than 0 if it would
                              // have been initialized correctly
  ) {
    ms->errorno = E_INTERNAL_RANDOMNESS__UNINITIALIZED;
    return 1;
  }

  *dest = ms->random_data[ms->random_data_len - 1];
  return 0;
}

// Assembly:
movq 0x48(%rdi), %rax
testq %rax, %rax
je 0x2ddd
movq 0x50(%rdi), %rcx
testq %rcx, %rcx
je 0x2ddd
movq -0x8(%rax,%rcx,8), %rax
movq %rax, (%rsi)
xorl %eax, %eax
retq
movl $0x10, 0x88(%rdi)
movl $0x1, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/0xADE1A1DE[P]MeasureSuite/lib/src/randomizer.c
// Function: get_random_number
int get_random_number(struct measuresuite *ms, size_t max, size_t *dest) {

  // calc mask
  size_t mask = 1;
  do {
    mask = ~(~mask << 1); // shift left 1, will w/1's
  } while (mask < max);

  do {
    if (get_random_qword(ms, dest)) {
      return 1;
    }
    *dest &= mask;
    if (*dest <= max) {
      break;
    }
    randomize(ms);
  } while (1);

  return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %rbx
movq %rsi, %r15
movq %rdi, %r14
movq $-0x2, %rax
addq %rax, %rax
movq %rax, %r12
notq %r12
cmpq %r15, %r12
jb 0x2e05
jmp 0x2e36
movq 0x50(%r14), %rcx
testq %rcx, %rcx
je 0x2e3f
movq -0x8(%rax,%rcx,8), %rax
andq %r12, %rax
movq %rax, (%rbx)
cmpq %r15, %rax
jbe 0x2e51
movq %r14, %rdi
callq 0x2cb5
movq 0x48(%r14), %rax
testq %rax, %rax
jne 0x2e15
movl $0x10, 0x88(%r14)
movl $0x1, %eax
jmp 0x2e53
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nop
// File: /workspace/github_c_makefile_star2_O1/0xADE1A1DE[P]MeasureSuite/lib/src/struct_helpers.c
// Function: set_bounds
int set_bounds(measuresuite_t ms, const uint64_t *bounds) {

  if (bounds == NULL) {
    ms->errorno = E_INVALID_INPUT__BOUNDS_NULL;
    return 1;
  }
  if (ms->arg_width <= 0) {
    ms->errorno = E_INVALID_INPUT__ARG_WIDTH;
    return 1;
  }

  ms->bounds = calloc(ms->arg_width, sizeof(uint64_t));
  if (ms->bounds == NULL) {
    ms->errorno = E_INTERNAL_INITIALIZE__ALLOC;
    return 1;
  }
  memcpy(ms->bounds, bounds, ms->arg_width * sizeof(uint64_t));
  // could tests access here, but if its not an proper array, then the
  // measure-call will SIGSEGV
  return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %r14
testq %rsi, %rsi
je 0x2fc5
movq (%r14), %r15
testq %r15, %r15
je 0x2fd2
movq %rsi, %rbx
movl $0x8, %esi
movq %r15, %rdi
callq 0x2160
movq %rax, 0x18(%r14)
testq %rax, %rax
je 0x2fdf
shlq $0x3, %r15
movq %rax, %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x21b0
xorl %eax, %eax
jmp 0x2fef
movl $0x2, 0x88(%r14)
jmp 0x2fea
movl $0x1, 0x88(%r14)
jmp 0x2fea
movl $0x17, 0x88(%r14)
movl $0x1, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/0xADE1A1DE[P]MeasureSuite/lib/src/alloc_helper.c
// Function: realloc_or_fail
int realloc_or_fail(struct measuresuite *ms, void **dest, size_t new_len) {

  DEBUG("Reallocing to new length of %lu bytes\n", new_len);

  *dest = realloc(*dest, new_len);

  if (*dest == NULL) {
    ms->errorno = E_INTERNAL_MEASURE__AI__ALLOC;
    ms->additional_info = strerror(errno);
    return 1;
  }

  return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %r14
movq %rdi, %rbx
movq (%rsi), %rdi
movq %rdx, %rsi
callq 0x21d0
movq %rax, %rcx
movq %rax, (%r14)
xorl %eax, %eax
testq %rcx, %rcx
jne 0x3074
movl $0x16, 0x88(%rbx)
callq 0x2060
movl (%rax), %edi
callq 0x2260
movq %rax, 0x90(%rbx)
movl $0x1, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/0xADE1A1DE[P]MeasureSuite/lib/src/alloc_helper.c
// Function: map_rwx
int map_rwx(struct measuresuite *ms, void **dest, size_t new_len) {
  int fd_zero = open("/dev/zero", O_RDWR);
  if (fd_zero == -1) {
    ms->errorno = E_INTERNAL_MEASURE__AI__ALLOC;
    ms->additional_info = strerror(errno);
    return 1;
  }

  *dest = mmap(NULL, new_len, PROT_READ | PROT_WRITE | PROT_EXEC, MAP_PRIVATE,
               fd_zero, 0);
  // NOLINTNEXTLINE
  if (*dest == MAP_FAILED) {
    ms->errorno = E_INTERNAL_MEASURE__AI__ALLOC;
    ms->additional_info = strerror(errno);
    return 1;
  }

  if (close(fd_zero) == -1) { /*No longer needed*/
    ms->errorno = E_INTERNAL_MEASURE__AI__ALLOC;
    ms->additional_info = strerror(errno);
    return 1;
  }

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rdx, %r12
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x2614(%rip), %rdi      # 0x56a8
movl $0x2, %esi
xorl %eax, %eax
callq 0x21f0
cmpl $-0x1, %eax
je 0x30d9
movl %eax, %ebp
xorl %r15d, %r15d
xorl %edi, %edi
movq %r12, %rsi
movl $0x7, %edx
movl $0x2, %ecx
movl %eax, %r8d
xorl %r9d, %r9d
callq 0x20b0
movq %rax, (%r14)
cmpq $-0x1, %rax
je 0x30d9
movl %ebp, %edi
callq 0x2140
cmpl $-0x1, %eax
jne 0x30fc
movl $0x16, 0x88(%rbx)
callq 0x2060
movl (%rax), %edi
callq 0x2260
movq %rax, 0x90(%rbx)
movl $0x1, %r15d
movl %r15d, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/0xADE1A1DE[P]MeasureSuite/lib/src/alloc_helper.c
// Function: realloc_rwx_or_fail
int realloc_rwx_or_fail(struct measuresuite *ms, void **dest, size_t old_len,
                        size_t new_len) {
  // not using mremap here, because it may clash with errno (and USE_GNU)
  if (munmap(*dest, old_len)) {
    ms->errorno = E_INTERNAL_MEASURE__AI__ALLOC;
    ms->additional_info = strerror(errno);
    return 1;
  }

  return map_rwx(ms, *dest, new_len);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rcx, %r14
movq %rsi, %r15
movq %rdi, %rbx
movq (%rsi), %rdi
movq %rdx, %rsi
callq 0x21e0
testl %eax, %eax
je 0x314d
movl $0x16, 0x88(%rbx)
callq 0x2060
movl (%rax), %edi
callq 0x2260
movq %rax, 0x90(%rbx)
movl $0x1, %eax
popq %rbx
popq %r14
popq %r15
retq
movq (%r15), %rsi
movq %rbx, %rdi
movq %r14, %rdx
popq %rbx
popq %r14
popq %r15
jmp 0x307c
// File: /workspace/github_c_makefile_star2_O1/0xADE1A1DE[P]MeasureSuite/lib/src/alloc_helper.c
// Function: unmap
int unmap(struct measuresuite *ms, void *dest, size_t old_len) {
  if (dest == NULL) {
    return 0;
  }
  if (munmap(dest, old_len)) {
    ms->errorno = E_INTERNAL_MEASURE__AI__ALLOC;
    ms->additional_info = strerror(errno);
    return 1;
  }

  return 0;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
xorl %ebp, %ebp
testq %rsi, %rsi
je 0x319e
movq %rdi, %rbx
movq %rsi, %rdi
movq %rdx, %rsi
callq 0x21e0
testl %eax, %eax
je 0x319e
movl $0x16, 0x88(%rbx)
callq 0x2060
movl (%rax), %edi
callq 0x2260
movq %rax, 0x90(%rbx)
movl $0x1, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/0xADE1A1DE[P]MeasureSuite/lib/src/alloc_helper.c
// Function: init_cycle_results
int init_cycle_results(struct measuresuite *ms) {

  FOR_EACH_FUNCTION {

    fct->cycle_results = malloc(ms->num_batches * sizeof(uint64_t));

    if (fct->cycle_results == 0) {
      ms->errorno = E_INTERNAL_MEASURE__AI__ALLOC;
      ms->additional_info = strerror(errno);
      return 1;
    }
  }

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq 0x70(%rdi), %r15
movq 0x80(%rdi), %rax
leaq (%rax,%rax,4), %rax
leaq (%r15,%rax,8), %r12
addq $-0x28, %r12
cmpq %r12, %r15
setbe %bpl
ja 0x327d
movq %rdi, %rbx
movq 0x28(%rdi), %r14
shlq $0x3, %r14
movq %r14, %rdi
callq 0x21c0
movq %rax, 0x20(%r15)
testq %rax, %rax
je 0x3260
addq $0x28, %r15
cmpq %r12, %r15
setbe %bpl
ja 0x327d
movq %r14, %rdi
callq 0x21c0
movq %rax, 0x20(%r15)
addq $0x28, %r15
testq %rax, %rax
jne 0x3242
movl $0x16, 0x88(%rbx)
callq 0x2060
movl (%rax), %edi
callq 0x2260
movq %rax, 0x90(%rbx)
movzbl %bpl, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/0xADE1A1DE[P]MeasureSuite/lib/src/alloc_helper.c
// Function: init_json
int init_json(struct measuresuite *ms) {

  const unsigned long char_per_long = 10;
  // at max, every function poduces one long per batch
  const unsigned long char_per_batch = char_per_long * ms->size_functions;

  // every batch produces char_per_batch' chars
  const unsigned long dynamic_length = char_per_batch * ms->num_batches;

  // the static stuff...
  const int len_other_stats = 1025;
  ms->json_len = len_other_stats + dynamic_length;

  ms->json = calloc(ms->json_len, sizeof(char));
  if (ms->json == NULL) {
    ms->errorno = E_INTERNAL_MEASURE__AI__ALLOC;
    ms->additional_info = strerror(errno);
    return 1;
  }

  return 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x78(%rdi), %rax
imulq 0x28(%rdi), %rax
leaq (%rax,%rax,4), %rax
leaq 0x401(,%rax,2), %rdi
movq %rdi, 0x40(%rbx)
movl $0x1, %esi
callq 0x2160
movq %rax, %rcx
movq %rax, 0x38(%rbx)
xorl %eax, %eax
testq %rcx, %rcx
jne 0x32e1
movl $0x16, 0x88(%rbx)
callq 0x2060
movl (%rax), %edi
callq 0x2260
movq %rax, 0x90(%rbx)
movl $0x1, %eax
popq %rbx
retq
nop
// File: /workspace/github_c_makefile_star2_O1/0xADE1A1DE[P]MeasureSuite/lib/src/timer.c
// Function: current_timestamp
uint64_t current_timestamp() {
  struct timeval time = {0};
  gettimeofday(&time, NULL); // get current time

  const long long millisonds_per_second = 1000LL;
  const long long microseconds_per_millisecond = 1000LL;
  uint64_t milliseconds =
      time.tv_sec * millisonds_per_second +
      time.tv_usec / microseconds_per_millisecond; // calculate milliseconds

  return milliseconds;
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
xorps %xmm0, %xmm0
movq %rsp, %rbx
movaps %xmm0, (%rbx)
movq %rbx, %rdi
xorl %esi, %esi
callq 0x2110
imulq $0x3e8, (%rbx), %rcx    # imm = 0x3E8
movabsq $0x20c49ba5e353f7cf, %rax # imm = 0x20C49BA5E353F7CF
imulq 0x8(%rbx)
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x7, %rdx
addq %rdx, %rax
addq %rcx, %rax
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/0xADE1A1DE[P]MeasureSuite/lib/src/timer.c
// Function: init_timer
int init_timer(struct measuresuite *ms) {

  // init timer struct
  memset(&ms->timer, 0, sizeof(ms->timer));

  // try to initialize
  init_fdperf(ms);

  if (ms->timer.fdperf == -1) {
    // if that  failed, we need to resort to RDTSCP
    ms->timer.timer_function = measuresuite_time_rdtscp;
  } else {
    // otherwise we'd use pmc
    ms->timer.timer_function = measuresuite_time_pmc;
  }

  return 0;
}

// Assembly:
pushq %rbx
subq $0x80, %rsp
movq %rdi, %rbx
xorps %xmm0, %xmm0
movups %xmm0, 0x98(%rdi)
movq $0x0, 0xa8(%rdi)
movq %rsp, %rdi
movaps %xmm0, (%rdi)
movaps %xmm0, 0x20(%rdi)
movaps %xmm0, 0x70(%rdi)
movaps %xmm0, 0x60(%rdi)
movaps %xmm0, 0x50(%rdi)
movaps %xmm0, 0x40(%rdi)
movaps %xmm0, 0x30(%rdi)
movaps %xmm0, 0x10(%rdi)
movl $0x80, 0x4(%rdi)
movb $0x60, 0x28(%rdi)
movl $0x12a, %eax            # imm = 0x12A
xorl %esi, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movq $-0x1, %r10
movq $0x0, %r8
syscall
movl %eax, 0x98(%rbx)
movl 0x98(%rbx), %eax
cmpl $-0x1, %eax
je 0x33de
movl $0x1e, %edi
callq 0x2220
movl 0x98(%rbx), %r8d
xorl %edi, %edi
movq %rax, %rsi
movl $0x1, %edx
movl $0x1, %ecx
xorl %r9d, %r9d
callq 0x20b0
movq %rax, 0xa0(%rbx)
movq 0xa0(%rbx), %rax
cmpq $-0x1, %rax
je 0x3409
cmpl $-0x1, 0x98(%rbx)
leaq 0x197(%rip), %rax       # 0x3583
leaq 0x31(%rip), %rcx        # 0x3424
cmoveq %rax, %rcx
movq %rcx, 0xa8(%rbx)
xorl %eax, %eax
addq $0x80, %rsp
popq %rbx
retq
leaq 0x98(%rbx), %rax
movl $0xffffffff, (%rax)     # imm = 0xFFFFFFFF
leaq 0x2301(%rip), %rdi      # 0x571e
callq 0x2210
jmp 0x33de
// File: /workspace/github_c_makefile_star2_O1/0xADE1A1DE[P]MeasureSuite/lib/src/timer.c
// Function: end_timer
int end_timer(struct measuresuite *ms) {

  if (ms_get_timer(ms) == RDTSCP) {
    return 0;
  }

  // otherwise we used pmc
  assert(ms->timer.buf != NULL); // and  the buffer shall not be NULL

  if (munmap(ms->timer.buf, sysconf(_SC_PAGESIZE)) == 0) {
    ms->timer.buf = NULL;
    ioctl(ms->timer.fdperf, PERF_EVENT_IOC_DISABLE, 0);
    close(ms->timer.fdperf);
    return 0;
  }
  perror("munmap of timer buffer (pmc) failed.");
  return 1;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
callq 0x2ae8
xorl %ebp, %ebp
cmpl $0x1, %eax
je 0x34fe
movq 0xa0(%rbx), %r14
testq %r14, %r14
je 0x3518
movl $0x1e, %edi
callq 0x2220
movq %r14, %rdi
movq %rax, %rsi
callq 0x21e0
testl %eax, %eax
jne 0x3505
movq $0x0, 0xa0(%rbx)
movl 0x98(%rbx), %edi
xorl %ebp, %ebp
movl $0x2401, %esi           # imm = 0x2401
xorl %edx, %edx
xorl %eax, %eax
callq 0x2130
movl 0x98(%rbx), %edi
callq 0x2140
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
leaq 0x21ed(%rip), %rdi      # 0x56f9
callq 0x2210
movl $0x1, %ebp
jmp 0x34fe
leaq 0x2193(%rip), %rdi      # 0x56b2
leaq 0x21a2(%rip), %rsi      # 0x56c8
leaq 0x21a7(%rip), %rcx      # 0x56d4
movl $0xdf, %edx
callq 0x2120
// File: /workspace/github_c_makefile_star2_O1/0xADE1A1DE[P]MeasureSuite/lib/src/timer.c
// Function: start_timer
void start_timer(struct measuresuite *ms, uint64_t *start) {
  // we need to reset the PMC if we are using them.

  if (ms_get_timer(ms) == PMC) {
    ioctl(ms->timer.fdperf, PERF_EVENT_IOC_RESET, 0);
  }
  *start = ms->timer.timer_function(ms);
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
callq 0x2ae8
testl %eax, %eax
jne 0x355f
movl 0x98(%r14), %edi
movl $0x2403, %esi           # imm = 0x2403
xorl %edx, %edx
xorl %eax, %eax
callq 0x2130
movq %r14, %rdi
callq *0xa8(%r14)
movq %rax, (%rbx)
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/0xADE1A1DE[P]MeasureSuite/lib/src/error/description.c
// Function: get_error_string
const char *get_error_string(ERROR_NUMBER err) {
  for (size_t i = 0; i < sizeof(error_desc) / sizeof(error_desc[0]); i++) {
    if (error_desc[i].errno == err) {
      return error_desc[i].message;
    }
  }
  return NULL;
}

// Assembly:
movl $0x8, %ecx
leaq 0x560c(%rip), %rdx      # 0x8bc0
xorl %eax, %eax
cmpl %edi, -0x8(%rcx,%rdx)
je 0x35ca
addq $0x10, %rcx
cmpq $0x228, %rcx            # imm = 0x228
jne 0x35b6
retq
movq (%rcx,%rdx), %rax
retq
nop
// File: /workspace/github_c_makefile_star2_O1/0xADE1A1DE[P]MeasureSuite/lib/src/loader.c
// Function: unload
int unload(measuresuite_t ms, size_t id) {

  struct function_tuple *fct = &ms->functions[id];

  free(fct->arithmetic_results);
  fct->arithmetic_results = NULL;

  free(fct->cycle_results);
  fct->cycle_results = NULL;

  int ret = 0;
  switch (fct->type) {
  case SHARED_OBJECT:
    ret = so_unload_file(ms, fct);
    break;
  case ASM:
#if USE_ASSEMBLYLINE
    if (fct->al == NULL || asm_destroy_instance(fct->al)) {
      ms->errorno = E_LOAD__AL_FREE;
      ret = 1;
    }
    fct->al = NULL;
    __attribute__((fallthrough));
#endif
  case BIN:
  case ELF:
    unmap(ms, fct->code, fct->code_size_bytes);
    fct->code_size_bytes = 0;
  }

  ms->num_functions--;
  reset_permutaions(ms);
  return ret;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdi, %rbx
movq 0x70(%rdi), %rax
leaq (%rsi,%rsi,4), %rcx
leaq (%rax,%rcx,8), %r15
movq 0x18(%r15), %rdi
callq 0x2040
xorl %r14d, %r14d
movq %r14, 0x18(%r15)
movq 0x20(%r15), %rdi
callq 0x2040
movq %r14, 0x20(%r15)
cmpl $0x3, (%r15)
jae 0x393d
movq 0x8(%r15), %rsi
movq 0x10(%r15), %rdx
movq %rbx, %rdi
callq 0x3160
movq $0x0, 0x10(%r15)
jmp 0x394d
jne 0x394d
movq %rbx, %rdi
movq %r15, %rsi
callq 0x45a8
movl %eax, %r14d
decq 0x80(%rbx)
movq %rbx, %rdi
callq 0x3965
movl %r14d, %eax
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/0xADE1A1DE[P]MeasureSuite/lib/src/loader.c
// Function: reset_permutaions
static int reset_permutaions(measuresuite_t ms) {

  // allocate permutation
  ms->permutation =
      realloc(ms->permutation, ms->num_functions * sizeof(size_t));

  if (ms->permutation == NULL) {
    ms->errorno = E_INTERNAL_RANDOMNESS__AI__MALLOC;
    ms->additional_info = strerror(errno);
    return 1;
  }

  for (size_t i = 0; i < ms->num_functions; i++) {
    ms->permutation[i] = i;
  }
  return 0;
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
movq 0x60(%rdi), %rdi
movq 0x80(%rbx), %rsi
shlq $0x3, %rsi
callq 0x21d0
movq %rax, 0x60(%rbx)
testq %rax, %rax
je 0x39af
cmpq $0x0, 0x80(%rbx)
je 0x39cc
movq 0x80(%rbx), %rcx
cmpq $0x1, %rcx
adcq $0x0, %rcx
xorl %edx, %edx
movq %rdx, (%rax,%rdx,8)
incq %rdx
cmpq %rdx, %rcx
jne 0x39a1
jmp 0x39cc
movl $0xc, 0x88(%rbx)
callq 0x2060
movl (%rax), %edi
callq 0x2260
movq %rax, 0x90(%rbx)
popq %rbx
retq