LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/motet-a[P]libforks/tests/file_descriptor_leaks.c
// Function: main
int main() {
  struct rlimit l;
  l.rlim_cur = l.rlim_max = 9;
  check(setrlimit(RLIMIT_NOFILE, &l) == 0);

  for (size_t i = 0; i < LOOPS; i++) {
    libforks_ServerConn conn;
    check(libforks_start(&conn) == libforks_OK);
    check(libforks_stop(conn) == libforks_OK);
  }

  libforks_ServerConn conn;
  check(libforks_start(&conn) == libforks_OK);

  for (size_t i = 0; i < LOOPS; i++) {
    int exit_fd;

    libforks_Result r = libforks_fork(
      conn,
      NULL, // pid_ptr
      NULL, // socket_fd_ptr
      &exit_fd, // exit_fd_ptr
      child_main
    );
    check(r == libforks_OK);

    libforks_ExitEvent event;
    check(read(exit_fd, &event, sizeof event) == sizeof event);

    check(close(exit_fd) == 0);
  }

  check(libforks_stop(conn) == libforks_OK);

  return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x30, %rsp
pushq $0x9
popq %rax
leaq 0x20(%rsp), %rsi
movq %rax, 0x8(%rsi)
movq %rax, (%rsi)
pushq $0x7
popq %rdi
callq 0x1170
testl %eax, %eax
jne 0x141c
pushq $0x13
popq %r14
leaq 0x10(%rsp), %rbx
subq $0x1, %r14
jb 0x1363
movq %rbx, %rdi
callq 0x17c6
testl %eax, %eax
jne 0x13f7
movq 0x10(%rsp), %rdi
callq 0x2266
testl %eax, %eax
je 0x1331
leaq 0x1d0d(%rip), %rdi      # 0x3069
pushq $0x1a
jmp 0x1416
leaq 0x10(%rsp), %rdi
callq 0x17c6
testl %eax, %eax
jne 0x1427
pushq $0x13
popq %r13
leaq 0xe8(%rip), %rbx        # 0x1468
leaq 0xc(%rsp), %r14
leaq 0x18(%rsp), %r15
pushq $0x8
popq %r12
subq $0x1, %r13
jb 0x13d9
movq 0x10(%rsp), %rdi
xorl %esi, %esi
xorl %edx, %edx
movq %r14, %rcx
movq %rbx, %r8
callq 0x20c2
testl %eax, %eax
jne 0x140d
movl 0xc(%rsp), %edi
movq %r15, %rsi
movq %r12, %rdx
callq 0x10f0
cmpq $0x8, %rax
jne 0x1402
movl 0xc(%rsp), %edi
callq 0x10c0
testl %eax, %eax
je 0x138e
leaq 0x1cfc(%rip), %rdi      # 0x30d1
pushq $0x2f
jmp 0x1416
movq 0x10(%rsp), %rdi
callq 0x2266
testl %eax, %eax
jne 0x1432
xorl %eax, %eax
addq $0x30, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x1c46(%rip), %rdi      # 0x3044
pushq $0x19
jmp 0x1416
leaq 0x1c94(%rip), %rdi      # 0x309d
pushq $0x2d
jmp 0x1416
leaq 0x1c78(%rip), %rdi      # 0x308c
pushq $0x2a
popq %rsi
callq 0x143d
leaq 0x1be1(%rip), %rdi      # 0x3004
pushq $0x15
jmp 0x1416
leaq 0x1c16(%rip), %rdi      # 0x3044
pushq $0x1e
jmp 0x1416
leaq 0x1c30(%rip), %rdi      # 0x3069
pushq $0x32
jmp 0x1416
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/lbs-s3/dispatch.c
// Function: dispatch_accept
struct dispatch_state *
dispatch_accept(struct s3state * S, int s)
{
	struct dispatch_state * D;

	/* Allocate space for dispatcher state. */
	if ((D = malloc(sizeof(struct dispatch_state))) == NULL)
		goto err0;

	/* Initialize dispatcher. */
	D->S = S;

	/* Accept a connection. */
	D->accepting = 1;
	if (network_accept(s, callback_accept, D) == NULL)
		goto err1;

	/* Success! */
	return (D);

err1:
	free(D);
err0:
	/* Failure! */
	return (NULL);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %esi, %ebp
movq %rdi, %r14
pushq $0x38
popq %rdi
callq 0x2270
testq %rax, %rax
je 0x2e39
movq %rax, %rbx
movq %r14, (%rax)
movl $0x1, 0x8(%rax)
leaq 0x21(%rip), %rsi        # 0x2e43
movl %ebp, %edi
movq %rax, %rdx
callq 0x62f8
testq %rax, %rax
jne 0x2e3b
movq %rbx, %rdi
callq 0x2040
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/lbs-s3/s3state.c
// Function: s3state_get
int
s3state_get(struct s3state * S, struct proto_lbs_request * R,
    int (* callback)(void *, struct proto_lbs_request *,
        const uint8_t *, size_t), void * cookie)
{
	struct get_cookie * C;

	/* Bake a cookie. */
	if ((C = malloc(sizeof(struct get_cookie))) == NULL)
		goto err0;
	C->S = S;
	C->R = R;
	C->callback = callback;
	C->cookie = cookie;

	/* Send the S3 request. */
	if (proto_s3_request_range(S->Q_S3, S->bucket,
	    objmap(BLK2OBJECT(R->r.get.blkno)),
	    BLKOFFSET(R->r.get.blkno, S->blklen), S->blklen,
	    callback_get, C))
		goto err1;

	/* We will be performing a callback later. */
	S->npending += 1;

	/* Success! */
	return (0);

err1:
	free(C);
err0:
	/* Failure! */
	return (-1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r13
movq %rdx, %rbp
movq %rsi, %r12
movq %rdi, %r14
pushq $0x20
popq %rdi
callq 0x2270
pushq $-0x1
popq %rbx
testq %rax, %rax
je 0x35f3
movq %rax, %r15
movq %r14, (%rax)
movq %r12, 0x8(%rax)
movq %rbp, 0x10(%rax)
movq %r13, 0x18(%rax)
movq 0x18(%r14), %r13
movq 0x28(%r14), %rbp
movq 0x10(%r12), %rdi
shrq $0x18, %rdi
incq %rdi
callq 0x3de0
movl (%r14), %r8d
movl $0xffffff, %ecx         # imm = 0xFFFFFF
andl 0x10(%r12), %ecx
imull %r8d, %ecx
movq %r15, (%rsp)
leaq 0x33(%rip), %r9         # 0x3604
movq %r13, %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0x9671
testl %eax, %eax
je 0x35ed
movq %r15, %rdi
callq 0x2040
jmp 0x35f3
incq 0x30(%r14)
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/lbs-s3/s3state.c
// Function: callback_get
static int
callback_get(void * cookie, int failed, size_t buflen, const uint8_t * buf)
{
	struct get_cookie * C = cookie;
	struct s3state * S = C->S;
	int rc;

	/* If we failed or have the wrong size of buffer, we have no block. */
	if ((failed != 0) || (buflen != S->blklen))
		buf = NULL;

	/* Tell the dispatcher to send its response back. */
	rc = (C->callback)(C->cookie, C->R, buf, buflen);

	/* We've done a callback. */
	S->npending -= 1;

	/* Free our cookie. */
	free(C);

	/* Return status from callback. */
	return (rc);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rcx, %rax
movq %rdx, %rcx
movq %rdi, %rbx
movq (%rdi), %r14
testl %esi, %esi
jne 0x3620
movl (%r14), %edx
cmpq %rcx, %rdx
je 0x3622
xorl %eax, %eax
movq 0x8(%rbx), %rsi
movq 0x18(%rbx), %rdi
movq %rax, %rdx
callq *0x10(%rbx)
movl %eax, %ebp
decq 0x30(%r14)
movq %rbx, %rdi
callq 0x2040
movl %ebp, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/lbs-s3/s3state.c
// Function: s3state_append
int
s3state_append(struct s3state * S, struct proto_lbs_request * R,
    int (* callback)(void *, struct proto_lbs_request *, uint64_t),
    void * cookie)
{
	struct append_cookie * C;

	/* Bake a cookie. */
	if ((C = malloc(sizeof(struct append_cookie))) == NULL)
		goto err0;
	C->S = S;
	C->R = R;
	C->callback = callback;
	C->cookie = cookie;

	/* Sanity check. */
	assert(R->r.append.blkno % BLKSPEROBJECT == 0);

	/* Send the S3 request. */
	if (proto_s3_request_put(S->Q_S3, S->bucket,
	    objmap(BLK2OBJECT(R->r.append.blkno)),
	    R->r.append.nblks * S->blklen, R->r.append.buf,
	    callback_append, C))
		goto err1;

	/* We will be performing a callback later. */
	S->npending += 1;

	/* Success! */
	return (0);

err1:
	free(C);
err0:
	/* Failure! */
	return (-1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rcx, %r13
movq %rdx, %rbp
movq %rsi, %r12
movq %rdi, %r14
pushq $0x20
popq %rdi
callq 0x2270
pushq $-0x1
popq %rbx
testq %rax, %rax
je 0x36da
movq %rax, %r15
movq %r14, (%rax)
movq %r12, 0x8(%rax)
movq %rbp, 0x10(%rax)
movq %r13, 0x18(%rax)
movq 0x18(%r12), %rdi
testl $0xffffff, %edi         # imm = 0xFFFFFF
jne 0x36eb
movq 0x18(%r14), %r13
movq 0x28(%r14), %rbp
shrq $0x18, %rdi
incq %rdi
callq 0x3de0
movl (%r14), %ecx
imull 0x10(%r12), %ecx
movq 0x20(%r12), %r8
movq %r15, (%rsp)
leaq 0x52(%rip), %r9         # 0x370a
movq %r13, %rdi
movq %rbp, %rsi
movq %rax, %rdx
callq 0x91a8
testl %eax, %eax
je 0x36d4
movq %r15, %rdi
callq 0x2040
jmp 0x36da
incq 0x30(%r14)
xorl %ebx, %ebx
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x8e34(%rip), %rdi      # 0xc526
leaq 0x8d8d(%rip), %rsi      # 0xc486
leaq 0x8e4d(%rip), %rcx      # 0xc54d
movl $0xe0, %edx
callq 0x21a0
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/lbs-s3/s3state.c
// Function: s3state_free
void
s3state_free(struct s3state * S)
{

	/* Sanity-check. */
	assert(S->npending == 0);

	/* Free allocations. */
	free(S->bucket);
	free(S);
}

// Assembly:
pushq %rbx
cmpq $0x0, 0x30(%rdi)
jne 0x3788
movq %rdi, %rbx
movq 0x28(%rdi), %rdi
callq 0x2040
movq %rbx, %rdi
popq %rbx
jmp 0x2040
leaq 0x8e3e(%rip), %rdi      # 0xc5cd
leaq 0x8cf0(%rip), %rsi      # 0xc486
leaq 0x8e41(%rip), %rcx      # 0xc5de
movl $0x130, %edx            # imm = 0x130
callq 0x21a0
nop
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/lbs-s3/deleteto.c
// Function: deleteto_init
struct deleteto *
deleteto_init(struct wire_requestqueue * Q_S3, const char * bucket)
{
	struct deleteto * D;

	/* Allocate and initialize a DeleteTo structure. */
	if ((D = malloc(sizeof(struct deleteto))) == NULL)
		goto err0;
	D->Q = Q_S3;
	D->N = 0;
	D->npending = 0;
	D->idle = 1;
	D->updateDeletedTo = 0;
	D->shuttingdown = 0;
	if ((D->bucket = strdup(bucket)) == NULL)
		goto err1;

	/* Check if a DeletedMarker exists (if not, we treat it as 1). */
	D->done = 0;
	if (proto_s3_request_head(D->Q, D->bucket, "DeletedMarker",
	    callback_deletedmarker_head, D))
		goto err2;
	if (events_spin(&D->done))
		goto err2;

	/*
	 * If a marker exists, read it.  Eventual consistency is fine here
	 * since at worst we'll get an old marker and re-issue some deletes.
	 */
	if (D->M == 0) {
		D->done = 0;
		if (proto_s3_request_get(D->Q, D->bucket, "DeletedMarker", 8,
		    callback_deletedmarker_get, D))
			goto err2;
		if (events_spin(&D->done))
			goto err2;
	}

	/* Success! */
	return (D);

err2:
	free(D->bucket);
err1:
	free(D);
err0:
	/* Failure! */
	return (NULL);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rsi, %r15
movq %rdi, %r14
pushq $0x40
popq %rdi
callq 0x2270
testq %rax, %rax
je 0x3835
movq %rax, %rbx
movq %r14, (%rax)
andq $0x0, 0x10(%rax)
andq $0x0, 0x28(%rax)
movq $0x1, 0x30(%rax)
andl $0x0, 0x38(%rax)
movq %r15, %rdi
callq 0x2390
movq %rax, 0x8(%rbx)
testq %rax, %rax
je 0x382d
andl $0x0, 0x20(%rbx)
leaq 0x8e0a(%rip), %rdx      # 0xc602
leaq 0x7e(%rip), %rcx        # 0x387d
movq %r14, %rdi
movq %rax, %rsi
movq %rbx, %r8
callq 0x995d
testl %eax, %eax
jne 0x3824
movq %rbx, %r14
addq $0x20, %r14
movq %r14, %rdi
callq 0x4bef
testl %eax, %eax
je 0x3840
movq 0x8(%rbx), %rdi
callq 0x2040
movq %rbx, %rdi
callq 0x2040
xorl %ebx, %ebx
movq %rbx, %rax
popq %rbx
popq %r14
popq %r15
retq
cmpq $0x0, 0x18(%rbx)
jne 0x3837
andl $0x0, 0x20(%rbx)
movq (%rbx), %rdi
movq 0x8(%rbx), %rsi
leaq 0x8da9(%rip), %rdx      # 0xc602
leaq 0x78(%rip), %r8         # 0x38d8
pushq $0x8
popq %rcx
movq %rbx, %r9
callq 0x93df
testl %eax, %eax
jne 0x3824
movq %r14, %rdi
callq 0x4bef
testl %eax, %eax
jne 0x3824
jmp 0x3837
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/lbs-s3/deleteto.c
// Function: deleteto_stop
int
deleteto_stop(struct deleteto * D)
{
	int rc;

	/* We don't want to do any more DELETEs, just shut down. */
	D->shuttingdown = 1;

	/* Wait for S3 operations to finish. */
	rc = events_spin(&D->idle);

	/* Free the DeleteTo structure. */
	free(D->bucket);
	free(D);

	/* Return status from events_spin. */
	return (rc);
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x1, 0x38(%rdi)
addq $0x30, %rdi
callq 0x4bef
movl %eax, %ebp
movq 0x8(%rbx), %rdi
callq 0x2040
movq %rbx, %rdi
callq 0x2040
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/lbs-s3/deleteto.c
// Function: callback_done
static int
callback_done(void * cookie, int failed)
{
	struct deleteto * D = cookie;

	/* Sanity-checks. */
	assert(D->idle == 0);
	assert(D->npending > 0);

	/* Failures are bad, m'kay? */
	if (failed)
		goto err0;

	/* We've finished an operation. */
	D->npending -= 1;

	/* Have we finished all of them? */
	if (D->npending == 0) {
		D->idle = 1;
		if (poke(D))
			goto err0;
	}

	/* Success! */
	return (0);

err0:
	/* Failure! */
	return (-1);
}

// Assembly:
pushq %rbx
cmpl $0x0, 0x30(%rdi)
jne 0x3b89
movq 0x28(%rdi), %rax
testq %rax, %rax
je 0x3ba8
testl %esi, %esi
je 0x3b68
pushq $-0x1
popq %rbx
jmp 0x3b73
xorl %ebx, %ebx
decq %rax
movq %rax, 0x28(%rdi)
je 0x3b77
movl %ebx, %eax
popq %rbx
retq
movl $0x1, 0x30(%rdi)
callq 0x3932
testl %eax, %eax
jne 0x3b63
jmp 0x3b73
leaq 0x8b1c(%rip), %rdi      # 0xc6ac
leaq 0x8aee(%rip), %rsi      # 0xc685
leaq 0x8b1b(%rip), %rcx      # 0xc6b9
movl $0x106, %edx            # imm = 0x106
callq 0x21a0
leaq 0x8b29(%rip), %rdi      # 0xc6d8
leaq 0x8acf(%rip), %rsi      # 0xc685
leaq 0x8afc(%rip), %rcx      # 0xc6b9
movl $0x107, %edx            # imm = 0x107
callq 0x21a0
nop
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/lbs-s3/findlast.c
// Function: findlast
int
findlast(struct wire_requestqueue * Q_S3, const char * bucket,
    uint64_t * L, size_t * olen)
{
	uint64_t N;
	int i;
	int status;
	size_t clen;

	/* We have no objects yet. */
	*L = 0;
	*olen = 0;

	/* See Algorithm FindLast in the DESIGN file. */
	for (i = 0; i < 64; i++) {
		if (head(Q_S3, bucket, (uint64_t)(1) << i, &status, &clen))
			goto err0;
		if (status == 404)
			break;
		if (status != 200)
			goto err1;
		*L = (uint64_t)(1) << i;
		*olen = clen;
	}
	for (N = *L / 2; N > 0; N = N / 2) {
		if (head(Q_S3, bucket, *L + N, &status, &clen))
			goto err0;
		if (status == 200) {
			*L = *L + N;
			*olen = clen;
		} else if (status != 404)
			goto err1;
	}

	/* If necessary, scan backwards until we find a non-empty object. */
	while ((*olen == 0) && (*L > 1)) {
		*L -= 1;
		if (head(Q_S3, bucket, *L, &status, &clen))
			goto err0;
		if (status == 404) {
			warn0("Cannot find non-empty S3 object");
			goto err0;
		} else if (status != 200)
			goto err1;
		*olen = clen;
	}

	/* Success! */
	return (0);

err1:
	warn0("HEAD returned status %d!", status);
err0:
	/* Failure! */
	return (-1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rcx, %rbx
movq %rdx, %r14
movq %rsi, %r15
movq %rdi, %r12
andq $0x0, (%rdx)
andq $0x0, (%rcx)
xorl %r13d, %r13d
cmpq $0x40, %r13
je 0x3c44
pushq $0x1
popq %rbp
movl %r13d, %ecx
shlq %cl, %rbp
movq %r12, %rdi
movq %r15, %rsi
movq %rbp, %rdx
leaq 0xc(%rsp), %rcx
leaq 0x10(%rsp), %r8
callq 0x3d25
testl %eax, %eax
jne 0x3d13
movl 0xc(%rsp), %esi
cmpl $0xc8, %esi
jne 0x3c38
movq %rbp, (%r14)
movq 0x10(%rsp), %rax
movq %rax, (%rbx)
incq %r13
jmp 0x3bed
cmpl $0x194, %esi            # imm = 0x194
jne 0x3cfd
movq (%r14), %r13
leaq 0x10(%rsp), %rbp
cmpq $0x2, %r13
jb 0x3c97
shrq %r13
movq (%r14), %rdx
addq %r13, %rdx
movq %r12, %rdi
movq %r15, %rsi
leaq 0xc(%rsp), %rcx
movq %rbp, %r8
callq 0x3d25
testl %eax, %eax
jne 0x3d13
movl 0xc(%rsp), %esi
cmpl $0x194, %esi            # imm = 0x194
je 0x3c4c
cmpl $0xc8, %esi
jne 0x3cfd
addq %r13, (%r14)
movq 0x10(%rsp), %rax
movq %rax, (%rbx)
jmp 0x3c4c
movq (%rbx), %rcx
leaq 0xc(%rsp), %r13
leaq 0x10(%rsp), %rbp
xorl %eax, %eax
testq %rcx, %rcx
jne 0x3d16
movq (%r14), %rdx
cmpq $0x2, %rdx
jb 0x3d16
decq %rdx
movq %rdx, (%r14)
movq %r12, %rdi
movq %r15, %rsi
movq %r13, %rcx
movq %rbp, %r8
callq 0x3d25
testl %eax, %eax
jne 0x3d13
movl 0xc(%rsp), %esi
cmpl $0xc8, %esi
jne 0x3ce5
movq 0x10(%rsp), %rcx
movq %rcx, (%rbx)
jmp 0x3ca4
cmpl $0x194, %esi            # imm = 0x194
jne 0x3cfd
leaq 0x89f4(%rip), %rdi      # 0xc6e8
xorl %eax, %eax
callq 0x8cc0
jmp 0x3d0b
leaq 0x8a04(%rip), %rdi      # 0xc708
xorl %eax, %eax
callq 0x8cc0
callq 0x20a0
andl $0x0, (%rax)
pushq $-0x1
popq %rax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/lbs-s3/findlast.c
// Function: head
static int
head(struct wire_requestqueue * Q_S3, const char * bucket, uint64_t N,
    int * status, size_t * clen)
{
	struct headdata hd;

	/* Issue a HEAD request. */
	hd.done = 0;
	if (proto_s3_request_head(Q_S3, bucket, objmap(N), callback_head, &hd))
		goto err1;

	/* Wait for the request to finish. */
	if (events_spin(&hd.done))
		goto err1;

	/* If the status is 0, we failed. */
	if (status == 0)
		goto err1;

	/* Return results. */
	*status = hd.status;
	*clen = hd.clen;

	/* Success! */
	return (0);

err1:
	warnp("Error issuing HEAD request");

	/* Failure! */
	return (-1);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %r8, %rbx
movq %rcx, %r14
movq %rsi, %r15
movq %rdi, %r12
movq %rsp, %r13
andl $0x0, (%r13)
movq %rdx, %rdi
callq 0x3de0
leaq 0x78(%rip), %rcx        # 0x3dcd
movq %r12, %rdi
movq %r15, %rsi
movq %rax, %rdx
movq %r13, %r8
callq 0x995d
testl %eax, %eax
je 0x3d8a
callq 0x20a0
cmpl $0x0, (%rax)
je 0x3dae
movq %rax, %rbx
leaq 0x89a3(%rip), %rdi      # 0xc721
xorl %eax, %eax
callq 0x8b31
andl $0x0, (%rbx)
jmp 0x3dbc
movq %rsp, %rdi
callq 0x4bef
testq %r14, %r14
je 0x3d6a
testl %eax, %eax
jne 0x3d6a
movl 0x4(%rsp), %eax
movl %eax, (%r14)
movq 0x8(%rsp), %rax
movq %rax, (%rbx)
xorl %eax, %eax
jmp 0x3dbf
leaq 0x896c(%rip), %rdi      # 0xc721
xorl %eax, %eax
callq 0x8cc0
pushq $-0x1
popq %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]kivaloo/lbs-s3/objmap.c
// Function: objmap
const char *
objmap(uint64_t N)
{
	uint8_t Nbuf[8];
	uint8_t hbuf[16];
	static char oname[22]; /* HASH_0123456789012345 */

	/* Serialize the value N. */
	be64enc(Nbuf, N);

	/* Hash the (serialized) value. */
	MD5_Buf(Nbuf, 8, hbuf);

	/* Hexify the first two bytes of hash. */
	hexify(hbuf, &oname[0], 2);

	/* Separator character. */
	oname[4] = '_';

	/* Hexify the 8-byte integer. */
	hexify(Nbuf, &oname[5], 8);

	/* NUL-terminate. */
	oname[21] = '\0';

	/* Return the constructed string. */
	return (oname);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x28, %rsp
bswapq %rdi
leaq 0x8(%rsp), %rbx
movq %rdi, (%rbx)
pushq $0x8
popq %r14
leaq 0x10(%rsp), %r15
movq %rbx, %rdi
movq %r14, %rsi
movq %r15, %rdx
callq 0x473b
leaq 0xf81c(%rip), %r12      # 0x13630
pushq $0x2
popq %rdx
movq %r15, %rdi
movq %r12, %rsi
callq 0x761c
movb $0x5f, 0xf80b(%rip)     # 0x13634
leaq 0xf805(%rip), %rsi      # 0x13635
movq %rbx, %rdi
movq %r14, %rdx
callq 0x761c
movb $0x0, 0xf803(%rip)      # 0x13645
movq %r12, %rax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/trumabrat[P]GrandProjet/chaineMain.c
// Function: main
int main()
{
    /* 
        lecture et creation d'une instance de Chaines
        on peut decommenter pour choisir l'instance qu'on va verifier
    */

    // FILE* f = fopen("00014_burma.cha", "r");
    // FILE* f = fopen("05000_USA-road-d-NY.cha", "r");
    FILE* f = fopen("07397_pla.cha", "r");
    // FILE* f = fopen("test.cha", "r");
    
    // FILE *f2 = fopen("00014_burma_res.txt", "w");
    // FILE* f2 = fopen("05000_USA-road-d-NY_res.txt", "w");
    FILE* f2 = fopen("07397_pla.cha_res", "w");
    // FILE* f2 = fopen("test_res.cha", "w");
    Chaines *c = lectureChaines(f);
    ecrireChaines(c, f2);

    // affichage de cette Chaines
    afficheChainesSVG(c, "Chaines");
    printf("LongueurTotal = %lf, nombre de points = %d\n", longueurTotale(c), comptePointsTotal(c));

    // fermeture des fichiers et liberation
    liberer_chaines(c);
    fclose(f);
    fclose(f2);
    return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
leaq 0xde8(%rip), %rdi       # 0x2004
leaq 0xdef(%rip), %rsi       # 0x2012
callq 0x10d0
movq %rax, %rbx
leaq 0xde2(%rip), %rdi       # 0x2014
leaq 0xded(%rip), %rsi       # 0x2026
callq 0x10d0
movq %rax, %r14
movq %rbx, %rdi
callq 0x12b8
movq %rax, %r15
movq %rax, %rdi
movq %r14, %rsi
callq 0x13fb
leaq 0xdca(%rip), %rsi       # 0x2028
movq %r15, %rdi
callq 0x14d5
movq %r15, %rdi
callq 0x16da
movsd %xmm0, 0x8(%rsp)
movq %r15, %rdi
callq 0x172b
leaq 0xdad(%rip), %rdi       # 0x2030
movsd 0x8(%rsp), %xmm0
movl %eax, %esi
movb $0x1, %al
callq 0x1080
movq %r15, %rdi
callq 0x17a0
movq %rbx, %rdi
callq 0x1060
movq %r14, %rdi
callq 0x1060
xorl %eax, %eax
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
nop
// File: /workspace/github_c_makefile_star2_O2/giometti[P]mastering_UNIX_programming/chapter_01/buffered.c
// Function: main
int main(void)
{
	int n;
	char buf[DATA_SIZE];

	memset(buf, 0, DATA_SIZE);
	for (n = 0; n < DATA_SIZE; n++)
		if (fputc(buf[n], stdout) != buf[n]) {
			err("write error\n");
			break;
		}

	return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20000, %rsp          # imm = 0x20000
movq %rsp, %rdi
xorl %r14d, %r14d
movl $0x20000, %edx          # imm = 0x20000
xorl %esi, %esi
callq 0x1040
movq 0x2e57(%rip), %r15      # 0x3fd8
cmpq $0x20000, %r14          # imm = 0x20000
je 0x11b6
movsbl (%rsp,%r14), %ebx
movq (%r15), %rsi
movl %ebx, %edi
callq 0x1050
incq %r14
cmpl %ebx, %eax
je 0x1181
movq 0x2e51(%rip), %rax      # 0x3ff8
movq (%rax), %rsi
leaq 0xe53(%rip), %rdi       # 0x2004
callq 0x1030
xorl %eax, %eax
addq $0x20000, %rsp          # imm = 0x20000
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O2/kaugm[P]mmwm/mmwm.c
// Function: xcb_remove_property
void xcb_remove_property(xcb_connection_t *con, xcb_window_t win, xcb_atom_t prop, xcb_atom_t atom)
{
    xcb_grab_server(con);

    xcb_get_property_reply_t *reply =
        xcb_get_property_reply(con,
                               xcb_get_property(con, False, win, prop, XCB_GET_PROPERTY_TYPE_ANY, 0, 4096), NULL);
    if (reply == NULL || xcb_get_property_value_length(reply) == 0)
        goto release_grab;
    xcb_atom_t *atoms = xcb_get_property_value(reply);
    if (atoms == NULL) {
        goto release_grab;
    }

    {
        int num = 0;
        const int current_size = xcb_get_property_value_length(reply) / (reply->format / 8);
        xcb_atom_t values[current_size];
        for (int i = 0; i < current_size; i++) {
            if (atoms[i] != atom)
                values[num++] = atoms[i];
        }

        xcb_change_property(con, XCB_PROP_MODE_REPLACE, win, prop, XCB_ATOM_ATOM, 32, num, values);
    }

release_grab:
    if (reply)
        free(reply);
    xcb_ungrab_server(con);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %ecx, %r12d
movl %edx, %r14d
movl %esi, %r15d
movq %rdi, %rbx
callq 0x3410
subq $0x8, %rsp
movq %rbx, %rdi
xorl %esi, %esi
movl %r15d, %edx
movl %r14d, -0x2c(%rbp)
movl %r14d, %ecx
xorl %r8d, %r8d
xorl %r9d, %r9d
pushq $0x1000                 # imm = 0x1000
callq 0x3080
popq %rcx
popq %rdx
movq %rbx, %rdi
movl %eax, %esi
xorl %edx, %edx
callq 0x34f0
movq %rax, %r13
testq %rax, %rax
je 0x38a7
movq %r13, %rdi
callq 0x3470
testl %eax, %eax
je 0x38a7
movq %r13, %rdi
callq 0x3100
testq %rax, %rax
je 0x38a7
movq %rax, %r14
movq %r13, %rdi
callq 0x3470
movq %rsp, -0x38(%rbp)
movzbl 0x1(%r13), %ecx
shrl $0x3, %ecx
cltd
idivl %ecx
leaq 0xf(,%rax,4), %rcx
andq $-0x10, %rcx
movq %rsp, %r10
subq %rcx, %r10
movq %r10, %rsp
xorl %ecx, %ecx
testl %eax, %eax
cmovlel %ecx, %eax
xorl %r11d, %r11d
cmpq %rcx, %rax
je 0x3885
movl (%r14,%rcx,4), %edx
cmpl %r12d, %edx
je 0x3880
movslq %r11d, %rsi
incl %r11d
movl %edx, (%r10,%rsi,4)
incq %rcx
jmp 0x3868
pushq $0x4
popq %r8
pushq $0x20
popq %r9
movq %rbx, %rdi
xorl %esi, %esi
movl %r15d, %edx
movl -0x2c(%rbp), %ecx
pushq %r10
pushq %r11
callq 0x35c0
popq %rcx
popq %rdx
movq -0x38(%rbp), %rsp
movq %r13, %rdi
callq 0x3050
movq %rbx, %rdi
callq 0x3130
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/kaugm[P]mmwm/mmwm.c
// Function: setup_keyboard
int setup_keyboard(void)
{
    xcb_get_modifier_mapping_reply_t *reply;
    xcb_keycode_t                    *modmap;
    xcb_keycode_t                    *numlock;

    if (!(keysyms = xcb_key_symbols_alloc(dis)))
        return -1;

    reply = xcb_get_modifier_mapping_reply(dis,
                            xcb_get_modifier_mapping_unchecked(dis), NULL);
                            /* TODO: error checking */
    if (!reply)
        return -1;

    modmap = xcb_get_modifier_mapping_keycodes(reply);
    if (!modmap) {
        free(reply);
        return -1;
    }

    numlock = xcb_get_keycodes(XK_Num_Lock);
    if (numlock) {
        for (unsigned int i = 0; i < 8; i++) {
            for (unsigned int j = 0; j < reply->keycodes_per_modifier; j++) {
                xcb_keycode_t keycode =
                        modmap[i * reply->keycodes_per_modifier +
                                               j];
                if (keycode == XCB_NO_SYMBOL)
                    continue;
                for (unsigned int n = 0; numlock[n] != XCB_NO_SYMBOL; n++) {
                    if (numlock[n] == keycode) {
                        DEBUGP("xcb: found num-lock %d\n", 1 << i);
                        numlockmask = 1 << i;
                        break;
                    }
                }
            }
        }
        free(numlock);
    }
    free(reply);


    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq 0x6e7c(%rip), %rdi      # 0xa750
callq 0x3150
movq %rax, 0x6e78(%rip)      # 0xa758
pushq $-0x1
popq %rbp
testq %rax, %rax
je 0x399e
movq 0x6e5d(%rip), %rbx      # 0xa750
movq %rbx, %rdi
callq 0x3680
movq %rbx, %rdi
movl %eax, %esi
xorl %edx, %edx
callq 0x3620
testq %rax, %rax
je 0x399e
movq %rax, %rbx
movq %rax, %rdi
callq 0x30b0
testq %rax, %rax
je 0x3993
movq %rax, %r14
movl $0xff7f, %edi           # imm = 0xFF7F
callq 0x39ab
testq %rax, %rax
je 0x398f
movzbl 0x1(%rbx), %edx
xorl %ecx, %ecx
pushq $0x1
popq %rsi
cmpq $0x8, %rcx
je 0x3987
movl %esi, %edi
shll %cl, %edi
movq %rcx, %r8
imulq %rdx, %r8
addq %r14, %r8
xorl %r9d, %r9d
cmpq %rdx, %r9
je 0x3982
movb (%r8,%r9), %r10b
testb %r10b, %r10b
je 0x397d
xorl %r11d, %r11d
movl %r11d, %r15d
movb (%rax,%r15), %bpl
testb %bpl, %bpl
je 0x397d
incl %r11d
cmpb %r10b, %bpl
jne 0x3963
movl %edi, 0x6de3(%rip)      # 0xa760
incq %r9
jmp 0x3952
incq %rcx
jmp 0x393b
movq %rax, %rdi
callq 0x3050
xorl %ebp, %ebp
jmp 0x3996
pushq $-0x1
popq %rbp
movq %rbx, %rdi
callq 0x3050
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/kaugm[P]mmwm/mmwm.c
// Function: xcb_move_resize
static inline void xcb_move_resize(xcb_connection_t *con, xcb_window_t win, int x, int y, int w, int h, posxy_t *pi)
{
    unsigned int pos[4] = { x, y, w, h };

    if (pi) {
        pi->previous_x = pi->current_x;
        pi->previous_y = pi->current_y;
        pi->current_x = x;
        pi->current_y = y;
    }
    xcb_configure_window(con, win, XCB_MOVE_RESIZE, pos);
}

// Assembly:
subq $0x18, %rsp
movq 0x20(%rsp), %rax
movl %edx, (%rsp)
movl %ecx, 0x4(%rsp)
movl %r8d, 0x8(%rsp)
movl %r9d, 0xc(%rsp)
testq %rax, %rax
je 0x3c29
movq 0x8(%rax), %r8
movq %r8, (%rax)
movl %edx, 0x8(%rax)
movl %ecx, 0xc(%rax)
pushq $0xf
popq %rdx
movq %rsp, %rcx
callq 0x32b0
addq $0x18, %rsp
retq
// File: /workspace/github_c_makefile_star2_O2/kaugm[P]mmwm/mmwm.c
// Function: destroy_display
static void destroy_display(client *c)
{
    desktop *desk=NULL;
    monitor *moni=NULL;
    display *disp=NULL, *next;

    getparents(c, &disp, &moni, &desk);     /* get the client's display, monitor and desktop. */
    if (!(next = (display *)get_next(&disp->link)))     /* cannot destroy the last display. */
        return;
    for (client *t = (client *)rem_head(&disp->clients); t; t = (client *)rem_head(&disp->clients)) {
    /* relink entire clientlist to the tail of next display clientlist. */
        add_tail(&next->clients, &t->link);
    }
    rem_node(&disp->link);                   /* unlink now empty display */
    select_desktop(current_desktop_number);     /* update global pointers */
    for (alien *t = (alien *)get_head(&aliens); t; t = (alien *)get_next(&t->link))   /* show aliens */
        xcb_move(dis, t->win, t->position_info.previous_x, t->position_info.previous_y, &t->position_info);
    if (current_display == next) {
        update_current(c);
    }
    free(disp);
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
testq %rdi, %rdi
je 0x3c8a
movq %rdi, %rbx
movq 0x10(%rdi), %rax
movq 0x10(%rax), %r14
testq %r14, %r14
je 0x3c8a
movq 0x8(%r14), %r13
testq %r13, %r13
je 0x3c8a
leaq 0x18(%r14), %r15
movq %r15, %rdi
callq 0x4ced
leaq 0x18(%r13), %r12
testq %rax, %rax
je 0x3c94
movq %r12, %rdi
movq %rax, %rsi
callq 0x4d07
movq %r15, %rdi
callq 0x4ced
jmp 0x3c70
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
movq %r14, %rdi
callq 0x4c14
movl 0x6b06(%rip), %edi      # 0xa7a8
callq 0x4ca0
leaq 0x6ae2(%rip), %r15      # 0xa790
movq (%r15), %r15
testq %r15, %r15
je 0x3cd8
movq 0x6a93(%rip), %rdi      # 0xa750
leaq 0x20(%r15), %r8
movl 0x18(%r15), %esi
movl 0x20(%r15), %edx
movl 0x24(%r15), %ecx
callq 0x4c77
addq $0x8, %r15
jmp 0x3cae
cmpq %r13, 0x6aa1(%rip)      # 0xa780
jne 0x3ce9
movq %rbx, %rdi
callq 0x3cfa
movq %r14, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x3050
// File: /workspace/github_c_makefile_star2_O2/kaugm[P]mmwm/mmwm.c
// Function: desktopinfo
void desktopinfo(void)
{
#ifndef EWMH_TASKBAR
    bool urgent = false;
    int cd = current_desktop_number, n = 0, d = 0;
    xcb_get_property_cookie_t cookie;
    xcb_ewmh_get_utf8_strings_reply_t wtitle;
    wtitle.strings = NULL;

    if (M_CURRENT) {
        cookie = xcb_ewmh_get_wm_name_unchecked(ewmh, M_CURRENT->win);
        xcb_ewmh_get_wm_name_reply(ewmh, cookie, &wtitle, (void *)0);
    }

    for (client *c; d < DESKTOPS; d++) {
        for (select_desktop(d), c = M_HEAD, n = 0, urgent = false;
             c; c = M_GETNEXT(c), ++n)
            if (c->isurgent)
                urgent = true;
        fprintf(stdout, "%d:%d:%d:%d:%d ", d, n, M_MODE, current_desktop_number == cd,
                urgent);
    }

    if (wtitle.strings) {
        xcb_ewmh_get_utf8_strings_reply_wipe(&wtitle);
    }

    fflush(stdout);
    if (cd != d - 1)
        select_desktop(cd);
#else
    Update_EWMH_Taskbar_Properties();
#endif /* EWMH_TASKBAR */
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x20, %rsp
andq $0x0, 0x10(%rsp)
movl 0x5c71(%rip), %ebx      # 0xa7a8
movq 0x5c42(%rip), %rax      # 0xa780
movq 0x30(%rax), %rax
testq %rax, %rax
je 0x4b6b
movq 0x5c1a(%rip), %rdi      # 0xa768
movl 0x20(%rax), %esi
callq 0x3460
movq 0x5c0b(%rip), %rdi      # 0xa768
leaq 0x8(%rsp), %rdx
movl %eax, %esi
xorl %ecx, %ecx
callq 0x31c0
movq 0x545e(%rip), %r15      # 0x9fd0
leaq 0x26f5(%rip), %r14      # 0x726e
pushq $0x1
popq %r12
xorl %ebp, %ebp
cmpl $0xa, %ebp
je 0x4be1
movl %ebp, %edi
callq 0x4ca0
movq 0x5bee(%rip), %rdx      # 0xa780
leaq 0x18(%rdx), %rsi
xorl %ecx, %ecx
xorl %eax, %eax
movq (%rsi), %rsi
testq %rsi, %rsi
je 0x4bb5
movzbl %al, %eax
cmpb $0x0, 0x18(%rsi)
cmovnel %r12d, %eax
addq $0x8, %rsi
incl %ecx
jmp 0x4b9a
movq (%r15), %rdi
xorl %r9d, %r9d
cmpl %ebx, 0x5be7(%rip)      # 0xa7a8
movl 0x5c(%rdx), %r8d
sete %r9b
andb $0x1, %al
movzbl %al, %eax
movl %eax, (%rsp)
movq %r14, %rsi
movl %ebp, %edx
xorl %eax, %eax
callq 0x3370
incl %ebp
jmp 0x4b7f
cmpq $0x0, 0x10(%rsp)
je 0x4bf3
leaq 0x8(%rsp), %rdi
callq 0x35b0
movq (%r15), %rdi
callq 0x3400
cmpl $0x9, %ebx
je 0x4c07
movl %ebx, %edi
callq 0x4ca0
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/kaugm[P]mmwm/mmwm.c
// Function: rem_node
static node *rem_node(node *n)
{
    list *l;

    if (!n)
        return NULL;
    l = n->parent;
    if (l) {
        if (n == l->head) {
            l->head = l->head->next;
            if(l->head)
                l->head->prev = NULL;
            else
                l->tail = NULL;
        }
        else if (n == l->tail) {
            l->tail = l->tail->prev;
            l->tail->next = NULL;
        }
        else {
            n->prev->next = n->next;
            n->next->prev = n->prev;
        }
    }
    n->prev = n->next = NULL;
    n->parent = NULL;
    return n;
}

// Assembly:
movq %rdi, %rax
testq %rdi, %rdi
je 0x4c76
movq 0x10(%rax), %rcx
testq %rcx, %rcx
je 0x4c6b
movq (%rcx), %rdx
cmpq %rax, %rdx
je 0x4c46
movq 0x8(%rcx), %rdx
cmpq %rax, %rdx
je 0x4c58
movq (%rax), %rcx
movq 0x8(%rax), %rdx
movq %rdx, 0x8(%rcx)
movq %rcx, (%rdx)
jmp 0x4c6b
movq 0x8(%rdx), %rdx
movq %rdx, (%rcx)
testq %rdx, %rdx
je 0x4c66
andq $0x0, (%rdx)
jmp 0x4c6b
movq (%rdx), %rdx
movq %rdx, 0x8(%rcx)
andq $0x0, 0x8(%rdx)
jmp 0x4c6b
andq $0x0, 0x8(%rcx)
xorps %xmm0, %xmm0
movups %xmm0, (%rax)
andq $0x0, 0x10(%rax)
retq
// File: /workspace/github_c_makefile_star2_O2/kaugm[P]mmwm/mmwm.c
// Function: xcb_move
static inline void xcb_move(xcb_connection_t *con, xcb_window_t win, int x, int y, posxy_t *pi)
{
    unsigned int pos[2] = { x, y };

    if (pi) {
        pi->previous_x = pi->current_x;
        pi->previous_y = pi->current_y;
        pi->current_x = x;
        pi->current_y = y;
    }
    xcb_configure_window(con, win, XCB_MOVE, pos);
}

// Assembly:
pushq %rax
movl %edx, (%rsp)
movl %ecx, 0x4(%rsp)
testq %r8, %r8
je 0x4c93
movq 0x8(%r8), %rax
movq %rax, (%r8)
movl %edx, 0x8(%r8)
movl %ecx, 0xc(%r8)
pushq $0x3
popq %rdx
movq %rsp, %rcx
callq 0x32b0
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O2/kaugm[P]mmwm/mmwm.c
// Function: select_desktop
void select_desktop(int i)
{
    if (i < 0 || i >= DESKTOPS)
        return;
    current_desktop = find_desktop(i);
    if (!current_desktop)
        current_desktop = (desktop *)get_head(&desktops);
    current_desktop_number = current_desktop->num;
    current_monitor = (monitor *)get_head(&current_desktop->monitors);
    current_display = (display *)get_head(&current_monitor->displays);
}

// Assembly:
cmpl $0x9, %edi
ja 0x4cec
leaq 0x5b0c(%rip), %rax      # 0xa7b8
movq (%rax), %rax
testq %rax, %rax
je 0x4cbf
cmpl %edi, 0x30(%rax)
je 0x4cc9
addq $0x8, %rax
jmp 0x4cac
movq 0x5af2(%rip), %rax      # 0xa7b8
movl 0x30(%rax), %edi
movq %rax, 0x5ae0(%rip)      # 0xa7b0
movl %edi, 0x5ad2(%rip)      # 0xa7a8
movq 0x18(%rax), %rax
movq %rax, 0x5aa7(%rip)      # 0xa788
movq 0x18(%rax), %rax
movq %rax, 0x5a94(%rip)      # 0xa780
retq
// File: /workspace/github_c_makefile_star2_O2/kaugm[P]mmwm/mmwm.c
// Function: add_tail
static void add_tail(list *l, node *i)
{
    if(l->head == NULL)
        add_head(l, i);
    else {
        node *o = l->tail;
        l->tail = i;
        o->next = i;
        i->prev = o;
        i->next = NULL;
    }
    i->parent = l;
}

// Assembly:
cmpq $0x0, (%rdi)
je 0x4d23
movq 0x8(%rdi), %rax
movq %rsi, 0x8(%rdi)
movq %rsi, 0x8(%rax)
movq %rax, (%rsi)
andq $0x0, 0x8(%rsi)
jmp 0x4d2a
movq %rsi, 0x8(%rdi)
movq %rsi, (%rdi)
movq %rdi, 0x10(%rsi)
retq
// File: /workspace/github_c_makefile_star2_O2/kaugm[P]mmwm/mmwm.c
// Function: sendevent
static bool sendevent(xcb_window_t win, xcb_atom_t proto)
{
    bool got = check_wmproto(win, proto);
    if (got) {
        xcb_client_message_event_t ev = {0};

        ev.response_type = XCB_CLIENT_MESSAGE;
        ev.window = win;
        ev.format = 32;
        ev.sequence = 0;
        ev.type = wmatoms[WM_PROTOCOLS];
        ev.data.data32[0] = proto;
        ev.data.data32[1] = XCB_CURRENT_TIME;
        xcb_send_event(dis, 0, win, XCB_EVENT_MASK_NO_EVENT, (char *)&ev);
    }

    return got;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
subq $0x28, %rsp
movl %esi, %ebp
movl %edi, %ebx
movq 0x5987(%rip), %r14      # 0xa750
movl 0x5a11(%rip), %edx      # 0xa7e0
movq %r14, %rdi
movl %ebx, %esi
callq 0x30c0
xorl %r15d, %r15d
leaq 0x8(%rsp), %rdx
movq %r14, %rdi
movl %eax, %esi
xorl %ecx, %ecx
callq 0x3110
testb %al, %al
je 0x4e64
movl 0x8(%rsp), %eax
movq 0x10(%rsp), %rcx
cmpl %r15d, %eax
je 0x4e5a
movl %r15d, %edx
incl %r15d
cmpl %ebp, (%rcx,%rdx,4)
jne 0x4dfa
leaq 0x8(%rsp), %r14
movq %r14, %rdi
callq 0x30a0
andl $0x0, 0x1c(%r14)
andq $0x0, 0x14(%r14)
movl $0x2021, (%r14)         # imm = 0x2021
movl %ebx, 0x4(%r14)
movl 0x59ae(%rip), %eax      # 0xa7e0
movl %eax, 0x8(%r14)
movl %ebp, 0xc(%r14)
andl $0x0, 0x10(%r14)
movq 0x590a(%rip), %rdi      # 0xa750
leaq 0x8(%rsp), %r8
xorl %esi, %esi
movl %ebx, %edx
xorl %ecx, %ecx
callq 0x3530
movb $0x1, %al
jmp 0x4e66
leaq 0x8(%rsp), %rdi
callq 0x30a0
xorl %eax, %eax
addq $0x28, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/kaugm[P]mmwm/mmwm.c
// Function: getcolor
unsigned int getcolor(char *color)
{
    xcb_colormap_t map = screen->default_colormap;
    xcb_alloc_color_reply_t *c;
    unsigned int r, g, b, rgb, pixel;

    rgb = xcb_get_colorpixel(color);
    r = rgb >> 16; g = rgb >> 8 & 0xFF; b = rgb & 0xFF;
    c = xcb_alloc_color_reply(dis, xcb_alloc_color(dis, map, r * 257, g * 257,
                                                   b * 257), NULL);
    if (!c)
        errx(EXIT_FAILURE, "error: cannot allocate color '%s'\n", color);

    pixel = c->pixel;
    free(c);

    return pixel;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, %r14
movq 0x5561(%rip), %rax      # 0xa770
movl 0x4(%rax), %ebp
movb 0x1(%rdi), %al
leaq 0x12(%rsp), %rbx
movb %al, -0x3(%rbx)
movb 0x2(%rdi), %al
movb %al, -0x2(%rbx)
xorl %eax, %eax
movb %al, -0x1(%rbx)
movb 0x3(%rdi), %cl
movb %cl, (%rbx)
movb 0x4(%rdi), %cl
movb %cl, 0x1(%rbx)
movb %al, 0x2(%rbx)
leaq 0x15(%rsp), %r15
movb 0x5(%rdi), %cl
movb %cl, (%r15)
movb 0x6(%rdi), %cl
movb %cl, 0x1(%r15)
movb %al, 0x2(%r15)
leaq 0xf(%rsp), %rdi
pushq $0x10
popq %r12
xorl %esi, %esi
movl %r12d, %edx
callq 0x3380
movq %rax, %r13
movq %rbx, %rdi
xorl %esi, %esi
movl %r12d, %edx
callq 0x3380
movq %rax, %rbx
movq %r15, %rdi
xorl %esi, %esi
movl %r12d, %edx
callq 0x3380
shll $0x10, %r13d
shll $0x8, %ebx
addl %r13d, %ebx
addl %eax, %ebx
movl %ebx, %eax
shrl $0x10, %eax
movq 0x54b9(%rip), %r15      # 0xa750
imull $0x101, %eax, %edx      # imm = 0x101
movzbl %bh, %eax
imull $0x101, %eax, %ecx      # imm = 0x101
movzbl %bl, %eax
imull $0x101, %eax, %r8d      # imm = 0x101
andl $0xffff, %edx           # imm = 0xFFFF
movq %r15, %rdi
movl %ebp, %esi
callq 0x34a0
movq %r15, %rdi
movl %eax, %esi
xorl %edx, %edx
callq 0x3440
testq %rax, %rax
je 0x52ed
movl 0x10(%rax), %ebx
movq %rax, %rdi
callq 0x3050
movl %ebx, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1eaf(%rip), %rsi      # 0x71a3
pushq $0x1
popq %rdi
movq %r14, %rdx
xorl %eax, %eax
callq 0x31b0
// File: /workspace/github_c_makefile_star2_O2/kaugm[P]mmwm/mmwm.c
// Function: buttonpress
void buttonpress(xcb_generic_event_t *e)
{
    xcb_button_press_event_t *ev = (xcb_button_press_event_t *)e;
    DEBUGP("xcb: button press: %d state: %d\n", ev->detail, ev->state);

    client *c = wintoclient(ev->event);

	if (CLICK_TO_FOCUS && M_CURRENT != c && ev->detail == XCB_BUTTON_INDEX_1) {
		update_current(c);
	}

	for (unsigned int i = 0; i < LENGTH(buttons); i++)
		if (buttons[i].func && buttons[i].button == ev->detail &&
			CLEANMASK(buttons[i].mask) == CLEANMASK(ev->state)) {
			if (M_CURRENT != c)
				update_current(c);
			if (buttons[i].root_only) {
				if (ev->event == ev->root && ev->child == 0)
					buttons[i].func(&(buttons[i].arg));
			}
			else {
				buttons[i].func(&(buttons[i].arg));
			}
		}

    if (CLICK_TO_FOCUS) {
        xcb_allow_events(dis, XCB_ALLOW_REPLAY_POINTER, ev->time);
        xcb_flush(dis);
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl 0xc(%rdi), %edi
callq 0x65c7
movq %rax, %r14
movq 0x5461(%rip), %rax      # 0xa780
cmpq %r14, 0x30(%rax)
je 0x5333
cmpb $0x1, 0x1(%rbx)
jne 0x5333
movq %r14, %rdi
callq 0x3cfa
pushq $0x5
popq %r12
leaq 0x5372(%rip), %r15      # 0xa6b0
subq $0x1, %r12
jb 0x53a6
cmpq $0x0, -0x8(%r15)
je 0x53a0
movzbl 0x1(%rbx), %eax
cmpl %eax, -0xc(%r15)
jne 0x53a0
movl 0x5405(%rip), %eax      # 0xa760
notl %eax
movzwl 0x1c(%rbx), %ecx
xorl -0x10(%r15), %ecx
andl %eax, %ecx
testl $0xfffffffd, %ecx       # imm = 0xFFFFFFFD
jne 0x53a0
movq 0x540a(%rip), %rax      # 0xa780
cmpq %r14, 0x30(%rax)
je 0x5384
movq %r14, %rdi
callq 0x3cfa
cmpb $0x1, 0x8(%r15)
jne 0x5399
movl 0xc(%rbx), %eax
cmpl 0x8(%rbx), %eax
jne 0x53a0
cmpl $0x0, 0x10(%rbx)
jne 0x53a0
movq %r15, %rdi
callq *-0x8(%r15)
addq $0x20, %r15
jmp 0x533e
movq 0x53a3(%rip), %rdi      # 0xa750
movl 0x4(%rbx), %edx
pushq $0x2
popq %rsi
callq 0x3160
movq 0x5391(%rip), %rdi      # 0xa750
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x3190
// File: /workspace/github_c_makefile_star2_O2/kaugm[P]mmwm/mmwm.c
// Function: clientmessage
void clientmessage(xcb_generic_event_t *e)
{
    xcb_client_message_event_t *ev = (xcb_client_message_event_t *)e;
    client *c = wintoclient(ev->window);

    DEBUG("xcb: client message");

    if (c && ev->type == ewmh->_NET_WM_STATE) {
        if (((unsigned)ev->data.data32[1] == ewmh->_NET_WM_STATE_FULLSCREEN
          || (unsigned)ev->data.data32[2] == ewmh->_NET_WM_STATE_FULLSCREEN)) {
            uint32_t mode = ev->data.data32[0];

            if (mode == _NET_WM_STATE_TOGGLE)
                mode = (c->isfullscreen) ? _NET_WM_STATE_REMOVE : _NET_WM_STATE_ADD;
            setfullscreen(c, mode == _NET_WM_STATE_ADD);
        }
    }
    else {
        if (ev->type == ewmh->_NET_CURRENT_DESKTOP
            && ev->data.data32[0] < DESKTOPS)
            change_desktop(&(Arg){.i = ev->data.data32[0]});
        else {
            if (c && ev->type == ewmh->_NET_CLOSE_WINDOW)
                killclient(c);
            else {
                if (ev->type == ewmh->_NET_ACTIVE_WINDOW) {
                    if (c) {
                        client *t = NULL;
                        for (t = M_HEAD; t && t != c; t = M_GETNEXT(t))
                            ;
                        if (t)
                            update_current(c);
                    }
                }
                else {
                    if (c && ev->type == ewmh->_NET_WM_DESKTOP
                          && ev->data.data32[0] < DESKTOPS) {
                        client_to_desktop(&(Arg){.i = ev->data.data32[0]});
                    }
                }
            }
        }
    }
}

// Assembly:
pushq %rbx
subq $0x10, %rsp
movq %rdi, %rbx
movl 0x4(%rdi), %edi
callq 0x65c7
movl 0x8(%rbx), %edx
movq 0x537f(%rip), %rcx      # 0xa768
testq %rax, %rax
je 0x542f
cmpl 0x84(%rcx), %edx
jne 0x542f
movl 0x128(%rcx), %ecx
cmpl %ecx, 0x10(%rbx)
je 0x540a
cmpl %ecx, 0x14(%rbx)
jne 0x54a8
movl 0xc(%rbx), %ecx
cmpl $0x2, %ecx
jne 0x5419
movzbl 0x1b(%rax), %ecx
xorl $0x1, %ecx
xorl %esi, %esi
cmpl $0x1, %ecx
sete %sil
movq %rax, %rdi
addq $0x10, %rsp
popq %rbx
jmp 0x39b9
cmpl 0x38(%rcx), %edx
jne 0x544a
movl 0xc(%rbx), %esi
cmpl $0x9, %esi
ja 0x544a
leaq 0x8(%rsp), %rdi
movl %esi, (%rdi)
callq 0x5dc5
jmp 0x54a8
testq %rax, %rax
je 0x54a8
cmpl 0x58(%rcx), %edx
jne 0x545e
addq $0x10, %rsp
popq %rbx
jmp 0x6417
cmpl 0x40(%rcx), %edx
jne 0x5491
movq 0x5316(%rip), %rdx      # 0xa780
addq $0x18, %rdx
movq (%rdx), %rcx
testq %rcx, %rcx
je 0x547f
leaq 0x8(%rcx), %rdx
cmpq %rax, %rcx
jne 0x546e
testq %rcx, %rcx
je 0x54a8
movq %rax, %rdi
addq $0x10, %rsp
popq %rbx
jmp 0x3cfa
cmpl 0x7c(%rcx), %edx
jne 0x54a8
movl 0xc(%rbx), %eax
cmpl $0x9, %eax
ja 0x54a8
movq %rsp, %rdi
movl %eax, (%rdi)
callq 0x602a
addq $0x10, %rsp
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O2/kaugm[P]mmwm/mmwm.c
// Function: configurerequest
void configurerequest(xcb_generic_event_t *e)
{
    xcb_configure_request_event_t *ev = (xcb_configure_request_event_t *)e;
    client *c = wintoclient(ev->window);

    DEBUG("xcb: configure request");

    if (c && c->ismaximized) {
        setmaximize(c, true);
    } else {
        unsigned int v[7];
        unsigned int i = 0;
        int borders = c ? client_borders(c) : 0;
        if (ev->value_mask & XCB_CONFIG_WINDOW_X)
            v[i++] = ev->x;
        if (ev->value_mask & XCB_CONFIG_WINDOW_Y) {
            int y = ev->y;
            if (c && c->type == ewmh->_NET_WM_WINDOW_TYPE_NORMAL) {
#ifndef EWMH_TASKBAR
                if (M_SHOWPANEL && TOP_PANEL && y < PANEL_HEIGHT)
#else
                if (y < M_WY)
#endif /* EWMH_TASKBAR */
                     y = PANEL_HEIGHT;
            }
            v[i++] = y;
        }
        if (ev->value_mask & XCB_CONFIG_WINDOW_WIDTH)
            v[i++] = (ev->width < M_WW - borders) ? ev->width : M_WW + borders;
        if (ev->value_mask & XCB_CONFIG_WINDOW_HEIGHT)
            v[i++] = (ev->height < M_WH - borders) ? ev->height : M_WH + borders;
        if (ev->value_mask & XCB_CONFIG_WINDOW_BORDER_WIDTH)
            v[i++] = ev->border_width;
        if (ev->value_mask & XCB_CONFIG_WINDOW_SIBLING)
            v[i++] = ev->sibling;
        if (ev->value_mask & XCB_CONFIG_WINDOW_STACK_MODE)
            v[i++] = ev->stack_mode;
        xcb_configure_window(dis, ev->window, ev->value_mask, v);
    }
    tile();
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x28, %rsp
movq %rdi, %r14
movl 0x8(%rdi), %ebx
movl %ebx, %edi
callq 0x65c7
testq %rax, %rax
je 0x54dd
cmpb $0x1, 0x1c(%rax)
jne 0x54e1
pushq $0x1
popq %rsi
movq %rax, %rdi
callq 0x62fa
jmp 0x55a2
xorl %edx, %edx
jmp 0x54eb
movl 0x40(%rax), %eax
xorl %edx, %edx
testl %eax, %eax
cmovgl %eax, %edx
movzwl 0x1a(%r14), %eax
xorl %ecx, %ecx
testb $0x1, %al
je 0x5501
movswl 0x10(%r14), %ecx
movl %ecx, (%rsp)
pushq $0x1
popq %rcx
testb $0x2, %al
je 0x5511
movswl 0x12(%r14), %esi
movl %ecx, %edi
incl %ecx
movl %esi, (%rsp,%rdi,4)
testb $0x4, %al
je 0x5539
movzwl 0x14(%r14), %esi
movq 0x5267(%rip), %rdi      # 0xa788
movl 0x34(%rdi), %edi
movl %edi, %r8d
subl %edx, %r8d
addl %edx, %edi
cmpl %esi, %r8d
cmovgl %esi, %edi
movl %ecx, %esi
incl %ecx
movl %edi, (%rsp,%rsi,4)
testb $0x8, %al
je 0x5561
movzwl 0x16(%r14), %esi
movq 0x523f(%rip), %rdi      # 0xa788
movl 0x38(%rdi), %edi
movl %edi, %r8d
subl %edx, %r8d
addl %edx, %edi
cmpl %esi, %r8d
cmovgl %esi, %edi
movl %ecx, %edx
incl %ecx
movl %edi, (%rsp,%rdx,4)
testb $0x10, %al
je 0x5571
movzwl 0x18(%r14), %edx
movl %ecx, %esi
incl %ecx
movl %edx, (%rsp,%rsi,4)
testb $0x20, %al
je 0x5580
movl 0xc(%r14), %edx
movl %ecx, %esi
incl %ecx
movl %edx, (%rsp,%rsi,4)
testb $0x40, %al
je 0x558e
movzbl 0x1(%r14), %edx
movl %ecx, %ecx
movl %edx, (%rsp,%rcx,4)
movq 0x51bb(%rip), %rdi      # 0xa750
movzwl %ax, %edx
movq %rsp, %rcx
movl %ebx, %esi
callq 0x32b0
callq 0x4d79
addq $0x28, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/kaugm[P]mmwm/mmwm.c
// Function: destroynotify
void destroynotify(xcb_generic_event_t *e)
{
    xcb_destroy_notify_event_t *ev = (xcb_destroy_notify_event_t *)e;
    client *c = wintoclient(ev->window);

    DEBUG("xcb: destroy notify");

    if (c) {
        if (c->isfullscreen)
            destroy_display(c);
        removeclient(c);
    }
   else {
        alien *a;

        if((a = wintoalien(&aliens, ev->window))) {
            DEBUG("unlink selfmapped window");
            rem_node(&a->link);
            free(a);
        }
    }
    desktopinfo();
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movl 0x8(%rdi), %ebp
movl %ebp, %edi
callq 0x65c7
testq %rax, %rax
je 0x55dc
movq %rax, %rbx
cmpb $0x1, 0x1b(%rax)
jne 0x55d2
movq %rbx, %rdi
callq 0x3c39
movq %rbx, %rdi
callq 0x6543
jmp 0x55fb
movl %ebp, %edi
callq 0x6970
testq %rax, %rax
je 0x55fb
movq %rax, %rbx
movq %rax, %rdi
callq 0x4c14
movq %rbx, %rdi
callq 0x3050
addq $0x8, %rsp
popq %rbx
popq %rbp
jmp 0x4b1f
// File: /workspace/github_c_makefile_star2_O2/kaugm[P]mmwm/mmwm.c
// Function: keypress
void keypress(xcb_generic_event_t *e)
{
    xcb_key_press_event_t *ev       = (xcb_key_press_event_t *)e;
    xcb_keysym_t           keysym   = xcb_get_keysym(ev->detail);

    DEBUGP("xcb: keypress: code: %d mod: %d\n", ev->detail, ev->state);
    for (unsigned int i = 0; i < LENGTH(keys); i++)
        if (keysym == keys[i].keysym &&
            CLEANMASK(keys[i].mod) == CLEANMASK(ev->state) &&
            keys[i].func)
                keys[i].func(&keys[i].arg);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movzbl 0x1(%rdi), %esi
movq 0x513c(%rip), %rdi      # 0xa758
xorl %edx, %edx
callq 0x33e0
movl %eax, %ebp
pushq $0x21
popq %r15
leaq 0x4d50(%rip), %r14      # 0xa380
subq $0x1, %r15
jb 0x566a
cmpl -0xc(%r14), %ebp
jne 0x5664
movl 0x511e(%rip), %eax      # 0xa760
notl %eax
movzwl 0x1c(%rbx), %ecx
xorl -0x10(%r14), %ecx
andl %eax, %ecx
testl $0xfffffffd, %ecx       # imm = 0xFFFFFFFD
jne 0x5664
movq -0x8(%r14), %rax
testq %rax, %rax
je 0x5664
movq %r14, %rdi
callq *%rax
addq $0x18, %r14
jmp 0x5630
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq