LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/redis-benchmark.c
// Function: showThroughput
int showThroughput(struct aeEventLoop *eventLoop, long long id, void *clientData) {
    REDIS_NOTUSED(eventLoop);
    REDIS_NOTUSED(id);
    REDIS_NOTUSED(clientData);

    if (config.csv) return 250;
    float dt = (float)(mstime()-config.start)/1000.0;
    float rps = (float)config.requests_finished/dt;
    printf("%s: %.2f\r", config.title, rps);
    fflush(stdout);
    return 250; /* every 250ms */
}

// Assembly:
cmpl $0x0, 0x2a152(%rip)     # 0x35444
jne 0xb380
pushq %rbx
subq $0x10, %rsp
movq %rsp, %rbx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x91f0
imulq $0x3e8, (%rbx), %rcx    # imm = 0x3E8
movabsq $0x20c49ba5e353f7cf, %rax # imm = 0x20C49BA5E353F7CF
imulq 0x8(%rbx)
movq %rdx, %rax
shrq $0x3f, %rax
sarq $0x7, %rdx
addq %rax, %rdx
addq %rcx, %rdx
subq 0x2a0e1(%rip), %rdx     # 0x35418
cvtsi2ss %rdx, %xmm0
divss 0x1ce24(%rip), %xmm0    # 0x28168
cvtsi2ssl 0x2a0ac(%rip), %xmm1 # 0x353f8
divss %xmm0, %xmm1
movq 0x2a0d9(%rip), %rsi     # 0x35430
xorps %xmm0, %xmm0
cvtss2sd %xmm1, %xmm0
leaq 0x1ce7a(%rip), %rdi     # 0x281df
movb $0x1, %al
callq 0x91b0
movq 0x29c3d(%rip), %rax     # 0x34fb0
movq (%rax), %rdi
callq 0x9390
addq $0x10, %rsp
popq %rbx
movl $0xfa, %eax
retq
// File: /workspace/github_c_makefile_star2_O1/nilyang[P]redis-tdd-annotation/src/redis-benchmark.c
// Function: createMissingClients
static void createMissingClients(client c) {
    int n = 0;
    char *buf = c->obuf;
    size_t buflen = sdslen(c->obuf);

    /* If we are cloning from a client with a SELECT prefix, skip it since the
     * client will be created with the prefixed SELECT if needed. */
    if (c->selectlen) {
        buf += c->selectlen;
        buflen -= c->selectlen;
    }

    while(config.liveclients < config.numclients) {
        createClient(NULL,0,c);

        /* Listen backlog is quite limited on most systems */
        if (++n > 64) {
            usleep(50000);
            n = 0;
        }
    }
}

