LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O2/nilyang[P]redis-tdd-annotation/src/redis-benchmark.c
// Function: writeHandler
static void writeHandler(aeEventLoop *el, int fd, void *privdata, int mask) {
    client c = privdata;
    REDIS_NOTUSED(el);
    REDIS_NOTUSED(fd);
    REDIS_NOTUSED(mask);

    /* Initialize request when nothing was written. */
    if (c->written == 0) {
        /* Enforce upper bound to number of requests. */
        if (config.requests_issued++ >= config.requests) {
            freeClient(c);
            return;
        }

        /* Really initialize: randomize keys and set start time. */
        if (config.randomkeys) randomizeClientKey(c);
        c->start = ustime();
        c->latency = -1;
    }

    if (sdslen(c->obuf) > c->written) {
        void *ptr = c->obuf+c->written;
        int nwritten = write(c->context->fd,ptr,sdslen(c->obuf)-c->written);
        if (nwritten == -1) {
            if (errno != EPIPE)
                fprintf(stderr, "Writing to socket: %s\n", strerror(errno));
            freeClient(c);
            return;
        }
        c->written += nwritten;
        if (sdslen(c->obuf) == c->written) {
            aeDeleteFileEvent(config.el,c->context->fd,AE_WRITABLE);
            aeCreateFileEvent(config.el,c->context->fd,AE_READABLE,readHandler,c);
        }
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rdx, %rbx
movl 0x28(%rdx), %eax
testl %eax, %eax
jne 0xbd11
movl 0x28762(%rip), %eax     # 0x343f4
leal 0x1(%rax), %ecx
movl %ecx, 0x28759(%rip)     # 0x343f4
cmpl 0x2874f(%rip), %eax     # 0x343f0
jge 0xbda2
cmpl $0x0, 0x28756(%rip)     # 0x34404
je 0xbd00
xorl %r14d, %r14d
pushq $0xc
popq %r15
pushq $0xa
popq %r12
cmpq 0x18(%rbx), %r14
jae 0xbd00
movq 0x10(%rbx), %rax
movq (%rax,%r14,8), %r13
callq 0x9360
movslq 0x28733(%rip), %rcx     # 0x34408
cqto
idivq %rcx
movq %rdx, %rax
movq %r15, %rsi
movq %r15, %rcx
subq $0x1, %rcx
jb 0xbcfb
xorl %edx, %edx
divq %r12
orb $0x30, %dl
movb %dl, -0x1(%r13,%rsi)
movq %rcx, %rsi
jmp 0xbce3
incq %r14
jmp 0xbcbb
callq 0xbe74
movq %rax, 0x30(%rbx)
orq $-0x1, 0x38(%rbx)
movl 0x28(%rbx), %eax
movq 0x8(%rbx), %rsi
movslq -0x8(%rsi), %rdx
movl %eax, %eax
subq %rax, %rdx
jbe 0xbd8c
addq %rax, %rsi
movq (%rbx), %rax
movl 0x84(%rax), %edi
callq 0x9140
cmpl $-0x1, %eax
je 0xbd96
addl 0x28(%rbx), %eax
movl %eax, 0x28(%rbx)
movq 0x8(%rbx), %rcx
movslq -0x8(%rcx), %rcx
cmpq %rax, %rcx
jne 0xbd8c
movq 0x28678(%rip), %rdi     # 0x343c8
movq (%rbx), %rax
movl 0x84(%rax), %esi
pushq $0x2
popq %rdx
callq 0x99b9
movq 0x28660(%rip), %rdi     # 0x343c8
movq (%rbx), %rax
movl 0x84(%rax), %esi
leaq 0x11f(%rip), %rcx       # 0xbe97
pushq $0x1
popq %rdx
movq %rbx, %r8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0x98f8
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
callq 0x9090
movl (%rax), %edi
cmpl $0x20, %edi
jne 0xbdb0
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
jmp 0xbdd5
movq 0x28241(%rip), %rax     # 0x33ff8
movq (%rax), %r14
callq 0x9560
leaq 0x196e8(%rip), %rsi     # 0x254ae
movq %r14, %rdi
movq %rax, %rdx
xorl %eax, %eax
callq 0x9300
jmp 0xbda2
// File: /workspace/github_c_makefile_star2_O2/giometti[P]mastering_UNIX_programming/chapter_09/setjmp1.c
// Function: main
int main(int argc, char *argv[])
{
	jmp_buf env;
	int i, j, k, l;
	int ret;

	if (argc < 5) {
		fprintf(stderr, "usage: %s <i> <j> <k> <l>\n", argv[0]);
		return -1;
	}

	/* Here we check if nested functions detect an error */
	ret = setjmp(env);
	if (ret != 0) {
		fprintf(stderr, "bad values!\n");
		return -1;
	}

	/* Convert the input values and then call func1() */
	i = atoi(argv[1]);
	j = atoi(argv[2]);
	k = atoi(argv[3]);
	l = atoi(argv[4]);
	printf("func1() returned %d\n", func1(env, i, j, k, l));

	return 0;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
subq $0xd0, %rsp
movq %rsi, %rbx
cmpl $0x4, %edi
jle 0x1274
movq %rsp, %rdi
callq 0x1040
testl %eax, %eax
jne 0x1291
movq 0x8(%rbx), %rdi
callq 0x1070
movl %eax, %ebp
movq 0x10(%rbx), %rdi
callq 0x1070
movl %eax, %r14d
movq 0x18(%rbx), %rdi
callq 0x1070
leal 0x1(%rax), %ecx
movq %rsp, %rdi
movl %ebp, %esi
movl %r14d, %edx
callq 0x11c7
leaq 0xdd1(%rip), %rdi       # 0x202c
xorl %ebx, %ebx
movl %eax, %esi
movl %ebx, %eax
callq 0x1030
movl %ebx, %eax
addq $0xd0, %rsp
popq %rbx
popq %r14
popq %rbp
retq
movq 0x2d7d(%rip), %rax      # 0x3ff8
movq (%rax), %rdi
movq (%rbx), %rdx
leaq 0xd7c(%rip), %rsi       # 0x2004
xorl %eax, %eax
callq 0x1050
jmp 0x12ad
movq 0x2d60(%rip), %rax      # 0x3ff8
movq (%rax), %rcx
leaq 0xd7d(%rip), %rdi       # 0x201f
pushq $0xc
popq %rsi
pushq $0x1
popq %rdx
callq 0x1080
pushq $-0x1
popq %rax
jmp 0x1268
// File: /workspace/github_c_makefile_star2_O2/PARKINHYO[P]BlackjackGame/fifo/fifo_client.c
// Function: main
int main(void)
{
	int id;
	char msg[BUFF_SIZE];

	//클라이언트 시작 시 파이프 open
	if ((fd = open(TO_SERVER_FILE, O_WRONLY)) == -1) {
		printf("[SYSTEM] in main() open error!!\n");
		return 0;
	}

	pid = getpid();
	printf("[CLIENT] client(%d) enter\n", pid);

	//서버로 cmd==3, pid 값 전달
	sprintf(msg, "3 %d", pid);
	write(fd, msg, strlen(msg));

	//쓰레드 생성, 게임시작
	pthread_create(&threads[0], NULL, play_game, (void*)(intptr_t)id);
	pthread_join(threads[0], NULL);

	printf("\n\n============Game End============\n\n");
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
subq $0x20, %rsp
leaq 0xca7(%rip), %rdi       # 0x2069
pushq $0x1
popq %rsi
xorl %eax, %eax
callq 0x10e0
movl %eax, 0x2d8a(%rip)      # 0x415c
cmpl $-0x1, %eax
je 0x145c
callq 0x1060
movl %eax, 0x2d7a(%rip)      # 0x4160
leaq 0xc8a(%rip), %rdi       # 0x2077
movl %eax, %esi
xorl %eax, %eax
callq 0x1080
movl 0x2d64(%rip), %edx      # 0x4160
leaq 0xc8f(%rip), %rsi       # 0x2092
leaq -0x30(%rbp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1100
movl 0x2d44(%rip), %r14d     # 0x415c
movq %rbx, %rdi
callq 0x1070
movl %r14d, %edi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x1050
leaq 0x2d3b(%rip), %rdi      # 0x4170
leaq 0x37(%rip), %rdx        # 0x1473
xorl %esi, %esi
xorl %ecx, %ecx
callq 0x10d0
movq 0x2d24(%rip), %rdi      # 0x4170
xorl %esi, %esi
callq 0x1120
leaq 0xcc1(%rip), %rdi       # 0x211b
jmp 0x1463
leaq 0xcdc(%rip), %rdi       # 0x213f
callq 0x1040
xorl %eax, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/PARKINHYO[P]BlackjackGame/fifo/fifo_client.c
// Function: send_msg
void* send_msg()
{
	int fd2;
	char filename[BUFF_SIZE];

	sprintf(filename, "%s%d", TO_SERVER_FILE, getpid());
	if ((fd2 = open(filename, O_WRONLY)) == -1) {
		printf("[SYSTEM] in send_msg() open error!!\n");
	}

	int choice;
	char strChoice[10];
	while (1) {
		sleep(1);
		if (finalcheck) { break; }
		/*check2==1 -> HIT/STAND 입력대기*/
		if (check2 == 1) {
			printf("\n");
			printf("1. Hit\n");
			printf("2. Stand\n");
			printf("Please choose 1 or 2: ");
			fflush(stdout);

			fgets(strChoice, sizeof(strChoice), stdin);
			choice = atoi(strChoice);

			if (choice == 1)
			{
				strcpy(buffer, HIT);
				//HIT 서버로 전달
				write(fd2, buffer, BUFFER_SIZE);

				printf("Sending: %s\n", buffer);

				check2 = 2;
				sleep(1);
			}
			else if (choice == 2)
			{
				strcpy(buffer, STAND);
				//STAND 서버로 전달
				write(fd2, buffer, BUFFER_SIZE);

				printf("Sending: %s\n", buffer);
				check2 = 0;
				check = 0;
				finalcheck = 1;
				break;
			}
			else {
				printf("Unrecognized choice. Choose again.\n");
			}
			strChoice[strlen(strChoice) - 1] = '\0';
		}
	}
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
callq 0x1060
leaq 0xbc6(%rip), %rsi       # 0x2097
leaq 0xb91(%rip), %rdx       # 0x2069
leaq -0x60(%rbp), %rbx
movq %rbx, %rdi
movl %eax, %ecx
xorl %eax, %eax
callq 0x1100
pushq $0x1
popq %rsi
movq %rbx, %rdi
xorl %eax, %eax
callq 0x10e0
movl %eax, %ebx
cmpl $-0x1, %eax
jne 0x1508
leaq 0xc5c(%rip), %rdi       # 0x215f
callq 0x1040
pushq $0x1
popq %r14
pushq $0xa
popq %r15
leaq -0x32(%rbp), %r13
leaq 0x2c85(%rip), %r12      # 0x41a0
movl %r14d, %edi
callq 0x1130
cmpl $0x0, 0x2c2e(%rip)      # 0x4158
jne 0x1648
cmpl $0x1, 0x2c1d(%rip)      # 0x4154
jne 0x151b
movl %r15d, %edi
callq 0x1030
leaq 0xc3b(%rip), %rdi       # 0x2183
callq 0x1040
leaq 0xc36(%rip), %rdi       # 0x218a
callq 0x1040
leaq 0xb3c(%rip), %rdi       # 0x209c
xorl %eax, %eax
callq 0x1080
movq 0x2a62(%rip), %rax      # 0x3fd0
movq (%rax), %rdi
callq 0x10c0
movq 0x2a5b(%rip), %rax      # 0x3fd8
movq (%rax), %rdx
movq %r13, %rdi
movl %r15d, %esi
callq 0x10a0
movq %r13, %rdi
callq 0x10f0
cmpl $0x1, %eax
je 0x15ab
cmpl $0x2, %eax
je 0x15f8
leaq 0xbef(%rip), %rdi       # 0x2193
callq 0x1040
jmp 0x15e5
movl $0x544948, 0x2beb(%rip) # imm = 0x544948
movl %ebx, %edi
movq %r12, %rsi
pushq $0x20
popq %rdx
callq 0x1050
leaq 0xaea(%rip), %rdi       # 0x20b3
movq %r12, %rsi
xorl %eax, %eax
callq 0x1080
movl $0x2, 0x2b77(%rip)      # 0x4154
movl %r14d, %edi
callq 0x1130
movq %r13, %rdi
callq 0x1070
movb $0x0, -0x1(%rax,%r13)
jmp 0x151b
movw $0x44, 0x2ba3(%rip)     # 0x41a4
movl $0x4e415453, 0x2b95(%rip) # imm = 0x4E415453
leaq 0x2b8e(%rip), %r14      # 0x41a0
pushq $0x20
popq %rdx
movl %ebx, %edi
movq %r14, %rsi
callq 0x1050
leaq 0xa8d(%rip), %rdi       # 0x20b3
movq %r14, %rsi
xorl %eax, %eax
callq 0x1080
andl $0x0, 0x2b1d(%rip)      # 0x4154
andl $0x0, 0x2b12(%rip)      # 0x4150
movl $0x1, 0x2b10(%rip)      # 0x4158
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]libcperciva/tests/ipc_sync/main.c
// Function: main
int
main(int argc, char * argv[])
{
	int num;

	WARNP_INIT;

	/* Parse command-line argument. */
	if (argc != 2) {
		fprintf(stderr, "usage: test_ipc_sync NUM\n");
		exit(1);
	}
	if (PARSENUM(&num, argv[1], 0, sizeof(tests) / sizeof(tests[0]) - 1)) {
		warnp("parsenum");
		goto err0;
	}

	/* Run the specified test. */
	if (check(&tests[num]))
		goto err0;

	/* Success! */
	exit(0);

err0:
	/* Failure! */
	exit(1);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rsi, %r14
movl %edi, %ebx
movq (%rsi), %rdi
testq %rdi, %rdi
je 0x131a
callq 0x1a1c
cmpl $0x2, %ebx
jne 0x134f
callq 0x1070
andl $0x0, (%rax)
movq 0x8(%r14), %r15
testq %r15, %r15
jne 0x136d
leaq 0xcf0(%rip), %rdi       # 0x2027
leaq 0xcf3(%rip), %rsi       # 0x2031
leaq 0xd02(%rip), %rcx       # 0x2047
movl $0xa7, %edx
callq 0x10d0
movq 0x2ca2(%rip), %rax      # 0x3ff8
movq (%rax), %rcx
leaq 0xca4(%rip), %rdi       # 0x2004
pushq $0x19
popq %rsi
pushq $0x1
popq %rdx
callq 0x11c0
jmp 0x13b0
movq %rax, %rbx
movq %rsp, %r12
movq %r15, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x1040
movq %rax, %r14
movq (%r12), %rcx
pushq $0x16
popq %rax
cmpq %r15, %rcx
je 0x139d
cmpb $0x0, (%rcx)
jne 0x139d
cmpq $0x8, %r14
jb 0x13b8
pushq $0x22
popq %rax
movl %eax, (%rbx)
leaq 0xc78(%rip), %rdi       # 0x201e
xorl %eax, %eax
callq 0x1a99
andl $0x0, (%rbx)
pushq $0x1
popq %rdi
callq 0x11b0
cmpl $0x0, (%rbx)
jne 0x139f
callq 0x16ec
testq %rax, %rax
je 0x13b0
movq %rax, %rbx
imulq $0xc, %r14, %rax
leaq 0xd2b(%rip), %r14       # 0x2100
addq %rax, %r14
movq %rsp, %rsi
movq %rbx, 0x8(%rsi)
movl (%r14), %eax
movl 0x8(%r14), %ecx
movl %eax, (%rsi)
movl %ecx, 0x4(%rsi)
leaq 0x6d(%rip), %rdi        # 0x145f
callq 0x15f0
cmpl $-0x1, %eax
je 0x13b0
movl %eax, %ebp
callq 0x10b0
movslq %eax, %rsi
leaq 0xc7f(%rip), %rdi       # 0x208c
leaq 0xc80(%rip), %rdx       # 0x2094
xorl %eax, %eax
callq 0x10c0
xorl %esi, %esi
cmpl $0x0, (%r14)
sete %sil
movl 0x4(%r14), %edx
movq %rbx, %rdi
callq 0x14f3
testl %eax, %eax
jne 0x13b0
movl %ebp, %edi
callq 0x164f
testl %eax, %eax
jne 0x13b0
movq %rbx, %rdi
callq 0x18d3
testl %eax, %eax
jne 0x13b0
xorl %edi, %edi
callq 0x11b0
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]libcperciva/tests/ipc_sync/main.c
// Function: child
static int
child(void * cookie)
{
	struct child_info * ci = cookie;

	PRINT_PID("post-fork child");

	/* Wait or signal, optionally with a prep. */
	if (wait_or_signal(ci->IS, ci->wait, ci->prep))
		goto err1;

	/* Clean up. */
	if (ipc_sync_done(ci->IS))
		goto err0;

	/* Ensure that we've finished writing to stdout. */
	if (fflush(stdout)) {
		warnp("fflush");
		goto err0;
	}

	/* Success! */
	return (0);

err1:
	if (ipc_sync_done(ci->IS))
		goto err0;
err0:
	/* Failure! */
	return (-1);
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rdi, %r14
callq 0x10b0
movslq %eax, %rsi
leaq 0xc17(%rip), %rdi       # 0x208c
leaq 0xc29(%rip), %rdx       # 0x20a5
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x10c0
movq 0x8(%r14), %rdi
movl (%r14), %esi
movl 0x4(%r14), %edx
callq 0x14f3
movl %eax, %ebp
movq 0x8(%r14), %rdi
callq 0x18d3
pushq $-0x1
popq %r14
orl %ebp, %eax
jne 0x14e9
movq 0x2b29(%rip), %rax      # 0x3fd8
movq (%rax), %rdi
callq 0x1160
testl %eax, %eax
je 0x14ec
callq 0x1070
cmpl $0x0, (%rax)
je 0x14db
movq %rax, %rbx
leaq 0xbe6(%rip), %rdi       # 0x20b5
xorl %eax, %eax
callq 0x1a99
andl $0x0, (%rbx)
jmp 0x14e9
leaq 0xbd3(%rip), %rdi       # 0x20b5
xorl %eax, %eax
callq 0x1c28
movl %r14d, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O2/Tarsnap[P]libcperciva/tests/ipc_sync/main.c
// Function: wait_or_signal
static int
wait_or_signal(struct ipc_sync * ip, int which, int prep)
{

	/* Are we going to wait, or signal? */
	if (which) {
		/* If desired, prep for a wait. */
		if (prep) {
			PRINT_PID("_wait_prep");
			if (ipc_sync_wait_prep(ip))
				goto err0;
		}

		/* Wait. */
		PRINT_PID("_wait");
		if (ipc_sync_wait(ip))
			goto err0;
		PRINT_PID("finished _wait");
	} else {
		/* If desired, prep for a signal. */
		if (prep) {
			PRINT_PID("_signal_prep");
			if (ipc_sync_signal_prep(ip))
				goto err0;
		}

		/* Signal. */
		PRINT_PID("_signal");
		if (ipc_sync_signal(ip))
			goto err0;
		PRINT_PID("finished _signal");
	}

	/* Success! */
	return (0);

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

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
testl %esi, %esi
je 0x1567
pushq $-0x1
popq %rbp
testl %edx, %edx
je 0x1531
callq 0x10b0
movslq %eax, %rsi
leaq 0xb79(%rip), %rdi       # 0x208c
leaq 0xba2(%rip), %rdx       # 0x20bc
xorl %eax, %eax
callq 0x10c0
movq %rbx, %rdi
callq 0x18c4
testl %eax, %eax
jne 0x15e4
callq 0x10b0
movslq %eax, %rsi
leaq 0xb4c(%rip), %rdi       # 0x208c
leaq 0xb89(%rip), %rdx       # 0x20d0
xorl %eax, %eax
callq 0x10c0
movq %rbx, %rdi
callq 0x1785
testl %eax, %eax
jne 0x15e4
leaq 0xb62(%rip), %rbx       # 0x20c7
jmp 0x15c9
testl %edx, %edx
je 0x1594
callq 0x10b0
movslq %eax, %rsi
leaq 0xb12(%rip), %rdi       # 0x208c
leaq 0xb55(%rip), %rdx       # 0x20d6
xorl %eax, %eax
callq 0x10c0
movq %rbx, %rdi
callq 0x18cc
testl %eax, %eax
jne 0x15bd
callq 0x10b0
movslq %eax, %rsi
leaq 0xae9(%rip), %rdi       # 0x208c
leaq 0xb42(%rip), %rdx       # 0x20ec
xorl %eax, %eax
callq 0x10c0
movq %rbx, %rdi
callq 0x1857
testl %eax, %eax
je 0x15c2
pushq $-0x1
popq %rbp
jmp 0x15e4
leaq 0xb1a(%rip), %rbx       # 0x20e3
callq 0x10b0
movslq %eax, %rsi
leaq 0xab4(%rip), %rdi       # 0x208c
xorl %ebp, %ebp
movq %rbx, %rdx
xorl %eax, %eax
callq 0x10c0
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O2/umbrant[P]Non-blocking-Buffers/nbb.c
// Function: nbb_nameserver_connect
int nbb_nameserver_connect(const char* request, char** ret, int* ret_len)
{
  int nameserver_pid = 0;
  FILE* pFile;
  int retval;
  char* recv;
  size_t recv_len;

  // Sanity check to isolate errors faster
  assert(request != NULL && ret != NULL && ret_len != NULL);
  *ret = NULL;
  *ret_len = 0;

  // Should be reversed since what's written by service is read by nameserver
  if(nbb_open_channel(NULL, NAMESERVER_WRITE, NAMESERVER_READ, !IPC_CREAT)) {
    return -1;
  }

  pFile = fopen(NAMESERVER_PID_FILE, "r+"); 
  fscanf(pFile,"%d",&nameserver_pid); 
  fclose(pFile); 

  nbb_insert_item(0, request, strlen(request));
  kill(nameserver_pid, SIGUSR1);

  // Poll until we get something
  do{ 
    retval = nbb_read_item(0, (void**)&recv, &recv_len);
  } while (retval == BUFFER_EMPTY || retval == BUFFER_EMPTY_PRODUCER_INSERTING);

  // Set return values
  *ret = recv;
  *ret_len = recv_len;

  // No errors, we're happy
  return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x20, %rsp
andl $0x0, 0xc(%rsp)
testq %rdi, %rdi
je 0x170d
movq %rsi, %r14
testq %rsi, %rsi
je 0x170d
movq %rdx, %rbx
testq %rdx, %rdx
je 0x170d
movq %rdi, %r15
andq $0x0, (%r14)
andl $0x0, (%rbx)
xorl %edi, %edi
movl $0xfa0, %esi            # imm = 0xFA0
movl $0xfa1, %edx            # imm = 0xFA1
xorl %ecx, %ecx
callq 0x172a
testl %eax, %eax
je 0x1678
pushq $-0x1
popq %rax
jmp 0x16ff
leaq 0x2411(%rip), %rdi      # 0x3a90
leaq 0x1b4e(%rip), %rsi      # 0x31d4
callq 0x11b0
movq %rax, %r12
leaq 0x1988(%rip), %rsi      # 0x301d
leaq 0xc(%rsp), %r13
movq %rax, %rdi
movq %r13, %rdx
xorl %eax, %eax
callq 0x1050
movq %r12, %rdi
callq 0x10a0
movq %r15, %rdi
callq 0x10b0
xorl %edi, %edi
movq %r15, %rsi
movq %rax, %rdx
callq 0x18d5
movl (%r13), %edi
pushq $0xa
popq %rsi
callq 0x1150
leaq 0x18(%rsp), %r15
leaq 0x10(%rsp), %r12
xorl %edi, %edi
movq %r15, %rsi
movq %r12, %rdx
callq 0x1a82
addl $-0x3, %eax
cmpl $0x2, %eax
jb 0x16da
movq 0x18(%rsp), %rax
movq %rax, (%r14)
movl 0x10(%rsp), %eax
movl %eax, (%rbx)
xorl %eax, %eax
addq $0x20, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq
leaq 0x1a4f(%rip), %rdi      # 0x3163
leaq 0x1a7a(%rip), %rsi      # 0x3195
leaq 0x1a79(%rip), %rcx      # 0x319b
pushq $0x1c
popq %rdx
callq 0x10d0
// File: /workspace/github_c_makefile_star2_O2/umbrant[P]Non-blocking-Buffers/nbb.c
// Function: nbb_read_item
int nbb_read_item(int channel_id, void** ptr_to_item, size_t* size)
{
	struct buffer *buf = channel_list[channel_id].read;
	unsigned char *data_buf = channel_list[channel_id].read_data;
  unsigned short temp_uc = buf->update_counter;

  assert(channel_id >= 0 && channel_id < SERVICE_MAX_CHANNELS);
  assert(ptr_to_item != NULL && size != NULL);

  *ptr_to_item = NULL;
  *size = 0;

  if(channel_id < 0) {
    printf("! nbb_read_item(): invalid channel_id %d\n", channel_id);
    return -1;
  }

  if(size < 0) {
    printf("! nbb_read_item(): invalid size %lu\n", *size);
    return -1;
  }

  if (temp_uc == buf->last_ack_counter) {
    return BUFFER_EMPTY; 
  }

  if ((temp_uc - buf->last_ack_counter) == 1) {
    return BUFFER_EMPTY_PRODUCER_INSERTING;
  }

  buf->ack_counter = buf->last_ack_counter + 1;

  // Copy out the value to malloc'd mem in our address space
  struct channel_item* tmp = 
				&(buf->items[((buf->last_ack_counter / 2) % BUFFER_SIZE)]);
  *ptr_to_item = malloc(tmp->size);
  memcpy(*ptr_to_item, data_buf+tmp->offset, tmp->size);
	*size = tmp->size;

  //printf("nbb_read_item ret pointer %x\n", ref_to_item);
  //printf("nbb_read_item ret pointer %x -> %d\n", ref_to_item, *ref_to_item);
  buf->ack_counter = buf->last_ack_counter + 2;
  buf->last_ack_counter = buf->ack_counter;

  return OK;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
cmpl $0xf, %edi
jae 0x1b4c
movq %rsi, %r14
testq %rsi, %rsi
je 0x1b6b
movq %rdx, %rbx
testq %rdx, %rdx
je 0x1b6b
movslq %edi, %rax
imulq $0x58, %rax, %rax
leaq 0x4684(%rip), %rcx      # 0x6140
movq (%rax,%rcx), %r13
movq 0x8(%rax,%rcx), %r15
movzwl 0x4(%r13), %eax
andq $0x0, (%r14)
andq $0x0, (%rbx)
movzwl 0x2(%r13), %ebp
cmpw %bp, %ax
jne 0x1ae0
pushq $0x3
jmp 0x1ae9
subl %ebp, %eax
cmpl $0x1, %eax
jne 0x1aec
pushq $0x4
popq %rax
jmp 0x1b3d
leal 0x1(%rbp), %eax
movw %ax, (%r13)
movl %ebp, %r12d
andl $0x1fe, %r12d           # imm = 0x1FE
movzwl 0x10(%r13,%r12,2), %edi
movq %rdi, (%rsp)
callq 0x1160
movq %rax, (%r14)
movzwl 0xe(%r13,%r12,2), %ecx
addq %rcx, %r15
movq %rax, %rdi
movq %r15, %rsi
movq (%rsp), %r14
movq %r14, %rdx
callq 0x1130
movq %r14, (%rbx)
leal 0x2(%rbp), %eax
movw %ax, (%r13)
movw %ax, 0x2(%r13)
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1cdf(%rip), %rdi      # 0x3832
leaq 0x163b(%rip), %rsi      # 0x3195
leaq 0x1d7e(%rip), %rcx      # 0x38df
movl $0x2ab, %edx            # imm = 0x2AB
callq 0x10d0
leaq 0x1d97(%rip), %rdi      # 0x3909
leaq 0x161c(%rip), %rsi      # 0x3195
leaq 0x1d5f(%rip), %rcx      # 0x38df
movl $0x2ac, %edx            # imm = 0x2AC
callq 0x10d0
// File: /workspace/github_c_makefile_star2_O2/umbrant[P]Non-blocking-Buffers/nbb.c
// Function: init_nameserver
int init_nameserver()
{
  FILE* pFile;

  // XXX: Initial semaphore value? Use 1 for now...
  sem_id = sem_open(SEM_KEY, O_CREAT, 0666, 1);
  if(sem_id == SEM_FAILED) {
    perror("! Unable to obtain semaphore\n");
    return -1;
  }

  if(nbb_open_channel(NULL, NAMESERVER_READ, NAMESERVER_WRITE, IPC_CREAT)) {
    printf("! Unable to open channel\n");
    return -1;
  }

  pFile = fopen(NAMESERVER_PID_FILE,"w+");
  fprintf(pFile,"%d",(int)getpid());
  fclose(pFile);

  return 0;
}

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
leaq 0x1642(%rip), %rdi      # 0x31d7
pushq $0x40
popq %rsi
pushq $0x1
popq %rcx
movl $0x1b6, %edx            # imm = 0x1B6
xorl %eax, %eax
callq 0x1110
movq %rax, 0x4bb2(%rip)      # 0x6760
testq %rax, %rax
je 0x1c20
xorl %ebx, %ebx
xorl %edi, %edi
movl $0xfa1, %esi            # imm = 0xFA1
movl $0xfa0, %edx            # imm = 0xFA0
movl $0x200, %ecx            # imm = 0x200
callq 0x172a
testl %eax, %eax
je 0x1be0
leaq 0x1d82(%rip), %rdi      # 0x3958
callq 0x1070
pushq $-0x1
popq %rbx
jmp 0x1c16
leaq 0x1ea9(%rip), %rdi      # 0x3a90
leaq 0x160d(%rip), %rsi      # 0x31fb
callq 0x11b0
movq %rax, %r14
callq 0x1090
leaq 0x141b(%rip), %rsi      # 0x301d
movq %r14, %rdi
movl %eax, %edx
xorl %eax, %eax
callq 0x1120
movq %r14, %rdi
callq 0x10a0
movl %ebx, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
retq
leaq 0x15b6(%rip), %rdi      # 0x31dd
callq 0x11c0
jmp 0x1bdb
// File: /workspace/github_c_makefile_star2_O2/umbrant[P]Non-blocking-Buffers/nbb.c
// Function: nbb_send
int nbb_send(const char* destination, const char* msg, size_t msg_len)
{
  int i;
  // int retval;

  printf("** dest: %s, msg: %s, msg_len: %d\n", destination, msg, (int) msg_len);
  assert(destination != NULL && msg != NULL);

  if (msg_len == 0) {
    printf("! nbb_send(): nothing to send (0 length passed in)\n");
    return 0;
  }

  // Since i = 0 is already reserved for nameserver
  for(i = 1; i < SERVICE_MAX_CHANNELS;i++) {
    if(channel_list[i].in_use && connected_nodes[i].name &&
       !strcmp(destination, connected_nodes[i].name)) {
      break;
    }
  }

  if(i == SERVICE_MAX_CHANNELS) {
    printf("! nbb_send(): Process not found\n");
    return -1;
  }

  nbb_insert_item(i, msg, msg_len); 
  kill(connected_nodes[i].pid, SIGUSR1);

  printf("** Send '%.*s' to %s\n", (int) msg_len, msg, destination);

  /* Not needed
  do { 
    retval = nbb_read_item(i, (void**)&recv, &recv_len);
  } while (retval == BUFFER_EMPTY || retval == BUFFER_EMPTY_PRODUCER_INSERTING); 

  if(strcmp(recv, NEW_CONN_NOTIFY_MSG)) {
    nbb_flush_shm(i, recv, recv_len);
  }

  printf("** Received '%.*s' from the service\n", (int) recv_len, recv);
*/

  return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r15
movq %rsi, %r14
movq %rdi, %rbx
leaq 0x1235(%rip), %rdi      # 0x354a
movq %rbx, %rsi
movq %r14, %rdx
movl %r15d, %ecx
xorl %eax, %eax
callq 0x10c0
testq %rbx, %rbx
je 0x23ee
testq %r14, %r14
je 0x23ee
testq %r15, %r15
je 0x2397
movq %r15, (%rsp)
pushq $0x18
popq %r12
pushq $0x1
popq %rbp
leaq 0x3e9a(%rip), %r15      # 0x61e8
leaq 0x431b(%rip), %r13      # 0x6670
cmpq $0xf8, %r12
je 0x2386
cmpl $0x0, (%r15)
je 0x237a
movq -0x8(%r12,%r13), %rsi
testq %rsi, %rsi
je 0x237a
movq %rbx, %rdi
callq 0x1100
testl %eax, %eax
je 0x23a7
addq $0x10, %r12
incl %ebp
addq $0x58, %r15
jmp 0x2355
leaq 0x16aa(%rip), %rdi      # 0x3a37
callq 0x1070
pushq $-0x1
popq %rbp
jmp 0x23dd
leaq 0x16b9(%rip), %rdi      # 0x3a57
callq 0x1070
xorl %ebp, %ebp
jmp 0x23dd
movl %ebp, %edi
movq %r14, %rsi
movq (%rsp), %r15
movq %r15, %rdx
callq 0x18d5
movl (%r12,%r13), %edi
pushq $0xa
popq %rsi
callq 0x1150
leaq 0x11f6(%rip), %rdi      # 0x35c1
xorl %ebp, %ebp
movl %r15d, %esi
movq %r14, %rdx
movq %rbx, %rcx
xorl %eax, %eax
callq 0x10c0
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0x1178(%rip), %rdi      # 0x356d
leaq 0xd99(%rip), %rsi       # 0x3195
leaq 0x118d(%rip), %rcx      # 0x3590
movl $0x11c, %edx            # imm = 0x11C
callq 0x10d0
// File: /workspace/github_c_makefile_star2_O2/umbrant[P]Non-blocking-Buffers/nbb.c
// Function: nbb_set_cb_new_connection
void nbb_set_cb_new_connection(const char* owner, cb_new_conn_func func, void* arg)
{
  int i;

  // |arg| can be NULL
  assert(owner != NULL && func != NULL);

  for(i = 1;i < SERVICE_MAX_CHANNELS;i++) {
    if(!channel_list[i].in_use) {
      continue;
    }

    if(channel_list[i].owner && !strcmp(owner, channel_list[i].owner)) {
      channel_list[i].new_conn = func;
      channel_list[i].arg = arg;
      printf("***NBB***: Set new_conn callback for '%s'\n", owner);
    }
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x2492
movq %rsi, %r14
testq %rsi, %rsi
je 0x2492
movq %rdx, %rbx
movq %rdi, %r15
movl $0xa8, %r13d
leaq 0x3d08(%rip), %rbp      # 0x6140
leaq 0x10a7(%rip), %r12      # 0x34e6
cmpq $0x578, %r13            # imm = 0x578
je 0x2483
cmpl $0x0, (%r13,%rbp)
je 0x247d
movq -0x20(%r13,%rbp), %rsi
testq %rsi, %rsi
je 0x247d
movq %r15, %rdi
callq 0x1100
testl %eax, %eax
jne 0x247d
movq %r14, -0x18(%r13,%rbp)
movq %rbx, -0x8(%r13,%rbp)
movq %r12, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x10c0
addq $0x58, %r13
jmp 0x243f
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xfe8(%rip), %rdi       # 0x3481
leaq 0xcf5(%rip), %rsi       # 0x3195
leaq 0xff8(%rip), %rcx       # 0x349f
movl $0xf6, %edx
callq 0x10d0
// File: /workspace/github_c_makefile_star2_O2/umbrant[P]Non-blocking-Buffers/nbb.c
// Function: nbb_set_cb_new_data
void nbb_set_cb_new_data(const char* owner, cb_new_data_func func)
{
  int i;

  assert(owner != NULL && func != NULL);

  for(i = 1;i < SERVICE_MAX_CHANNELS;i++) {
    if(!channel_list[i].in_use) {
      continue;
    }

    if(channel_list[i].owner && !strcmp(owner, channel_list[i].owner)) {
      channel_list[i].new_data = func;
    }
  }
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
testq %rdi, %rdi
je 0x2513
movq %rsi, %rbx
testq %rsi, %rsi
je 0x2513
movq %rdi, %r14
movl $0xa8, %r15d
leaq 0x3c6a(%rip), %r12      # 0x6140
cmpq $0x578, %r15            # imm = 0x578
je 0x2507
cmpl $0x0, (%r15,%r12)
je 0x2501
movq -0x20(%r15,%r12), %rsi
testq %rsi, %rsi
je 0x2501
movq %r14, %rdi
callq 0x1100
testl %eax, %eax
jne 0x2501
movq %rbx, -0x10(%r15,%r12)
addq $0x58, %r15
jmp 0x24d6
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0xf67(%rip), %rdi       # 0x3481
leaq 0xc74(%rip), %rsi       # 0x3195
leaq 0xfe9(%rip), %rcx       # 0x3511
movl $0x109, %edx            # imm = 0x109
callq 0x10d0
// File: /workspace/github_c_makefile_star2_O2/umbrant[P]Non-blocking-Buffers/nbb.c
// Function: nbb_flush_shm
void nbb_flush_shm(int slot, char* array_to_flush, int size)
{
  assert(slot >= 0 && slot < SERVICE_MAX_CHANNELS);
  assert(array_to_flush != NULL && size >= 0);

  if (size == 0)
    return;

  delay_buffer_t* buffer = &(delay_buffers[slot]);
  int new_size = buffer->len + size;

  // Grow the buffer if exceeding current capacity
  if (new_size > buffer->capacity) {
    // Initial capacity (2 * MAX_MSG_LEN)
    if (buffer->capacity == 0) {
      buffer->capacity = MAX_MSG_LEN;
    }
    buffer->content = (char *) realloc(buffer->content, 2 * buffer->capacity);
    buffer->capacity = 2 * buffer->capacity;
  }

  // Append new data to the end (or beginning if it's the first flush)
  memcpy(buffer->content + buffer->len, array_to_flush, size);
  buffer->len = new_size;

  //printf("** Intermediate buffer content: '%.*s' (%d bytes)\n",
  //       buffer->len, buffer->content, buffer->len);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
cmpl $0xf, %edi
jae 0x25ca
movq %rsi, %rbx
testq %rsi, %rsi
je 0x25e9
movl %edx, %r14d
testl %edx, %edx
js 0x25e9
je 0x25bf
movl %edi, %eax
imulq $0x18, %rax, %rax
leaq 0x4208(%rip), %rdx      # 0x6770
leaq (%rdx,%rax), %r15
movl 0x8(%rax,%rdx), %ecx
movl 0xc(%rax,%rdx), %eax
leal (%rcx,%r14), %ebp
cmpl %eax, %ebp
jle 0x25a7
testl %eax, %eax
jne 0x258d
movl $0x3e8, 0xc(%r15)       # imm = 0x3E8
movl $0x3e8, %eax            # imm = 0x3E8
movq (%r15), %rdi
addl %eax, %eax
movslq %eax, %rsi
callq 0x1180
movq %rax, (%r15)
shll 0xc(%r15)
movl 0x8(%r15), %ecx
jmp 0x25aa
movq (%r15), %rax
movslq %ecx, %rdi
addq %rax, %rdi
movl %r14d, %edx
movq %rbx, %rsi
callq 0x1130
movl %ebp, 0x8(%r15)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x119f(%rip), %rdi      # 0x3770
leaq 0xbbd(%rip), %rsi       # 0x3195
leaq 0x120a(%rip), %rcx      # 0x37e9
movl $0x23c, %edx            # imm = 0x23C
callq 0x10d0
leaq 0x121e(%rip), %rdi      # 0x380e
leaq 0xb9e(%rip), %rsi       # 0x3195
leaq 0x11eb(%rip), %rcx      # 0x37e9
movl $0x23d, %edx            # imm = 0x23D
callq 0x10d0
// File: /workspace/github_c_makefile_star2_O2/umbrant[P]Non-blocking-Buffers/nbb.c
// Function: nbb_close_channel
int nbb_close_channel(int index)
{
  //TODO: Most probably buggy, needs to be checked some more

  assert(index >= 0 && index < SERVICE_MAX_CHANNELS);

  shmdt((char*)channel_list[index].read);
  if(shmctl(channel_list[index].read_id, IPC_RMID, 0) == -1) {
    return -1;
  }

  shmdt((char*)channel_list[index].write);
  if(shmctl(channel_list[index].write_id, IPC_RMID, 0) == -1) {
    return -1;
  }

  channel_list[index].in_use = 0;
  return 0;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
cmpl $0xf, %edi
jae 0x266b
movl %edi, %eax
imulq $0x58, %rax, %r15
leaq 0x3b21(%rip), %r14      # 0x6140
movq (%r15,%r14), %rdi
callq 0x1080
movl 0x10(%r15,%r14), %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x11a0
pushq $-0x1
popq %rbx
cmpl $-0x1, %eax
je 0x2663
addq %r15, %r14
movq 0x18(%r14), %rdi
callq 0x1080
movl 0x28(%r14), %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x11a0
cmpl $-0x1, %eax
je 0x2663
andl $0x0, 0x50(%r14)
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
leaq 0xfdd(%rip), %rdi       # 0x364f
leaq 0xb1c(%rip), %rsi       # 0x3195
leaq 0xffa(%rip), %rcx       # 0x367a
movl $0x1e4, %edx            # imm = 0x1E4
callq 0x10d0
// File: /workspace/github_c_makefile_star2_O2/umbrant[P]Non-blocking-Buffers/nbb.c
// Function: nbb_read_bytes
int nbb_read_bytes(int slot, char* buf, int size)
{
  assert(slot >= 0 && buf != NULL && size >= 0);

  delay_buffer_t* delay_buffer = &(delay_buffers[slot]);
  printf("***NBB***: Delay buffer %d: %d/%d\n",
         slot, delay_buffer->len, delay_buffer->capacity);
  assert(delay_buffer->capacity >= delay_buffer->len);

  // Attempt to read 0 bytes or buffer has nothing to read
  if (size == 0 || delay_buffer->content == NULL || delay_buffer->len == 0) {
    return 0;
  }

  assert(delay_buffer->content != NULL && delay_buffer->len > 0);

  // Read minimum of the requested length and available data
  if(size > delay_buffer->len) {
    size = delay_buffer->len;
  }

  // Read |size| bytes into |buf| and update statistics
  memcpy(buf, delay_buffer->content, size);
  channel_list[slot].read_count += size;

  // Move remaining data (if any) into the front of buffer
  int new_len = delay_buffer->len - size;
  if (new_len > 0) {
    memmove(delay_buffer->content, delay_buffer->content + size, new_len);
  }
  delay_buffer->len = new_len;

  return size;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rsi, %r14
testq %rsi, %rsi
je 0x2777
movl %edx, %ebx
movl %edi, %esi
movl %edx, %eax
orl %edi, %eax
js 0x2777
movl %esi, %r12d
imulq $0x18, %r12, %r13
leaq 0x4090(%rip), %r15      # 0x6770
movl 0x8(%r13,%r15), %edx
movl 0xc(%r13,%r15), %ecx
leaq 0xfef(%rip), %rdi       # 0x36e0
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x10c0
movl 0x8(%r13,%r15), %eax
cmpl %eax, 0xc(%r13,%r15)
jl 0x2796
testl %ebx, %ebx
je 0x2766
addq %r13, %r15
movq (%r15), %rsi
testq %rsi, %rsi
sete %cl
testl %eax, %eax
sete %dl
orb %cl, %dl
jne 0x2766
testl %eax, %eax
jle 0x27b5
cmpl %ebx, %eax
cmovll %eax, %ebx
movq %r14, %rdi
movq %rbx, %rdx
callq 0x1130
imulq $0x58, %r12, %rax
leaq 0x39fa(%rip), %rcx      # 0x6140
addl %ebx, 0x14(%rax,%rcx)
movl 0x8(%r15), %ebp
subl %ebx, %ebp
jle 0x2760
movq (%r15), %rdi
leaq (%rdi,%rbx), %rsi
movl %ebp, %edx
callq 0x1190
movl %ebp, 0x8(%r15)
movl %ebx, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xf17(%rip), %rdi       # 0x3695
leaq 0xa10(%rip), %rsi       # 0x3195
leaq 0xf2f(%rip), %rcx       # 0x36bb
movl $0x206, %edx            # imm = 0x206
callq 0x10d0
leaq 0xf66(%rip), %rdi       # 0x3703
leaq 0x9f1(%rip), %rsi       # 0x3195
leaq 0xf10(%rip), %rcx       # 0x36bb
movl $0x20b, %edx            # imm = 0x20B
callq 0x10d0
leaq 0xf73(%rip), %rdi       # 0x372f
leaq 0x9d2(%rip), %rsi       # 0x3195
leaq 0xef1(%rip), %rcx       # 0x36bb
movl $0x212, %edx            # imm = 0x212
callq 0x10d0
// File: /workspace/github_c_makefile_star2_O2/carlitosmarin[P]Sistema-Ficheros-SOII/mi_ls.c
// Function: main
int main (int argc, char **argv) {
	if (argc != 3) {
		printf("Número de parametros incorrectos\n");
		return -1;
	}
	//Montamos el disco
	if(bmount(argv[1]) < 0){
		printf("No se ha podido abrir el fichero: %s", argv[1]);
		return 0;
	}

	char buffer[64*200];
	memset(buffer,0,tamBloque);
	printf("Directorio %s:\n", argv[2]);

	if(mi_dir (argv[2],(char *)buffer) >= 0) {
		printf("%c[%d;%dmTipo\tPerm.\tmTime\t\t\tNombre%c[%dm\n",27,0,32,27,0);
		puts("-------------------------------------------------------------------");
		printf("%s\n", buffer);
	} else puts("Error: No se ha podido llevar a cabo mi_ls\n");

	bumount();
	return 0;
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x3208, %rsp           # imm = 0x3208
cmpl $0x3, %edi
jne 0x3c3c
movq %rsi, %rbx
movq 0x8(%rsi), %rdi
callq 0x127c
testl %eax, %eax
js 0x3c4d
movq %rsp, %r14
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
xorl %esi, %esi
callq 0x10b0
movq 0x10(%rbx), %rsi
leaq 0x955(%rip), %rdi       # 0x454d
xorl %eax, %eax
callq 0x1090
movq 0x10(%rbx), %rdi
movq %r14, %rsi
callq 0x30ee
testl %eax, %eax
js 0x3c63
leaq 0x947(%rip), %rdi       # 0x455d
pushq $0x20
popq %rcx
pushq $0x1b
popq %rsi
xorl %edx, %edx
movl %esi, %r8d
xorl %r9d, %r9d
xorl %eax, %eax
callq 0x1090
leaq 0x955(%rip), %rdi       # 0x4587
callq 0x1060
movq %rsp, %rdi
jmp 0x3c6a
leaq 0x9b4(%rip), %rdi       # 0x45f7
callq 0x1060
pushq $-0x1
popq %rbx
jmp 0x3c78
movq 0x8(%rbx), %rsi
leaq 0x8d0(%rip), %rdi       # 0x4528
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x1090
jmp 0x3c78
leaq 0x961(%rip), %rdi       # 0x45cb
callq 0x1060
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x12b8
movl %ebx, %eax
addq $0x3208, %rsp           # imm = 0x3208
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/KhuramAli[P]JAM-Benchmark/lock_and_lockfree/code13.cpp
// Function: threadfunc_unlocked()
void threadfunc_unlocked()
    {
      start_wait();
      // Wait until main() sends data
      long i;
      for (i = 1; i < count; i++) {
        flat_uint++;
      }
    }

// Assembly:
pushq %rax
callq 0x23eb
movq 0x3d76(%rip), %rax      # 0x61b8
pushq $0x1
popq %rcx
movq 0x3ce4(%rip), %rdx      # 0x6130
cmpq %rax, %rcx
jge 0x2461
leaq (%rdx,%rcx), %rsi
movq %rsi, 0x3cd4(%rip)      # 0x6130
incq %rcx
jmp 0x244c
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O2/KhuramAli[P]JAM-Benchmark/lock_and_lockfree/code13.cpp
// Function: threadfunc_unlocked_read()
void threadfunc_unlocked_read()
    {
      start_wait();
      // Wait until main() sends data
      long i,j;
      uint64_t current;
      j = 0;
      for (i = 1; i <= count; i++) {
        current = flat_uint;
        if (current > 0) {
          j++;
        }
        else {
          std::cout << "Error";
        }
      }
      if (j != count) {
        std::cout << "Not matched count j=" << j << "count=" << count <<"\n";
      }
    }

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
callq 0x23eb
pushq $0x1
popq %r12
xorl %ebx, %ebx
movq 0x3d3b(%rip), %rax      # 0x61b8
movq 0x3b4c(%rip), %r14      # 0x5fd0
leaq 0x1b85(%rip), %r15      # 0x4010
cmpq %rax, %r12
jg 0x24b6
cmpq $0x0, 0x3c98(%rip)      # 0x6130
je 0x249f
incq %rbx
jmp 0x24b1
movq %r14, %rdi
movq %r15, %rsi
callq 0x2150
movq 0x3d07(%rip), %rax      # 0x61b8
incq %r12
jmp 0x248b
cmpq %rax, %rbx
jne 0x24c7
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq 0x3b02(%rip), %rdi      # 0x5fd0
leaq 0x1b41(%rip), %rsi      # 0x4016
callq 0x2150
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2140
leaq 0x1b3f(%rip), %rsi      # 0x402b
movq %rax, %rdi
callq 0x2150
movq 0x3cbd(%rip), %rsi      # 0x61b8
movq %rax, %rdi
callq 0x2140
leaq 0x1c13(%rip), %rsi      # 0x411d
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x2150
// File: /workspace/github_c_makefile_star2_O2/KhuramAli[P]JAM-Benchmark/lock_and_lockfree/code13.cpp
// Function: threadfunc_mutex()
void threadfunc_mutex()
    {
      start_wait();
      long i;
      for (i = 1; i <= count; i++) {
        theMutex.lock();
        flat_uint++; 
        theMutex.unlock();
      }
    }

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
callq 0x23eb
pushq $0x1
popq %r14
leaq 0x3c1f(%rip), %rbx      # 0x6150
cmpq 0x3c80(%rip), %r14      # 0x61b8
jg 0x2556
movq %rbx, %rdi
callq 0x2e42
incq 0x3be7(%rip)            # 0x6130
movq %rbx, %rdi
callq 0x20d0
incq %r14
jmp 0x2531
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/KhuramAli[P]JAM-Benchmark/lock_and_lockfree/code13.cpp
// Function: threadfunc_mutex_read()
void threadfunc_mutex_read()
    {
      start_wait();
      uint64_t current;
      long i, j;
      j = 0;
      for (i = 1; i <= count; i++) {
        theMutex.lock();
        current = flat_uint; 
        theMutex.unlock();
        if (current > 0) {
          j++;
        }
        else {
          std::cout << "Error";
        }
      }
      if (j != count) {
        std::cout << "Not matched count j=" << j << "count=" << count <<"\n";
      }
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
callq 0x23eb
pushq $0x1
popq %r13
xorl %ebx, %ebx
leaq 0x3bd5(%rip), %r14      # 0x6150
movq 0x3a4e(%rip), %r15      # 0x5fd0
leaq 0x1a87(%rip), %r12      # 0x4010
movq 0x3c28(%rip), %rax      # 0x61b8
cmpq %rax, %r13
jg 0x25c6
movq %r14, %rdi
callq 0x2e42
movq 0x3b8c(%rip), %rbp      # 0x6130
movq %r14, %rdi
callq 0x20d0
testq %rbp, %rbp
je 0x25b6
incq %rbx
jmp 0x25c1
movq %r15, %rdi
movq %r12, %rsi
callq 0x2150
incq %r13
jmp 0x2589
cmpq %rax, %rbx
jne 0x25da
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x39ef(%rip), %rdi      # 0x5fd0
leaq 0x1a2e(%rip), %rsi      # 0x4016
callq 0x2150
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2140
leaq 0x1a2c(%rip), %rsi      # 0x402b
movq %rax, %rdi
callq 0x2150
movq 0x3baa(%rip), %rsi      # 0x61b8
movq %rax, %rdi
callq 0x2140
leaq 0x1b00(%rip), %rsi      # 0x411d
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2150
// File: /workspace/github_c_makefile_star2_O2/KhuramAli[P]JAM-Benchmark/lock_and_lockfree/code13.cpp
// Function: threadfunc_rwlock()
void threadfunc_rwlock()
    {
      start_wait();
      long i;
      for (i= 0; i <= count; i++) {
    #ifdef WIN32
        AcquireSRWLockExclusive(&srwlock);
        flat_uint++; 
        ReleaseSRWLockExclusive(&srwlock);
    #else
        pthread_rwlock_wrlock(&rwlock);
        flat_uint++; 
        pthread_rwlock_unlock(&rwlock);
    #endif
      }
    }

// Assembly:
pushq %r14
pushq %rbx
pushq %rax
callq 0x23eb
xorl %r14d, %r14d
leaq 0x3b32(%rip), %rbx      # 0x6178
cmpq 0x3b6b(%rip), %r14      # 0x61b8
jg 0x266b
movq %rbx, %rdi
callq 0x21c0
incq 0x3ad2(%rip)            # 0x6130
movq %rbx, %rdi
callq 0x2190
incq %r14
jmp 0x2646
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O2/KhuramAli[P]JAM-Benchmark/lock_and_lockfree/code13.cpp
// Function: threadfunc_rwlock_read_wr()
void threadfunc_rwlock_read_wr()
    {
      start_wait();
      long i, j;
      uint64_t current;
      j = 0;
      for (i = 1; i <= count; i++) {
    #ifdef WIN32
        AcquireSRWLockExclusive(&srwlock);
        current = flat_uint; 
        ReleaseSRWLockExclusive(&srwlock);
    #else
        pthread_rwlock_wrlock(&rwlock);
        current = flat_uint; 
        pthread_rwlock_unlock(&rwlock);
    #endif
        if (current > 0) {
          j++;
        }
        else {
          std::cout << "Error";
        }
      }
      if (j != count) {
        std::cout << "Not matched count j=" << j << "count=" << count <<"\n";
      }
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
callq 0x23eb
pushq $0x1
popq %r13
xorl %ebx, %ebx
leaq 0x3ae8(%rip), %r14      # 0x6178
movq 0x3939(%rip), %r15      # 0x5fd0
leaq 0x1972(%rip), %r12      # 0x4010
movq 0x3b13(%rip), %rax      # 0x61b8
cmpq %rax, %r13
jg 0x26db
movq %r14, %rdi
callq 0x21c0
movq 0x3a77(%rip), %rbp      # 0x6130
movq %r14, %rdi
callq 0x2190
testq %rbp, %rbp
je 0x26cb
incq %rbx
jmp 0x26d6
movq %r15, %rdi
movq %r12, %rsi
callq 0x2150
incq %r13
jmp 0x269e
cmpq %rax, %rbx
jne 0x26ef
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x38da(%rip), %rdi      # 0x5fd0
leaq 0x1919(%rip), %rsi      # 0x4016
callq 0x2150
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2140
leaq 0x1917(%rip), %rsi      # 0x402b
movq %rax, %rdi
callq 0x2150
movq 0x3a95(%rip), %rsi      # 0x61b8
movq %rax, %rdi
callq 0x2140
leaq 0x19eb(%rip), %rsi      # 0x411d
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2150
// File: /workspace/github_c_makefile_star2_O2/KhuramAli[P]JAM-Benchmark/lock_and_lockfree/code13.cpp
// Function: threadfunc_rwlock_read_rd()
void threadfunc_rwlock_read_rd()
    {
      start_wait();
      long i, j;
      uint64_t current;
      j = 0;
      for (i = 1; i <= count; i++) {
    #ifdef WIN32
        AcquireSRWLockShared(&srwlock);
        current = flat_uint; 
        ReleaseSRWLockShared(&srwlock);
    #else
        pthread_rwlock_rdlock(&rwlock);
        current = flat_uint; 
        pthread_rwlock_unlock(&rwlock);
    #endif
        if (current > 0) {
          j++;
        }
        else {
          std::cout << "Error";
        }
      }
      if (j != count) {
        std::cout << "Not matched count j=" << j << "count=" << count <<"\n";
      }
    }

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
callq 0x23eb
pushq $0x1
popq %r13
xorl %ebx, %ebx
leaq 0x3a13(%rip), %r14      # 0x6178
movq 0x3864(%rip), %r15      # 0x5fd0
leaq 0x189d(%rip), %r12      # 0x4010
movq 0x3a3e(%rip), %rax      # 0x61b8
cmpq %rax, %r13
jg 0x27b0
movq %r14, %rdi
callq 0x2120
movq 0x39a2(%rip), %rbp      # 0x6130
movq %r14, %rdi
callq 0x2190
testq %rbp, %rbp
je 0x27a0
incq %rbx
jmp 0x27ab
movq %r15, %rdi
movq %r12, %rsi
callq 0x2150
incq %r13
jmp 0x2773
cmpq %rax, %rbx
jne 0x27c4
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x3805(%rip), %rdi      # 0x5fd0
leaq 0x1844(%rip), %rsi      # 0x4016
callq 0x2150
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2140
leaq 0x1842(%rip), %rsi      # 0x402b
movq %rax, %rdi
callq 0x2150
movq 0x39c0(%rip), %rsi      # 0x61b8
movq %rax, %rdi
callq 0x2140
leaq 0x1916(%rip), %rsi      # 0x411d
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2150
// File: /workspace/github_c_makefile_star2_O2/KhuramAli[P]JAM-Benchmark/lock_and_lockfree/code13.cpp
// Function: threadfunc_atomic()
void threadfunc_atomic()
    {
      start_wait();
      // Wait until main() sends data
      long i;
      for (i = 1; i <= count; i++) {
        atomic_uint++;
      }
    }

// Assembly:
pushq %rax
callq 0x23eb
pushq $0x1
popq %rax
cmpq 0x398b(%rip), %rax      # 0x61b8
jg 0x283c
lock
incq 0x3979(%rip)            # 0x61b0
incq %rax
jmp 0x2826
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O2/KhuramAli[P]JAM-Benchmark/lock_and_lockfree/code13.cpp
// Function: threadfunc_atomic_read()
void threadfunc_atomic_read()
    {
      start_wait();
      // Wait until main() sends data
      long i,j;
      uint64_t current;
      j = 0;
      for (i = 1; i <= count; i++) {
        current = atomic_uint;
        if (current > 0) {
          j++;
        }
        else {
          std::cout << "Error";
        }
      }
      if (j != count) {
        std::cout << "Not matched count j=" << j << "count=" << count <<"\n";
      }
    }

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
callq 0x23eb
pushq $0x1
popq %r12
xorl %ebx, %ebx
movq 0x3778(%rip), %r14      # 0x5fd0
leaq 0x17b1(%rip), %r15      # 0x4010
movq 0x3952(%rip), %rax      # 0x61b8
cmpq %rax, %r12
jg 0x288c
movq 0x393e(%rip), %rax      # 0x61b0
testq %rax, %rax
je 0x287c
incq %rbx
jmp 0x2887
movq %r14, %rdi
movq %r15, %rsi
callq 0x2150
incq %r12
jmp 0x285f
cmpq %rax, %rbx
jne 0x289d
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq 0x372c(%rip), %rdi      # 0x5fd0
leaq 0x176b(%rip), %rsi      # 0x4016
callq 0x2150
movq %rax, %rdi
movq %rbx, %rsi
callq 0x2140
leaq 0x1769(%rip), %rsi      # 0x402b
movq %rax, %rdi
callq 0x2150
movq 0x38e7(%rip), %rsi      # 0x61b8
movq %rax, %rdi
callq 0x2140
leaq 0x183d(%rip), %rsi      # 0x411d
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x2150
// File: /workspace/github_c_makefile_star2_O2/KhuramAli[P]JAM-Benchmark/lock_and_lockfree/code13.cpp
// Function: threadfunc_atomic_set_release()
void threadfunc_atomic_set_release()
    {
      start_wait();
      // Wait until main() sends data
      long i;
      for (i = 1; i <= count; i++) {
        atomic_uint.store(i, std::memory_order_release);
      }
    }

// Assembly:
pushq %rax
callq 0x23eb
pushq $0x1
popq %rax
movq 0x38b5(%rip), %rcx      # 0x61b8
cmpq %rcx, %rax
jg 0x2914
movq %rax, 0x38a1(%rip)      # 0x61b0
incq %rax
jmp 0x2903
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O2/KhuramAli[P]JAM-Benchmark/lock_and_lockfree/code13.cpp
// Function: threadfunc_atomic_set_cst()
void threadfunc_atomic_set_cst()
    {
      start_wait();
      // Wait until main() sends data
      long i;
      for (i = 1; i <= count; i++) {
        atomic_uint.store(i, std::memory_order_seq_cst);
      }
    }

// Assembly:
pushq %rax
callq 0x23eb
pushq $0x1
popq %rax
movq 0x3892(%rip), %rcx      # 0x61b8
cmpq %rcx, %rax
jg 0x293a
movq %rax, %rdx
xchgq %rdx, 0x387b(%rip)      # 0x61b0
incq %rax
jmp 0x2926
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O2/KhuramAli[P]JAM-Benchmark/lock_and_lockfree/code13.cpp
// Function: threadfunc_atomic_set_relaxed()
void threadfunc_atomic_set_relaxed()
    {
      start_wait();
      // Wait until main() sends data
      long i;
      for (i = 1; i <= count; i++) {
        atomic_uint.store(i, std::memory_order_relaxed);
      }
    }

// Assembly:
pushq %rax
callq 0x23eb
pushq $0x1
popq %rax
movq 0x386c(%rip), %rcx      # 0x61b8
cmpq %rcx, %rax
jg 0x295d
movq %rax, 0x3858(%rip)      # 0x61b0
incq %rax
jmp 0x294c
popq %rax
retq