// Assembly:
movl 0x2969f(%rip), %eax     # 0x353ec
cmpl 0x29695(%rip), %eax     # 0x353e8
jge 0xbd98
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
xorl %r14d, %r14d
xorl %edi, %edi
xorl %esi, %esi
movq %rbx, %rdx
callq 0xbae5
cmpl $0x40, %r14d
jge 0xbd76
incl %r14d
jmp 0xbd83
movl $0xc350, %edi           # imm = 0xC350
callq 0x95e0
xorl %r14d, %r14d
movl 0x29663(%rip), %eax     # 0x353ec
cmpl 0x29659(%rip), %eax     # 0x353e8
jl 0xbd5f
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/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 %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %rbx
cmpl $0x0, 0x28(%rdx)
jne 0xc107
movl 0x29391(%rip), %eax     # 0x353f4
leal 0x1(%rax), %ecx
movl %ecx, 0x29388(%rip)     # 0x353f4
cmpl 0x2937e(%rip), %eax     # 0x353f0
jge 0xc1a1
cmpl $0x0, 0x29385(%rip)     # 0x35404
je 0xc0e1
cmpq $0x0, 0x18(%rbx)
je 0xc0e1
xorl %r14d, %r14d
movabsq $-0x3333333333333333, %r15 # imm = 0xCCCCCCCCCCCCCCCD
movq 0x10(%rbx), %rax
movq (%rax,%r14,8), %r12
callq 0x9360
movslq 0x2935f(%rip), %rcx     # 0x35408
cqto
idivq %rcx
movq %rdx, %rcx
movl $0xc, %esi
movq %rcx, %rax
mulq %r15
shrq $0x3, %rdx
leal (%rdx,%rdx), %eax
leal (%rax,%rax,4), %eax
subl %eax, %ecx
orb $0x30, %cl
movb %cl, -0x1(%r12,%rsi)
movq %rdx, %rcx
decq %rsi
jne 0xc0b6
incq %r14
cmpq 0x18(%rbx), %r14
jb 0xc095
leaq 0x8(%rsp), %r14
movq %r14, %rdi
xorl %esi, %esi
callq 0x91f0
imulq $0xf4240, (%r14), %rax  # imm = 0xF4240
addq 0x8(%r14), %rax
movq %rax, 0x30(%rbx)
movq $-0x1, 0x38(%rbx)
movq 0x8(%rbx), %rsi
movslq -0x8(%rsi), %rdx
movl 0x28(%rbx), %eax
subq %rax, %rdx
jbe 0xc189
addq %rax, %rsi
movq (%rbx), %rax
movl 0x84(%rax), %edi
callq 0x9140
cmpl $-0x1, %eax
je 0xc195
addl 0x28(%rbx), %eax
movl %eax, 0x28(%rbx)
movq 0x8(%rbx), %rcx
movslq -0x8(%rcx), %rcx
cmpq %rax, %rcx
jne 0xc189
movq 0x29281(%rip), %rdi     # 0x353c8
movq (%rbx), %rax
movl 0x84(%rax), %esi
movl $0x2, %edx
callq 0x9b09
movq 0x29267(%rip), %rdi     # 0x353c8
movq (%rbx), %rax
movl 0x84(%rax), %esi
leaq 0xea(%rip), %rcx        # 0xc25b
movl $0x1, %edx
movq %rbx, %r8
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x9a43
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
callq 0x9090
movl (%rax), %edi
cmpl $0x20, %edi
jne 0xc1b1
movq %rbx, %rdi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0xc1b8
callq 0x9693
jmp 0xc1a1
// File: /workspace/github_c_makefile_star2_O1/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 %r15
pushq %r14
pushq %rbx
subq $0xc8, %rsp
movq %rsi, %rbx
cmpl $0x4, %edi
jle 0x1322
movq %rsp, %rdi
callq 0x1040
testl %eax, %eax
jne 0x132c
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), %ebx
decl %ebp
movq %rsp, %r15
movq %r15, %rdi
movl %ebp, %esi
movl %ebx, %edx
callq 0x11f7
movl %eax, %ebp
addl $0x4, %r14d
movq %r15, %rdi
movl %r14d, %esi
movl %ebx, %edx
callq 0x11f7
addl %eax, %ebp
leaq 0xd25(%rip), %rdi       # 0x202c
xorl %ebx, %ebx
movl %ebx, %eax
movl %ebp, %esi
callq 0x1030
movl %ebx, %eax
addq $0xc8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movq %rbx, %rdi
callq 0x10c2
jmp 0x1331
callq 0x10a0
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
jmp 0x1314
// File: /workspace/github_c_makefile_star2_O1/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 0xca3(%rip), %rdi       # 0x2069
movl $0x1, %esi
xorl %eax, %eax
callq 0x10e0
movl %eax, 0x2d84(%rip)      # 0x415c
cmpl $-0x1, %eax
je 0x1462
callq 0x1060
movl %eax, 0x2d74(%rip)      # 0x4160
leaq 0xc84(%rip), %rdi       # 0x2077
movl %eax, %esi
xorl %eax, %eax
callq 0x1080
movl 0x2d5e(%rip), %edx      # 0x4160
leaq 0xc89(%rip), %rsi       # 0x2092
leaq -0x30(%rbp), %rbx
movq %rbx, %rdi
xorl %eax, %eax
callq 0x1100
movl 0x2d3e(%rip), %r14d     # 0x415c
movq %rbx, %rdi
callq 0x1070
movl %r14d, %edi
movq %rbx, %rsi
movq %rax, %rdx
callq 0x1050
leaq 0x2d35(%rip), %rdi      # 0x4170
leaq 0x37(%rip), %rdx        # 0x1479
xorl %esi, %esi
xorl %ecx, %ecx
callq 0x10d0
movq 0x2d1e(%rip), %rdi      # 0x4170
xorl %esi, %esi
callq 0x1120
leaq 0xcbb(%rip), %rdi       # 0x211b
jmp 0x1469
leaq 0xcd6(%rip), %rdi       # 0x213f
callq 0x1040
xorl %eax, %eax
addq $0x20, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/eric-lo[P]3150/6-Memory/access_code.c
// Function: main
int main(void) {
	void *ptr = main;
	unsigned char c = *((unsigned char *) ptr);
	printf("Read  : 0x%x\n", c);
    printf("Read  : %p\n", ptr);
	printf("Write : \n");
	*((unsigned char *) ptr) = 0xff;
	printf("done\n");
	return 0;
}

// Assembly:
pushq %rbx
leaq -0x8(%rip), %rbx        # 0x114c
movzbl -0xf(%rip), %esi        # 0x114c
leaq 0xea2(%rip), %rdi       # 0x2004
xorl %eax, %eax
callq 0x1040
leaq 0xea2(%rip), %rdi       # 0x2012
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1040
leaq 0xe9d(%rip), %rdi       # 0x201e
callq 0x1030
movb $-0x1, -0x41(%rip)      # 0x114c
leaq 0xe93(%rip), %rdi       # 0x2027
callq 0x1030
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x143a
callq 0x1c70
cmpl $0x2, %ebx
jne 0x1472
callq 0x1070
movl $0x0, (%rax)
movq 0x8(%r14), %r15
testq %r15, %r15
jne 0x149c
leaq 0xbcd(%rip), %rdi       # 0x2027
leaq 0xbd0(%rip), %rsi       # 0x2031
leaq 0xbdf(%rip), %rcx       # 0x2047
movl $0xa7, %edx
callq 0x10d0
movq 0x2b7f(%rip), %rax      # 0x3ff8
movq (%rax), %rcx
leaq 0xb81(%rip), %rdi       # 0x2004
movl $0x19, %esi
movl $0x1, %edx
callq 0x11c0
movl $0x1, %edi
callq 0x11b0
movq %rax, %rbx
movq %rsp, %r12
movq %r15, %rdi
movq %r12, %rsi
xorl %edx, %edx
callq 0x1040
movq %rax, %r14
movq (%r12), %rcx
movl $0x16, %eax
cmpq %r15, %rcx
je 0x14d3
cmpb $0x0, (%rcx)
jne 0x14d3
cmpq $0x8, %r14
jb 0x14d5
movl $0x22, %eax
xorl %r14d, %r14d
movl %eax, (%rbx)
cmpl $0x0, (%rbx)
jne 0x1588
callq 0x1844
testq %rax, %rax
je 0x1492
movq %rax, %rbx
movslq %r14d, %rax
leaq (%rax,%rax,2), %rax
leaq 0xc07(%rip), %rcx       # 0x2100
leaq (%rcx,%rax,4), %r14
movq %rsp, %rsi
movq %rbx, 0x8(%rsi)
movl (%r14), %eax
movl 0x8(%r14), %ecx
movl %eax, (%rsi)
movl %ecx, 0x4(%rsi)
leaq 0x8a(%rip), %rdi        # 0x15a1
callq 0x173c
cmpl $-0x1, %eax
je 0x1492
movl %eax, %ebp
callq 0x10b0
movslq %eax, %rsi
leaq 0xb56(%rip), %rdi       # 0x208c
leaq 0xb57(%rip), %rdx       # 0x2094
xorl %eax, %eax
callq 0x10c0
xorl %esi, %esi
cmpl $0x0, (%r14)
sete %sil
movl 0x4(%r14), %edx
movq %rbx, %rdi
callq 0x1636
testl %eax, %eax
jne 0x1492
movl %ebp, %edi
callq 0x179e
testl %eax, %eax
jne 0x1492
movq %rbx, %rdi
callq 0x1a97
testl %eax, %eax
jne 0x1492
xorl %edi, %edi
callq 0x11b0
leaq 0xa8f(%rip), %rdi       # 0x201e
xorl %eax, %eax
callq 0x1cf0
movl $0x0, (%rbx)
jmp 0x1492
// File: /workspace/github_c_makefile_star2_O1/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 0xad5(%rip), %rdi       # 0x208c
leaq 0xae7(%rip), %rdx       # 0x20a5
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x10c0
movq 0x8(%r14), %rdi
movl (%r14), %esi
movl 0x4(%r14), %edx
callq 0x1636
movl %eax, %ebp
movq 0x8(%r14), %rdi
callq 0x1a97
orl %ebp, %eax
jne 0x162a
movq 0x29eb(%rip), %rax      # 0x3fd8
movq (%rax), %rdi
callq 0x1160
testl %eax, %eax
je 0x162f
callq 0x1070
cmpl $0x0, (%rax)
je 0x161c
movq %rax, %rbx
leaq 0xaa8(%rip), %rdi       # 0x20b5
xorl %eax, %eax
callq 0x1cf0
movl $0x0, (%rbx)
jmp 0x162a
leaq 0xa92(%rip), %rdi       # 0x20b5
xorl %eax, %eax
callq 0x1e0f
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x16b1
testl %edx, %edx
je 0x1676
callq 0x10b0
movslq %eax, %rsi
leaq 0xa39(%rip), %rdi       # 0x208c
leaq 0xa62(%rip), %rdx       # 0x20bc
xorl %eax, %eax
callq 0x10c0
movq %rbx, %rdi
callq 0x1a86
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %eax, %eax
jne 0x1733
callq 0x10b0
movslq %eax, %rsi
leaq 0xa07(%rip), %rdi       # 0x208c
leaq 0xa44(%rip), %rdx       # 0x20d0
xorl %eax, %eax
callq 0x10c0
movq %rbx, %rdi
callq 0x18e5
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %eax, %eax
jne 0x1733
leaq 0xa18(%rip), %rbx       # 0x20c7
jmp 0x1718
testl %edx, %edx
je 0x16e3
callq 0x10b0
movslq %eax, %rsi
leaq 0x9c8(%rip), %rdi       # 0x208c
leaq 0xa0b(%rip), %rdx       # 0x20d6
xorl %eax, %eax
callq 0x10c0
movq %rbx, %rdi
callq 0x1a90
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %eax, %eax
jne 0x1733
callq 0x10b0
movslq %eax, %rsi
leaq 0x99a(%rip), %rdi       # 0x208c
leaq 0x9f3(%rip), %rdx       # 0x20ec
xorl %eax, %eax
callq 0x10c0
movq %rbx, %rdi
callq 0x1a12
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
testl %eax, %eax
jne 0x1733
leaq 0x9cb(%rip), %rbx       # 0x20e3
callq 0x10b0
movslq %eax, %rsi
leaq 0x965(%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
// File: /workspace/github_c_makefile_star2_O1/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
movl $0x0, 0xc(%rsp)
testq %rdi, %rdi
je 0x1713
movq %rsi, %r14
testq %rsi, %rsi
je 0x1713
movq %rdx, %rbx
testq %rdx, %rdx
je 0x1713
movq %rdi, %r15
movq $0x0, (%r14)
movl $0x0, (%rbx)
xorl %edi, %edi
movl $0xfa0, %esi            # imm = 0xFA0
movl $0xfa1, %edx            # imm = 0xFA1
xorl %ecx, %ecx
callq 0x1732
movl %eax, %ecx
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testl %ecx, %ecx
jne 0x1705
leaq 0x240d(%rip), %rdi      # 0x3a90
leaq 0x1b4a(%rip), %rsi      # 0x31d4
callq 0x11a0
movq %rax, %r12
leaq 0x1984(%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 0x1909
movl (%r13), %edi
movl $0xa, %esi
callq 0x1150
leaq 0x18(%rsp), %r15
leaq 0x10(%rsp), %r12
xorl %edi, %edi
movq %r15, %rsi
movq %r12, %rdx
callq 0x1ac4
addl $-0x3, %eax
cmpl $0x2, %eax
jb 0x16e0
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 0x1a49(%rip), %rdi      # 0x3163
leaq 0x1a74(%rip), %rsi      # 0x3195
leaq 0x1a73(%rip), %rcx      # 0x319b
movl $0x1c, %edx
callq 0x10d0
// File: /workspace/github_c_makefile_star2_O1/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 0x1b90
movq %rsi, %r14
testq %rsi, %rsi
je 0x1baf
movq %rdx, %rbx
testq %rdx, %rdx
je 0x1baf
movslq %edi, %rax
imulq $0x58, %rax, %rax
leaq 0x4642(%rip), %rcx      # 0x6140
movq (%rax,%rcx), %r13
movq 0x8(%rax,%rcx), %r15
movzwl 0x4(%r13), %edx
xorl %eax, %eax
movq %rax, (%r14)
movq %rax, (%rbx)
movzwl 0x2(%r13), %ecx
movl $0x3, %eax
cmpw %cx, %dx
je 0x1b81
subl %ecx, %edx
movl $0x4, %eax
cmpl $0x1, %edx
je 0x1b81
leal 0x1(%rcx), %eax
movw %ax, (%r13)
shrl %ecx
movzbl %cl, %ebp
movzwl 0x10(%r13,%rbp,4), %r12d
movq %r12, %rdi
callq 0x1160
movq %rax, (%r14)
movzwl 0xe(%r13,%rbp,4), %ecx
addq %rcx, %r15
movq %rax, %rdi
movq %r15, %rsi
movq %r12, %rdx
callq 0x1130
movzwl 0x10(%r13,%rbp,4), %eax
movq %rax, (%rbx)
movzwl 0x2(%r13), %eax
addl $0x2, %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 0x1c9b(%rip), %rdi      # 0x3832
leaq 0x15f7(%rip), %rsi      # 0x3195
leaq 0x1d3a(%rip), %rcx      # 0x38df
movl $0x2ab, %edx            # imm = 0x2AB
callq 0x10d0
leaq 0x1d53(%rip), %rdi      # 0x3909
leaq 0x15d8(%rip), %rsi      # 0x3195
leaq 0x1d1b(%rip), %rcx      # 0x38df
movl $0x2ac, %edx            # imm = 0x2AC
callq 0x10d0
// File: /workspace/github_c_makefile_star2_O1/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 0x15fe(%rip), %rdi      # 0x31d7
movl $0x40, %esi
movl $0x1b6, %edx            # imm = 0x1B6
movl $0x1, %ecx
xorl %eax, %eax
callq 0x1110
movq %rax, 0x4b6a(%rip)      # 0x6760
testq %rax, %rax
je 0x1c6a
xorl %ebx, %ebx
xorl %edi, %edi
movl $0xfa1, %esi            # imm = 0xFA1
movl $0xfa0, %edx            # imm = 0xFA0
movl $0x200, %ecx            # imm = 0x200
callq 0x1732
testl %eax, %eax
je 0x1c2a
leaq 0x1d3a(%rip), %rdi      # 0x3958
callq 0x1070
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x1c60
leaq 0x1e5f(%rip), %rdi      # 0x3a90
leaq 0x15c3(%rip), %rsi      # 0x31fb
callq 0x11a0
movq %rax, %r14
callq 0x1090
leaq 0x13d1(%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 0x156c(%rip), %rdi      # 0x31dd
callq 0x11b0
jmp 0x1c23
// File: /workspace/github_c_makefile_star2_O1/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 0x11c2(%rip), %rdi      # 0x354a
movq %rbx, %rsi
movq %r14, %rdx
movl %r15d, %ecx
xorl %eax, %eax
callq 0x10c0
testq %rbx, %rbx
je 0x2478
testq %r14, %r14
je 0x2478
testq %r15, %r15
je 0x2418
movq %r15, (%rsp)
movl $0x1, %ebp
movl $0x10, %r13d
leaq 0x3e23(%rip), %r15      # 0x61e8
leaq 0x42a4(%rip), %r12      # 0x6670
cmpl $0x0, (%r15)
je 0x23e8
movq (%r13,%r12), %rsi
testq %rsi, %rsi
je 0x23e8
movq %rbx, %rdi
callq 0x1100
testl %eax, %eax
je 0x2400
incl %ebp
addq $0x10, %r13
addq $0x58, %r15
cmpq $0xf0, %r13
jne 0x23cc
movl $0xf, %ebp
cmpl $0xf, %ebp
jne 0x2428
leaq 0x162b(%rip), %rdi      # 0x3a37
callq 0x1070
movl $0xffffffff, %ebp       # imm = 0xFFFFFFFF
jmp 0x2467
leaq 0x1638(%rip), %rdi      # 0x3a57
callq 0x1070
xorl %ebp, %ebp
jmp 0x2467
movl %ebp, %edi
movq %r14, %rsi
movq (%rsp), %r15
movq %r15, %rdx
callq 0x1909
movl %ebp, %eax
shlq $0x4, %rax
movl 0x8(%rax,%r12), %edi
movl $0xa, %esi
callq 0x1150
leaq 0x116c(%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 0x10ee(%rip), %rdi      # 0x356d
leaq 0xd0f(%rip), %rsi       # 0x3195
leaq 0x1103(%rip), %rcx      # 0x3590
movl $0x11c, %edx            # imm = 0x11C
callq 0x10d0
// File: /workspace/github_c_makefile_star2_O1/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 0x251a
movq %rsi, %r14
testq %rsi, %rsi
je 0x251a
movq %rdx, %rbx
movq %rdi, %r15
movl $0xa8, %r13d
leaq 0x3c7e(%rip), %rbp      # 0x6140
leaq 0x101d(%rip), %r12      # 0x34e6
cmpl $0x0, (%r13,%rbp)
je 0x24fe
movq -0x20(%r13,%rbp), %rsi
testq %rsi, %rsi
je 0x24fe
movq %r15, %rdi
callq 0x1100
testl %eax, %eax
jne 0x24fe
movq %r14, -0x18(%r13,%rbp)
movq %rbx, -0x8(%r13,%rbp)
movq %r12, %rdi
movq %r15, %rsi
xorl %eax, %eax
callq 0x10c0
addq $0x58, %r13
cmpq $0x578, %r13            # imm = 0x578
jne 0x24c9
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xf60(%rip), %rdi       # 0x3481
leaq 0xc6d(%rip), %rsi       # 0x3195
leaq 0xf70(%rip), %rcx       # 0x349f
movl $0xf6, %edx
callq 0x10d0
// File: /workspace/github_c_makefile_star2_O1/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 0x2599
movq %rsi, %rbx
testq %rsi, %rsi
je 0x2599
movq %rdi, %r14
movl $0xa8, %r15d
leaq 0x3be2(%rip), %r12      # 0x6140
cmpl $0x0, (%r15,%r12)
je 0x2580
movq -0x20(%r15,%r12), %rsi
testq %rsi, %rsi
je 0x2580
movq %r14, %rdi
callq 0x1100
testl %eax, %eax
jne 0x2580
movq %rbx, -0x10(%r15,%r12)
addq $0x58, %r15
cmpq $0x578, %r15            # imm = 0x578
jne 0x255e
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
leaq 0xee1(%rip), %rdi       # 0x3481
leaq 0xbee(%rip), %rsi       # 0x3195
leaq 0xf63(%rip), %rcx       # 0x3511
movl $0x109, %edx            # imm = 0x109
callq 0x10d0
// File: /workspace/github_c_makefile_star2_O1/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 0x263f
movq %rsi, %rbx
testq %rsi, %rsi
je 0x265e
movl %edx, %ebp
testl %edx, %edx
js 0x265e
je 0x2634
movl %edi, %eax
leaq (%rax,%rax,2), %rax
leaq 0x4187(%rip), %rcx      # 0x6770
leaq (%rcx,%rax,8), %r14
movl 0x8(%r14), %r15d
addl %ebp, %r15d
movl 0xc(%r14), %eax
cmpl %eax, %r15d
jle 0x261f
testl %eax, %eax
jne 0x2609
movl $0x3e8, 0xc(%r14)       # imm = 0x3E8
movq (%r14), %rdi
movslq 0xc(%r14), %rsi
addq %rsi, %rsi
callq 0x1170
movq %rax, (%r14)
shll 0xc(%r14)
movslq 0x8(%r14), %rdi
addq (%r14), %rdi
movl %ebp, %edx
movq %rbx, %rsi
callq 0x1130
movl %r15d, 0x8(%r14)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
leaq 0x112a(%rip), %rdi      # 0x3770
leaq 0xb48(%rip), %rsi       # 0x3195
leaq 0x1195(%rip), %rcx      # 0x37e9
movl $0x23c, %edx            # imm = 0x23C
callq 0x10d0
leaq 0x11a9(%rip), %rdi      # 0x380e
leaq 0xb29(%rip), %rsi       # 0x3195
leaq 0x1176(%rip), %rcx      # 0x37e9
movl $0x23d, %edx            # imm = 0x23D
callq 0x10d0
// File: /workspace/github_c_makefile_star2_O1/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 0x26e5
movl %edi, %eax
imulq $0x58, %rax, %r15
leaq 0x3aac(%rip), %r14      # 0x6140
movq (%r15,%r14), %rdi
callq 0x1080
movl 0x10(%r15,%r14), %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x1190
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
cmpl $-0x1, %eax
je 0x26dd
addq %r15, %r14
movq 0x18(%r14), %rdi
callq 0x1080
movl 0x28(%r14), %edi
xorl %esi, %esi
xorl %edx, %edx
callq 0x1190
cmpl $-0x1, %eax
je 0x26dd
movl $0x0, 0x50(%r14)
xorl %ebx, %ebx
movl %ebx, %eax
popq %rbx
popq %r14
popq %r15
retq
leaq 0xf63(%rip), %rdi       # 0x364f
leaq 0xaa2(%rip), %rsi       # 0x3195
leaq 0xf80(%rip), %rcx       # 0x367a
movl $0x1e4, %edx            # imm = 0x1E4
callq 0x10d0
// File: /workspace/github_c_makefile_star2_O1/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 0x27fb
movl %edx, %ebx
movl %edi, %esi
movl %edx, %eax
orl %edi, %eax
js 0x27fb
movl %esi, %r15d
leaq (%r15,%r15,2), %r12
leaq 0x4018(%rip), %r13      # 0x6770
movl 0x8(%r13,%r12,8), %edx
movl 0xc(%r13,%r12,8), %ecx
leaq 0xf77(%rip), %rdi       # 0x36e0
xorl %ebp, %ebp
xorl %eax, %eax
callq 0x10c0
movl 0x8(%r13,%r12,8), %eax
cmpl %eax, 0xc(%r13,%r12,8)
jl 0x281a
testl %ebx, %ebx
je 0x27ea
leaq (,%r12,8), %r12
addq %r13, %r12
movq (%r12), %rsi
testq %rsi, %rsi
sete %cl
testl %eax, %eax
sete %dl
orb %cl, %dl
jne 0x27ea
testl %eax, %eax
jle 0x2839
cmpl %ebx, %eax
cmovll %eax, %ebx
movq %r14, %rdi
movq %rbx, %rdx
callq 0x1130
imulq $0x58, %r15, %rax
leaq 0x3979(%rip), %rcx      # 0x6140
addl %ebx, 0x14(%rax,%rcx)
movl 0x8(%r12), %ebp
subl %ebx, %ebp
jle 0x27e3
movq (%r12), %rdi
leaq (%rdi,%rbx), %rsi
movl %ebp, %edx
callq 0x1180
movl %ebp, 0x8(%r12)
movl %ebx, %ebp
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
leaq 0xe93(%rip), %rdi       # 0x3695
leaq 0x98c(%rip), %rsi       # 0x3195
leaq 0xeab(%rip), %rcx       # 0x36bb
movl $0x206, %edx            # imm = 0x206
callq 0x10d0
leaq 0xee2(%rip), %rdi       # 0x3703
leaq 0x96d(%rip), %rsi       # 0x3195
leaq 0xe8c(%rip), %rcx       # 0x36bb
movl $0x20b, %edx            # imm = 0x20B
callq 0x10d0
leaq 0xeef(%rip), %rdi       # 0x372f
leaq 0x94e(%rip), %rsi       # 0x3195
leaq 0xe6d(%rip), %rcx       # 0x36bb
movl $0x212, %edx            # imm = 0x212
callq 0x10d0
// File: /workspace/github_c_makefile_star2_O1/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 0x3e97
movq %rsi, %rbx
movq 0x8(%rsi), %rdi
callq 0x127c
testl %eax, %eax
js 0x3eaa
movq %rsp, %r14
movl $0x400, %edx            # imm = 0x400
movq %r14, %rdi
xorl %esi, %esi
callq 0x10b0
movq 0x10(%rbx), %rsi
leaq 0x703(%rip), %rdi       # 0x454f
xorl %eax, %eax
callq 0x1090
movq 0x10(%rbx), %rdi
movq %r14, %rsi
callq 0x32e2
testl %eax, %eax
js 0x3ec0
leaq 0x6f5(%rip), %rdi       # 0x455f
movl $0x1b, %esi
xorl %edx, %edx
movl $0x20, %ecx
movl $0x1b, %r8d
xorl %r9d, %r9d
xorl %eax, %eax
callq 0x1090
leaq 0x6fc(%rip), %rdi       # 0x4589
callq 0x1060
movq %rsp, %rdi
jmp 0x3ec7
leaq 0x75b(%rip), %rdi       # 0x45f9
callq 0x1060
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
jmp 0x3ed5
movq 0x8(%rbx), %rsi
leaq 0x675(%rip), %rdi       # 0x452a
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x1090
jmp 0x3ed5
leaq 0x706(%rip), %rdi       # 0x45cd
callq 0x1060
xorl %ebx, %ebx
xorl %eax, %eax
callq 0x12ba
movl %ebx, %eax
addq $0x3208, %rsp           # imm = 0x3208
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x242b
movq 0x3d37(%rip), %rax      # 0x61d0
cmpq $0x2, %rax
jl 0x24b3
movq 0x3ca2(%rip), %rcx      # 0x6148
addq %rcx, %rax
decq %rax
movq %rax, 0x3c95(%rip)      # 0x6148
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x242b
movq 0x3d07(%rip), %rax      # 0x61d0
testq %rax, %rax
jle 0x2511
xorl %r12d, %r12d
movq 0x3af8(%rip), %r14      # 0x5fd0
leaq 0x1b31(%rip), %r15      # 0x4010
xorl %ebx, %ebx
cmpq $0x0, 0x3c5f(%rip)      # 0x6148
je 0x24f0
incq %rbx
jmp 0x2500
movl $0x5, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2170
movq 0x3cc9(%rip), %rax      # 0x61d0
incq %r12
cmpq %rax, %r12
jl 0x24e1
jmp 0x2513
xorl %ebx, %ebx
cmpq %rax, %rbx
jne 0x2524
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq 0x3aa5(%rip), %r14      # 0x5fd0
leaq 0x1ae4(%rip), %rsi      # 0x4016
movl $0x14, %edx
movq %r14, %rdi
callq 0x2170
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2140
movq %rax, %rbx
leaq 0x1ad7(%rip), %rsi      # 0x402b
movl $0x6, %edx
movq %rax, %rdi
callq 0x2170
movq 0x3c68(%rip), %rsi      # 0x61d0
movq %rbx, %rdi
callq 0x2140
leaq 0x1ba6(%rip), %rsi      # 0x411d
movl $0x1, %edx
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x2170
// File: /workspace/github_c_makefile_star2_O1/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 0x242b
cmpq $0x0, 0x3c30(%rip)      # 0x61d0
jle 0x25d3
xorl %r14d, %r14d
leaq 0x3bbc(%rip), %rbx      # 0x6168
movq %rbx, %rdi
callq 0x21c0
testl %eax, %eax
jne 0x25db
incq 0x3b89(%rip)            # 0x6148
movq %rbx, %rdi
callq 0x20d0
incq %r14
cmpq 0x3bff(%rip), %r14      # 0x61d0
jl 0x25ac
addq $0x8, %rsp
popq %rbx
popq %r14
retq
movl %eax, %edi
callq 0x20b0
// File: /workspace/github_c_makefile_star2_O1/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 0x242b
movq 0x3bd7(%rip), %rax      # 0x61d0
testq %rax, %rax
jle 0x2662
xorl %r13d, %r13d
leaq 0x3b60(%rip), %r14      # 0x6168
movq 0x39c1(%rip), %r15      # 0x5fd0
leaq 0x19fa(%rip), %r12      # 0x4010
xorl %ebx, %ebx
movq %r14, %rdi
callq 0x21c0
testl %eax, %eax
jne 0x26e6
movq 0x3b19(%rip), %rbp      # 0x6148
movq %r14, %rdi
callq 0x20d0
testq %rbp, %rbp
je 0x2641
incq %rbx
jmp 0x2651
movl $0x5, %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0x2170
movq 0x3b78(%rip), %rax      # 0x61d0
incq %r13
cmpq %rax, %r13
jl 0x2618
jmp 0x2664
xorl %ebx, %ebx
cmpq %rax, %rbx
jne 0x2678
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x3951(%rip), %r14      # 0x5fd0
leaq 0x1990(%rip), %rsi      # 0x4016
movl $0x14, %edx
movq %r14, %rdi
callq 0x2170
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2140
movq %rax, %rbx
leaq 0x1983(%rip), %rsi      # 0x402b
movl $0x6, %edx
movq %rax, %rdi
callq 0x2170
movq 0x3b14(%rip), %rsi      # 0x61d0
movq %rbx, %rdi
callq 0x2140
leaq 0x1a52(%rip), %rsi      # 0x411d
movl $0x1, %edx
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2170
movl %eax, %edi
callq 0x20b0
// File: /workspace/github_c_makefile_star2_O1/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 0x242b
cmpq $0x0, 0x3ad2(%rip)      # 0x61d0
js 0x2731
movq $-0x1, %r14
leaq 0x3a82(%rip), %rbx      # 0x6190
movq %rbx, %rdi
callq 0x21d0
incq 0x3a2b(%rip)            # 0x6148
movq %rbx, %rdi
callq 0x21a0
incq %r14
cmpq 0x3aa1(%rip), %r14      # 0x61d0
jl 0x270e
addq $0x8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x242b
movq 0x3a80(%rip), %rax      # 0x61d0
testq %rax, %rax
jle 0x27b1
xorl %r13d, %r13d
leaq 0x3a31(%rip), %r14      # 0x6190
movq 0x386a(%rip), %r15      # 0x5fd0
leaq 0x18a3(%rip), %r12      # 0x4010
xorl %ebx, %ebx
movq %r14, %rdi
callq 0x21d0
movq 0x39ca(%rip), %rbp      # 0x6148
movq %r14, %rdi
callq 0x21a0
testq %rbp, %rbp
je 0x2790
incq %rbx
jmp 0x27a0
movl $0x5, %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0x2170
movq 0x3a29(%rip), %rax      # 0x61d0
incq %r13
cmpq %rax, %r13
jl 0x276f
jmp 0x27b3
xorl %ebx, %ebx
cmpq %rax, %rbx
jne 0x27c7
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x3802(%rip), %r14      # 0x5fd0
leaq 0x1841(%rip), %rsi      # 0x4016
movl $0x14, %edx
movq %r14, %rdi
callq 0x2170
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2140
movq %rax, %rbx
leaq 0x1834(%rip), %rsi      # 0x402b
movl $0x6, %edx
movq %rax, %rdi
callq 0x2170
movq 0x39c5(%rip), %rsi      # 0x61d0
movq %rbx, %rdi
callq 0x2140
leaq 0x1903(%rip), %rsi      # 0x411d
movl $0x1, %edx
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2170
// File: /workspace/github_c_makefile_star2_O1/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 0x242b
movq 0x3984(%rip), %rax      # 0x61d0
testq %rax, %rax
jle 0x28ad
xorl %r13d, %r13d
leaq 0x3935(%rip), %r14      # 0x6190
movq 0x376e(%rip), %r15      # 0x5fd0
leaq 0x17a7(%rip), %r12      # 0x4010
xorl %ebx, %ebx
movq %r14, %rdi
callq 0x2120
movq 0x38ce(%rip), %rbp      # 0x6148
movq %r14, %rdi
callq 0x21a0
testq %rbp, %rbp
je 0x288c
incq %rbx
jmp 0x289c
movl $0x5, %edx
movq %r15, %rdi
movq %r12, %rsi
callq 0x2170
movq 0x392d(%rip), %rax      # 0x61d0
incq %r13
cmpq %rax, %r13
jl 0x286b
jmp 0x28af
xorl %ebx, %ebx
cmpq %rax, %rbx
jne 0x28c3
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq 0x3706(%rip), %r14      # 0x5fd0
leaq 0x1745(%rip), %rsi      # 0x4016
movl $0x14, %edx
movq %r14, %rdi
callq 0x2170
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2140
movq %rax, %rbx
leaq 0x1738(%rip), %rsi      # 0x402b
movl $0x6, %edx
movq %rax, %rdi
callq 0x2170
movq 0x38c9(%rip), %rsi      # 0x61d0
movq %rbx, %rdi
callq 0x2140
leaq 0x1807(%rip), %rsi      # 0x411d
movl $0x1, %edx
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x2170
// File: /workspace/github_c_makefile_star2_O1/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 0x242b
cmpq $0x0, 0x3891(%rip)      # 0x61d0
jle 0x2957
xorl %eax, %eax
lock
incq 0x387d(%rip)            # 0x61c8
incq %rax
cmpq 0x387b(%rip), %rax      # 0x61d0
jl 0x2943
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x242b
movq 0x3863(%rip), %rax      # 0x61d0
testq %rax, %rax
jle 0x29b7
xorl %r12d, %r12d
movq 0x3654(%rip), %r14      # 0x5fd0
leaq 0x168d(%rip), %r15      # 0x4010
xorl %ebx, %ebx
movq 0x383c(%rip), %rax      # 0x61c8
testq %rax, %rax
je 0x2996
incq %rbx
jmp 0x29a6
movl $0x5, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2170
movq 0x3823(%rip), %rax      # 0x61d0
incq %r12
cmpq %rax, %r12
jl 0x2985
jmp 0x29b9
xorl %ebx, %ebx
cmpq %rax, %rbx
jne 0x29ca
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
movq 0x35ff(%rip), %r14      # 0x5fd0
leaq 0x163e(%rip), %rsi      # 0x4016
movl $0x14, %edx
movq %r14, %rdi
callq 0x2170
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2140
movq %rax, %rbx
leaq 0x1631(%rip), %rsi      # 0x402b
movl $0x6, %edx
movq %rax, %rdi
callq 0x2170
movq 0x37c2(%rip), %rsi      # 0x61d0
movq %rbx, %rdi
callq 0x2140
leaq 0x1700(%rip), %rsi      # 0x411d
movl $0x1, %edx
movq %rax, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
jmp 0x2170
// File: /workspace/github_c_makefile_star2_O1/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 0x242b
cmpq $0x0, 0x378d(%rip)      # 0x61d0
jle 0x2a5a
xorl %eax, %eax
incq %rax
movq %rax, 0x3777(%rip)      # 0x61c8
cmpq 0x3778(%rip), %rax      # 0x61d0
jl 0x2a47
popq %rax
retq
// File: /workspace/github_c_makefile_star2_O1/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 0x242b
cmpq $0x0, 0x3766(%rip)      # 0x61d0
jle 0x2a84
xorl %eax, %eax
incq %rax
movq %rax, %rcx
xchgq %rcx, 0x374d(%rip)      # 0x61c8
cmpq 0x374e(%rip), %rax      # 0x61d0
jl 0x2a6e
popq %rax
retq