LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O3/stefpant[P]TCPserver/webcrawler/webcrawler.c
// Function: destroyPU
void destroyPU(void){
	//no need to lock just free memory
	for(int i=0;i<pucounter;i++)
		free(placedurls[i]);
	free(placedurls);
}

// Assembly:
cmpl $0x0, 0x3dec(%rip)      # 0x7208
jle 0x344b
pushq %rbp
movq %rsp, %rbp
pushq %rbx
pushq %rax
xorl %ebx, %ebx
movq 0x3dd3(%rip), %rax      # 0x7200
movq (%rax,%rbx,8), %rdi
callq 0x2030
incq %rbx
movslq 0x3dc8(%rip), %rax      # 0x7208
cmpq %rax, %rbx
jl 0x3426
addq $0x8, %rsp
popq %rbx
popq %rbp
movq 0x3dae(%rip), %rdi      # 0x7200
jmp 0x2030
// File: /workspace/github_c_makefile_star2_O3/stefpant[P]TCPserver/webcrawler/webcrawler.c
// Function: urlpool_clear
void urlpool_clear(urlpool** up){//clearing pool
	while(1){
		pthread_mutex_lock(&mtx);
		if( (*up)->count == 0 ){
			pthread_mutex_unlock(&mtx);
			return;
		}
		free( (*up)->urls[(*up)->end] );
		(*up)->end--;
		(*up)->count--;
		pthread_mutex_unlock(&mtx);
	}
	return;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r14
pushq %rbx
movq %rdi, %rbx
leaq 0x3d94(%rip), %rdi      # 0x7238
callq 0x2390
movq (%rbx), %rax
cmpl $0x0, 0xc(%rax)
je 0x34eb
leaq 0x3d7f(%rip), %r14      # 0x7238
movq (%rax), %rcx
movslq 0x10(%rax), %rax
movq (%rcx,%rax,8), %rdi
callq 0x2030
movq (%rbx), %rax
decl 0x10(%rax)
decl 0xc(%rax)
movq %r14, %rdi
callq 0x2210
movq %r14, %rdi
callq 0x2390
movq (%rbx), %rax
cmpl $0x0, 0xc(%rax)
jne 0x34b9
leaq 0x3d46(%rip), %rdi      # 0x7238
popq %rbx
popq %r14
popq %rbp
jmp 0x2210
// File: /workspace/github_c_makefile_star2_O3/stefpant[P]TCPserver/webcrawler/webcrawler.c
// Function: obtain
char* obtain(urlpool** up){//get request from buffer
	char* data;
	pthread_mutex_lock(&mtx);
	while( (*up)->count <= 0 ){
		//printf("Pool found empty\n");
		pthread_cond_wait(&cv_notempty,&mtx);
	}
	//data = malloc((strlen((*up)->urls[(*up)->start]) + 1)*sizeof(char));
	data = malloc((strlen((*up)->urls[(*up)->end]) + 1)*sizeof(char));
	//strcpy(data,(*up)->urls[(*up)->start]);
	strcpy(data,(*up)->urls[(*up)->end]);
	//free( (*up)->urls[(*up)->start] );
	free( (*up)->urls[(*up)->end] );
	//(*up)->start = ( (*up)->start + 1 ) % MAXR;
	(*up)->end--;
	(*up)->count--;
	pthread_mutex_unlock(&mtx);
	return data;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
leaq 0x3c6b(%rip), %rdi      # 0x7238
callq 0x2390
movq (%rbx), %rax
cmpl $0x0, 0xc(%rax)
jg 0x35fd
leaq 0x3c7e(%rip), %r14      # 0x7260
leaq 0x3c4f(%rip), %r15      # 0x7238
movq %r14, %rdi
movq %r15, %rsi
callq 0x20c0
movq (%rbx), %rax
cmpl $0x0, 0xc(%rax)
jle 0x35e9
movq (%rax), %rcx
movslq 0x10(%rax), %rax
movq (%rcx,%rax,8), %r14
movq %r14, %rdi
callq 0x20f0
leaq 0x1(%rax), %rdi
callq 0x2220
movq %rax, %r15
movq %rax, %rdi
movq %r14, %rsi
callq 0x2070
movq %r14, %rdi
callq 0x2030
movq (%rbx), %rax
decl 0x10(%rax)
decl 0xc(%rax)
leaq 0x3bf9(%rip), %rdi      # 0x7238
callq 0x2210
movq %r15, %rax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/evilwombat[P]gopro-fw-tools/fwunpacker.c
// Function: read_word
static unsigned int read_word(void)
{
	unsigned int r = 0;
	r |= fgetc(fd) <<  0;
	r |= fgetc(fd) <<  8;
	r |= fgetc(fd) << 16;
	r |= fgetc(fd) << 24;
	return r;
}

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq 0x2c65(%rip), %rdi      # 0x4088
callq 0x1080
movl %eax, %ebx
movq 0x2c57(%rip), %rdi      # 0x4088
callq 0x1080
movl %eax, %ebp
shll $0x8, %ebp
orl %ebx, %ebp
movq 0x2c44(%rip), %rdi      # 0x4088
callq 0x1080
movl %eax, %ebx
shll $0x10, %ebx
movq 0x2c33(%rip), %rdi      # 0x4088
callq 0x1080
shll $0x18, %eax
orl %ebx, %eax
orl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/test/test_index.c
// Function: usage
void HTS_NORETURN usage(FILE *fp) {
    fprintf(fp, "Usage: test_index [opts] in.{sam.gz,bam,cram}|in.{vcf.gz,bcf}\n\n");
    fprintf(fp, "  -b       Use BAI index (BAM, SAM)\n");
    fprintf(fp, "  -c       Use CSI index (BAM, SAM, VCF, BCF)\n");
    fprintf(fp, "  -t       Use TBI index (VCF) \n");
    fprintf(fp, "  -m bits  Adjust min_shift; implies CSI\n");
    fprintf(fp, "\nThe default index format is CSI for sam/bam/vcf/bcf and CRAI for crams\n");
    exit(fp == stderr ? 1 : 0);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
leaq 0xa109d(%rip), %rdi     # 0xa7004
movl $0x3f, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x49c0
leaq 0xa10c4(%rip), %rdi     # 0xa7044
movl $0x24, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x49c0
leaq 0xa10d0(%rip), %rdi     # 0xa7069
movl $0x2e, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x49c0
leaq 0xa10e6(%rip), %rdi     # 0xa7098
movl $0x20, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x49c0
leaq 0xa10ee(%rip), %rdi     # 0xa70b9
movl $0x29, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x49c0
leaq 0xa10ff(%rip), %rdi     # 0xa70e3
movl $0x48, %esi
movl $0x1, %edx
movq %rbx, %rcx
callq 0x49c0
movq 0xc6fdb(%rip), %rax     # 0xccfd8
xorl %edi, %edi
cmpq %rbx, (%rax)
sete %dil
callq 0x4600
// File: /workspace/github_c_makefile_star2_O3/samtools[P]htslib/test/test_index.c
// Function: main
int main(int argc, char **argv) {
    int c, min_shift = 14;

    while ((c = getopt(argc, argv, "bctm:")) >= 0) {
        switch (c) {
        case 't': case 'b': min_shift = 0; break;
        case 'c': min_shift = 14; break;
        case 'm': min_shift = atoi(optarg); break;
        case 'h': usage(stdout);
        default:  usage(stderr);
        }
    }

    if (optind >= argc) usage(stderr);

    htsFile *in = hts_open(argv[optind], "r");
    if (!in) {
        fprintf(stderr, "Error opening \"%s\"\n", argv[optind]);
        exit(1);
    }

    int ret;
    if (in->format.format == sam ||
        in->format.format == bam ||
        in->format.format == cram) {
        ret = sam_index_build(argv[optind], min_shift);
    } else {
        ret = bcf_index_build(argv[optind], min_shift);
    }

    if (ret < 0) {
        fprintf(stderr, "Failed to build index for \"%s\"\n", argv[optind]);
        exit(1);
    }

    if (hts_close(in) < 0) {
        fprintf(stderr, "Error closing \"%s\"\n", argv[optind]);
        exit(1);
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movq %rsi, %rbx
movl %edi, %r14d
leaq 0xa110c(%rip), %rdx     # 0xa712c
callq 0x40e0
testl %eax, %eax
js 0x6081
leaq 0xa10fc(%rip), %r15     # 0xa712c
movq 0xc6f89(%rip), %r12     # 0xccfc0
xorl %ebp, %ebp
cmpl $0x67, %eax
jle 0x604d
cmpl $0x6d, %eax
je 0x6062
cmpl $0x74, %eax
je 0x606d
jmp 0x60f8
cmpl $0x62, %eax
je 0x606d
cmpl $0x63, %eax
jne 0x6106
movl $0xe, %ebp
jmp 0x606d
movq (%r12), %rdi
callq 0x4810
movl %eax, %ebp
movl %r14d, %edi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x40e0
testl %eax, %eax
jns 0x6037
jmp 0x6086
movl $0xe, %ebp
movq 0xc6f53(%rip), %r15     # 0xccfe0
movslq (%r15), %rax
cmpl %r14d, %eax
jge 0x6106
movq (%rbx,%rax,8), %rdi
leaq 0xa3f3a(%rip), %rsi     # 0xa9fda
callq 0x9258
testq %rax, %rax
je 0x6115
movq %rax, %r14
movl 0x4c(%rax), %eax
cmpl $0x6, %eax
ja 0x60cf
movl $0x58, %ecx
btl %eax, %ecx
jae 0x60cf
movslq (%r15), %rax
movq (%rbx,%rax,8), %rdi
movl %ebp, %esi
callq 0x1768e
jmp 0x60dd
movslq (%r15), %rax
movq (%rbx,%rax,8), %rdi
movl %ebp, %esi
callq 0x3b29c
testl %eax, %eax
js 0x611d
movq %r14, %rdi
callq 0xa4ba
testl %eax, %eax
js 0x6125
xorl %eax, %eax
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
cmpl $0x68, %eax
jne 0x6106
movq 0xc6eac(%rip), %rax     # 0xccfb0
jmp 0x610d
movq 0xc6ecb(%rip), %rax     # 0xccfd8
movq (%rax), %rdi
callq 0x5f5c
movq %rbx, %rdi
callq 0x4a64
movq %rbx, %rdi
callq 0x4a32
movq %rbx, %rdi
callq 0x4a00
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O3/gadget114514[P]fatfs-example/cf2.c
// Function: main
void main()
{
  FIL f;
  int w;
  FATFS fs;
  FCHK(f_mount(&fs, "", 1)); 
  if (f_open(&f, "0:a.txt", FA_CREATE_ALWAYS|FA_READ|FA_WRITE) == FR_OK) {
    FCHK(f_write(&f, "abc\ndef\n", 9, &w));
    printf("open & write %d\n", w);
    FCHK(f_sync(&f));
    FCHK(f_close(&f));
  } else {
    printf("open error\n");
  }
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x4b0, %rsp            # imm = 0x4B0
leaq 0x42f3(%rip), %rsi      # 0x54a8
leaq -0x4d0(%rbp), %rdi
movl $0x1, %edx
callq 0x1458
movl %eax, %ebx
movl %eax, %edi
callq 0x12d1
leaq 0x3e2e(%rip), %rdi      # 0x5004
leaq 0x3e3a(%rip), %rsi      # 0x5017
movl %ebx, %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0x1050
leaq 0x3e3b(%rip), %rsi      # 0x502b
leaq -0x278(%rbp), %rdi
movl $0xb, %edx
callq 0x1849
testl %eax, %eax
je 0x1216
leaq 0x4200(%rip), %rdi      # 0x540c
callq 0x1030
jmp 0x12c1
leaq 0x3e16(%rip), %rsi      # 0x5033
leaq -0x278(%rbp), %rbx
leaq -0x24(%rbp), %r15
movq %rbx, %rdi
movl $0x9, %edx
movq %r15, %rcx
callq 0x2490
movl %eax, %r12d
movl %eax, %edi
callq 0x12d1
leaq 0x3dbb(%rip), %r14      # 0x5004
leaq 0x3dec(%rip), %rsi      # 0x503c
movq %r14, %rdi
movl %r12d, %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0x1050
movl (%r15), %esi
leaq 0x3df3(%rip), %rdi      # 0x505d
xorl %eax, %eax
callq 0x1050
movq %rbx, %rdi
callq 0x28eb
movl %eax, %r15d
movl %eax, %edi
callq 0x12d1
leaq 0x3de4(%rip), %rsi      # 0x506e
movq %r14, %rdi
movl %r15d, %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0x1050
movq %rbx, %rdi
callq 0x2a7a
movl %eax, %ebx
movl %eax, %edi
callq 0x12d1
leaq 0x3dc7(%rip), %rsi      # 0x5079
movq %r14, %rdi
movl %ebx, %edx
movq %rax, %rcx
xorl %eax, %eax
callq 0x1050
addq $0x4b0, %rsp            # imm = 0x4B0
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/mjosaarinen[P]brutus/crypto_aead/aezv3/ref/aez_ref.c
// Function: AEZprf
static void AEZprf(byte *K, unsigned kbytes, byte delta[16], unsigned bytes, byte *result) {

    byte buf[16], ctr[16];
    memset(ctr,0,16);
    for ( ; bytes >= 16; bytes-=16, result+=16) {
        unsigned i=15;
        xor_bytes(delta, ctr, 16, buf);
        E(K,kbytes,-1,3,buf,result);
        do { ctr[i]++; i--; } while (ctr[i+1]==0);   /* ctr+=1 */
    }
    if (bytes) {
        xor_bytes(delta, ctr, 16, buf);
        E(K,kbytes,-1,3,buf,buf);
        memcpy(result, buf, bytes);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r8, %rbx
movl %ecx, %ebp
movq %rdx, %r12
movl %esi, %r14d
movq %rdi, %r15
vxorps %xmm0, %xmm0, %xmm0
vmovaps %xmm0, (%rsp)
cmpl $0x10, %ecx
jb 0x177a
leaq 0x10(%rsp), %r13
vmovaps (%rsp), %xmm0
vxorps (%r12), %xmm0, %xmm0
vmovaps %xmm0, 0x10(%rsp)
movq %r15, %rdi
movl %r14d, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0x3, %ecx
movq %r13, %r8
movq %rbx, %r9
callq 0x19ae
movl $0xf, %eax
movl %eax, %ecx
decl %eax
incb (%rsp,%rcx)
je 0x1765
addl $-0x10, %ebp
addq $0x10, %rbx
cmpl $0xf, %ebp
ja 0x1734
testl %ebp, %ebp
je 0x17bc
vmovaps (%rsp), %xmm0
vxorps (%r12), %xmm0, %xmm0
leaq 0x10(%rsp), %r12
vmovaps %xmm0, (%r12)
movq %r15, %rdi
movl %r14d, %esi
movl $0xffffffff, %edx       # imm = 0xFFFFFFFF
movl $0x3, %ecx
movq %r12, %r8
movq %r12, %r9
callq 0x19ae
movl %ebp, %edx
movq %rbx, %rdi
movq %r12, %rsi
callq 0x10d0
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/mjosaarinen[P]brutus/crypto_aead/aezv3/ref/aez_ref.c
// Function: Encrypt
void Encrypt(byte *K, unsigned kbytes,
             byte *N, unsigned nbytes,
             byte *AD[], unsigned adbytes[],
             unsigned veclen, unsigned abytes,
             byte *M, unsigned mbytes, byte *C) {
    byte delta[16], *X;
    AEZhash(K, kbytes, N, nbytes, AD, adbytes, veclen, abytes*8, delta);
    if (mbytes==0) {
        AEZprf(K, kbytes, delta, abytes, C);
    } else {
        X = (byte *)malloc(mbytes+abytes);
        memcpy(X, M, mbytes); memset(X+mbytes,0,abytes);
        Encipher(K, kbytes, delta, X, mbytes+abytes, X);
        memcpy(C, X, mbytes+abytes);
        free(X);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %esi, %r12d
movq %rdi, %r14
movq 0x90(%rsp), %r15
movl 0x88(%rsp), %ebp
movq 0x80(%rsp), %rbx
movl 0x78(%rsp), %r13d
movl 0x70(%rsp), %eax
leal (,%r13,8), %esi
leaq 0x20(%rsp), %rdi
movq %rdi, 0x10(%rsp)
movl %esi, 0x8(%rsp)
movl %eax, (%rsp)
movq %r14, %rdi
movl %r12d, %esi
callq 0x143a
testl %ebp, %ebp
je 0x188c
movl %r12d, 0x1c(%rsp)
movq %r15, 0x30(%rsp)
leal (%rbp,%r13), %r15d
movq %r15, %rdi
callq 0x1050
movq %rax, %r12
movl %ebp, %ebp
movq %rax, %rdi
movq %rbx, %rsi
movq %rbp, %rdx
callq 0x10d0
movq %r12, %rdi
addq %rbp, %rdi
movl %r13d, %edx
xorl %esi, %esi
callq 0x1040
testl %r15d, %r15d
je 0x18cf
cmpl $0x1f, %r15d
ja 0x18b1
movq %r12, (%rsp)
leaq 0x20(%rsp), %rdx
movq %r14, %rdi
movl 0x1c(%rsp), %esi
movq %r12, %rcx
movl %r15d, %r8d
xorl %r9d, %r9d
callq 0x1fc8
jmp 0x18cf
leaq 0x20(%rsp), %rdx
movq %r14, %rdi
movl %r12d, %esi
movl %r13d, %ecx
movq %r15, %r8
callq 0x1705
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %r12, (%rsp)
leaq 0x20(%rsp), %rdx
movq %r14, %rdi
movl 0x1c(%rsp), %esi
movq %r12, %rcx
movl %r15d, %r8d
xorl %r9d, %r9d
callq 0x2544
movq 0x30(%rsp), %rdi
movq %r12, %rsi
movq %r15, %rdx
callq 0x10d0
movq %r12, %rdi
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x1070
// File: /workspace/github_c_makefile_star2_O3/mjosaarinen[P]brutus/crypto_aead/aezv3/ref/aez_ref.c
// Function: crypto_aead_decrypt
int crypto_aead_decrypt(
    unsigned char *m,unsigned long long *mlen,
    unsigned char *nsec,
    const unsigned char *c,unsigned long long clen,
    const unsigned char *ad,unsigned long long adlen,
    const unsigned char *npub,
    const unsigned char *k
)
{
    byte *AD[] = {(byte*)ad};
    unsigned adbytes[] = {(unsigned)adlen};
    (void)nsec;
    if (mlen) *mlen = clen-16;
    return Decrypt((byte*)k, CRYPTO_KEYBYTES, (byte*)npub, CRYPTO_NPUBBYTES,
                    AD, adbytes, 1, CRYPTO_ABYTES, (byte*)c, clen, (byte*)m);
}

// Assembly:
subq $0x18, %rsp
movq %r8, %r10
movq %rcx, %rax
movq %rdi, %r11
movq 0x30(%rsp), %rdi
movq 0x28(%rsp), %rdx
movl 0x20(%rsp), %ecx
movq %r9, 0x10(%rsp)
movl %ecx, 0xc(%rsp)
testq %rsi, %rsi
je 0x1983
leaq -0x10(%r10), %rcx
movq %rcx, (%rsi)
subq $0x8, %rsp
leaq 0x18(%rsp), %r8
leaq 0x14(%rsp), %r9
movl $0x10, %esi
movl $0xc, %ecx
pushq %r11
pushq %r10
pushq %rax
pushq $0x10
pushq $0x1
callq 0x1030
addq $0x48, %rsp
retq
// File: /workspace/github_c_makefile_star2_O3/mjosaarinen[P]brutus/crypto_aead/aezv3/ref/aez_ref.c
// Function: mult_block
static void mult_block(unsigned x, byte *src, byte *dst) {
    byte t[16], r[16];
    memcpy(t,src,16); memset(r,0,16);
    for ( ; x; x>>=1) {
        if (x&1) xor_bytes(r,t,16,r);
        double_block(t);
    }
    memcpy(dst,r,16);
}

// Assembly:
vmovdqu (%rsi), %xmm0
vmovdqa %xmm0, -0x18(%rsp)
vpxor %xmm0, %xmm0, %xmm0
testl %edi, %edi
je 0x1fc3
leaq -0x17(%rsp), %rax
movw $0x7fff, %cx            # imm = 0x7FFF
kmovd %ecx, %k1
vpbroadcastd 0x31b2(%rip), %xmm1 # 0x5120
vmovdqa -0x18(%rsp), %xmm2
testb $0x1, %dil
je 0x1f7e
vpxor %xmm0, %xmm2, %xmm0
movb -0x18(%rsp), %cl
vmovdqu8 (%rax), %xmm3 {%k1} {z}
vpsrlw $0x7, %xmm3, %xmm3
vpaddw %xmm2, %xmm2, %xmm2
vpternlogd $0xe4, %xmm1, %xmm3, %xmm2
vmovdqu8 %xmm2, -0x18(%rsp) {%k1}
movb -0x9(%rsp), %sil
addb %sil, %sil
sarb $0x7, %cl
andb $-0x79, %cl
xorb %sil, %cl
movb %cl, -0x9(%rsp)
movl %edi, %ecx
shrl %ecx
cmpl $0x1, %edi
movl %ecx, %edi
ja 0x1f6e
vmovdqu %xmm0, (%rdx)
retq
// File: /workspace/github_c_makefile_star2_O3/mabdi[P]bunney/bunny-flow.c
// Function: set_byte
static void set_byte(_u32 position, _u32 val) {
  _u32 f, roff;
  
  if (!cur_fuzzable) return;
  position %= cur_fuzzable;

  f = lookup_file(position, 1, &roff);
  load_data(f);

  infile[f].dirty = 1;  
  infile[f].data[roff] = val;
}

// Assembly:
movl 0x4ca4(%rip), %ecx      # 0x81a4
testl %ecx, %ecx
je 0x3556
pushq %rbp
pushq %r14
pushq %rbx
subq $0x10, %rsp
movl %esi, %ebx
movl %edi, %eax
xorl %edx, %edx
divl %ecx
movl %edx, %edi
leaq 0xc(%rsp), %r14
movl $0x1, %esi
movq %r14, %rdx
callq 0x3835
movl %eax, %ebp
movl %eax, %edi
callq 0x38d9
movq 0x4c60(%rip), %rax      # 0x8198
movl %ebp, %ecx
shlq $0x5, %rcx
movb $0x1, 0x1c(%rax,%rcx)
movq 0x8(%rax,%rcx), %rax
movl (%r14), %ecx
movb %bl, (%rax,%rcx)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/mabdi[P]bunney/bunny-flow.c
// Function: set_word
static void set_word(_u32 position, _u32 val) {
  _u32 f, roff;
  
  if (!cur_fuzzable) return;
  position %= cur_fuzzable;

  f = lookup_file(position, 1, &roff);
  load_data(f);

  infile[f].dirty = 1;  
  
  if (roff + 1 < infile[f].cur_len) 
    *(_u16*)(infile[f].data + roff) = val;
  else {
    /* Assume LE - we're IA32 specific anyway */
    infile[f].data[roff] = val;
    set_byte(position + 1, val >> 8);
  }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl 0x4c40(%rip), %ecx      # 0x81a4
testl %ecx, %ecx
je 0x35b8
movl %esi, %ebx
movl %edi, %eax
xorl %edx, %edx
divl %ecx
movl %edx, %ebp
leaq 0x4(%rsp), %r14
movl %edx, %edi
movl $0x1, %esi
movq %r14, %rdx
callq 0x3835
movl %eax, %r15d
movl %eax, %edi
callq 0x38d9
movq 0x4c01(%rip), %rdx      # 0x8198
movl %r15d, %esi
shlq $0x5, %rsi
movb $0x1, 0x1c(%rdx,%rsi)
movl (%r14), %eax
leal 0x1(%rax), %edi
movq 0x8(%rdx,%rsi), %rcx
cmpl 0x18(%rdx,%rsi), %edi
jae 0x35c3
movw %bx, (%rcx,%rax)
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movb %bl, (%rcx,%rax)
incl %ebp
shrl $0x8, %ebx
movl %ebp, %edi
movl %ebx, %esi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x34fa
// File: /workspace/github_c_makefile_star2_O3/mabdi[P]bunney/bunny-flow.c
// Function: remove_data
static void remove_data(_u32 position, _u32 len) {
  _u32 f, roff;

  if (!len) return;

  f = lookup_file(position, 1, &roff);
  load_data(f);
  
  if (roff == infile[f].cur_len) return; /* EOF already */

  infile[f].dirty = 1;
  
  /* Can remove in one operation? */
  if (roff + len <= infile[f].cur_len) {
    if (roff + len < infile[f].cur_len)
      memmove(infile[f].data + roff, infile[f].data + roff + len, infile[f].cur_len - roff);

    infile[f].data = myrealloc(infile[f].data, infile[f].cur_len - len);

    if (!infile[f].data) fatal("out of memory");
    infile[f].cur_len -= len;
    cur_fuzzable -= len;
  } else {
    _u32 candel = infile[f].cur_len - roff;
    /* Remove everything to EOF, repeat */
    infile[f].data = myrealloc(infile[f].data, roff);
    if (!infile[f].data) fatal("out of memory");
    cur_fuzzable -= candel;
    infile[f].cur_len = roff;
    remove_data(position, len - candel);
  }

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testl %esi, %esi
je 0x36ce
movl %esi, %ebx
movl %edi, %ebp
leaq 0x4(%rsp), %r14
movl $0x1, %esi
movq %r14, %rdx
callq 0x3835
movl %eax, %r15d
movl %eax, %edi
callq 0x38d9
movl (%r14), %r14d
movq 0x4b7d(%rip), %r12      # 0x8198
movl %r15d, %r13d
shlq $0x5, %r13
movl 0x18(%r12,%r13), %esi
movl %esi, %r15d
subl %r14d, %r15d
je 0x36ce
leaq (%r12,%r13), %rcx
movb $0x1, 0x1c(%rcx)
leal (%r14,%rbx), %eax
cmpl %esi, %eax
jbe 0x3686
movq 0x8(%rcx), %rdi
cmpl $0x1, %r14d
movl %r14d, %esi
adcl $0x0, %esi
callq 0x1250
movq %rax, 0x8(%r12,%r13)
testq %rax, %rax
je 0x36dd
subl %r15d, 0x4b3d(%rip)     # 0x81a4
movl %r14d, 0x18(%r12,%r13)
subl %r15d, %ebx
movl %ebp, %edi
movl %ebx, %esi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x35de
jae 0x36a6
addq 0x8(%rcx), %r14
movl %ebx, %esi
addq %r14, %rsi
movq %r14, %rdi
movq %r15, %rdx
movq %rcx, %r14
callq 0x1240
movq %r14, %rcx
movl 0x18(%r14), %esi
movq 0x8(%rcx), %rdi
subl %ebx, %esi
cmpl $0x1, %esi
adcl $0x0, %esi
movq %rcx, %r14
callq 0x1250
movq %rax, 0x8(%r12,%r13)
testq %rax, %rax
je 0x36e2
subl %ebx, 0x18(%r14)
subl %ebx, 0x4ad6(%rip)      # 0x81a4
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x208e
callq 0x2044
// File: /workspace/github_c_makefile_star2_O3/mabdi[P]bunney/bunny-flow.c
// Function: commit_connect
static void commit_connect(_u32 daddr,_u16 dport,_u8 udp) {
  _s32 csock;
  struct sockaddr_in sin;
  
  if (lport) { close(lsock); lport = 0; }
  
  csock = socket(AF_INET, udp ? SOCK_DGRAM : SOCK_STREAM, 0); 
  if (csock < 0) pfatal("socket() failed");
  
  sin.sin_family      = AF_INET;
  sin.sin_port        = dport;
  sin.sin_addr.s_addr = daddr;
  
try_connect_again:
  
  if (connect(csock, (struct sockaddr*)&sin, sizeof(sin))) {
  
    if (errno == ECONNREFUSED) {
      fd_set fds;
      FD_ZERO(&fds);
      FD_SET(0,&fds);

      if (select(1, &fds, 0, &fds, 0) < 0) 
        pfatal("select failed");

      if (FD_ISSET(0,&fds)) {
        debug("NOTE: connect() loop aborted by control command (something went wrong!)\n");
	close(csock);
        return;
      } else {
        sched_yield();
        goto try_connect_again;
      }

    }

    close(csock);
    debug("WARNING: Unable to initialize network connection to target.\n");
    return;
    
  }
  
  commit_data_fd(csock);
  
  close(csock);

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x98, %rsp
movl %edx, %ebx
movl %esi, %r14d
movl %edi, %ebp
cmpw $0x0, 0x4aa1(%rip)      # 0x81a8
je 0x371d
movl 0x4a9d(%rip), %edi      # 0x81ac
callq 0x12a0
movw $0x0, 0x4a8b(%rip)      # 0x81a8
cmpb $0x1, %bl
movl $0x2, %esi
sbbl $0x0, %esi
movl $0x2, %edi
xorl %edx, %edx
callq 0x1050
testl %eax, %eax
js 0x3830
movl %eax, %ebx
leaq 0x8(%rsp), %rsi
movw $0x2, (%rsi)
movw %r14w, 0x2(%rsi)
movl %ebp, 0x4(%rsi)
movl %eax, %edi
movl $0x10, %edx
callq 0x10f0
testl %eax, %eax
je 0x37f4
callq 0x1030
movq %rax, %r14
leaq 0x20(%rsp), %r13
leaq 0x18(%rsp), %r15
leaq 0x8(%rsp), %r12
cmpl $0x6f, (%r14)
jne 0x3814
xorps %xmm0, %xmm0
movups %xmm0, 0x60(%r13)
movups %xmm0, 0x50(%r13)
movups %xmm0, 0x40(%r13)
movups %xmm0, 0x30(%r13)
movups %xmm0, 0x20(%r13)
movups %xmm0, 0x10(%r13)
movups %xmm0, (%r13)
movq $0x0, 0x70(%r13)
movq $0x1, 0x18(%rsp)
movl $0x1, %edi
movq %r15, %rsi
xorl %edx, %edx
movq %r15, %rcx
xorl %r8d, %r8d
callq 0x1120
testl %eax, %eax
js 0x382b
testb $0x1, 0x18(%rsp)
jne 0x381d
callq 0x11d0
movl %ebx, %edi
movq %r12, %rsi
movl $0x10, %edx
callq 0x10f0
testl %eax, %eax
jne 0x377b
movl %ebx, %edi
callq 0x3b80
movl %ebx, %edi
callq 0x12a0
addq $0x98, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movl %ebx, %edi
callq 0x20d8
jmp 0x3802
leaq 0x18(%rsp), %rsi
movl %ebx, %edi
callq 0x20ff
jmp 0x3802
callq 0x2127
callq 0x217d
// File: /workspace/github_c_makefile_star2_O3/mabdi[P]bunney/bunny-flow.c
// Function: lookup_file
static _u32 lookup_file(_u32 position, _u8 skip_blank, _u32* offset) {
  _u32 i;
  _u32 cpos = 0;
  _s32 last0 = -1;
  
  for (i=0;i < infcount - 1;i++) {
    if (infile[i].asis) continue;
    if (position < cpos + infile[i].cur_len) break;
    if (!infile[i].cur_len && last0 < 0) last0 = i;
      else if (infile[i].cur_len) last0 = -1;
    cpos += infile[i].cur_len;
  }
  
  *offset = position - cpos;
  
  if (!*offset) {
    if (!skip_blank) return last0 > 0 ? last0 : i;
  } else {
    if (position >= cur_fuzzable) *offset = infile[i].cur_len; /* EOF */
  }
  
  return i;

}

// Assembly:
pushq %r14
pushq %rbx
movl 0x4952(%rip), %eax      # 0x8190
decl %eax
je 0x3894
movq 0x494f(%rip), %r8       # 0x8198
movl %eax, %r9d
addq $0x18, %r8
xorl %r10d, %r10d
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
xorl %r11d, %r11d
cmpb $0x0, -0x8(%r8)
jne 0x3886
movl (%r8), %r14d
leal (%r14,%r11), %ebx
cmpl %edi, %ebx
ja 0x38a0
testl %ecx, %ecx
movl %r10d, %r11d
cmovnsl %ecx, %r11d
negl %r14d
movl $0x0, %ecx
sbbl %ecx, %ecx
orl %r11d, %ecx
movl %ebx, %r11d
incq %r10
addq $0x20, %r8
cmpq %r10, %r9
jne 0x385b
jmp 0x38a3
xorl %eax, %eax
movl $0xffffffff, %ecx       # imm = 0xFFFFFFFF
xorl %r11d, %r11d
jmp 0x38a3
movl %r10d, %eax
movl %edi, %r8d
subl %r11d, %r8d
movl %r8d, (%rdx)
jne 0x38ba
testb %sil, %sil
jne 0x38d5
testl %ecx, %ecx
cmovgl %ecx, %eax
jmp 0x38d5
cmpl %edi, 0x48e4(%rip)      # 0x81a4
ja 0x38d5
movq 0x48cf(%rip), %rcx      # 0x8198
movl %eax, %esi
shlq $0x5, %rsi
movl 0x18(%rcx,%rsi), %ecx
movl %ecx, (%rdx)
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O3/mabdi[P]bunney/bunny-flow.c
// Function: load_data
static void load_data(_u32 rec) {
  _s32 fd;

  if (infile[rec].data) return;
  
  if (chdir(indir)) pfatal("cannot enter '%s'",indir);
  if (rec >= infcount) fatal("rec out of range");

  fd = open(infile[rec].fname,O_RDONLY);
    
  if (fd < 0)
    pfatal("unable to access '%s/%s'",indir,infile[rec].fname);
        
  infile[rec].dirty = 0;
  infile[rec].data  = malloc(infile[rec].orig_len);
  if (!infile[rec].data) fatal("out of memory");
    
  if (infile[rec].orig_len)
    if (read(fd,infile[rec].data,infile[rec].orig_len) != infile[rec].orig_len)
      fatal("short read from '%s/%s'",indir,infile[rec].fname);

  close(fd);

  if (chdir(workdir)) pfatal("unable to go back to work directory");

}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
pushq %rax
movq 0x48b0(%rip), %rax      # 0x8198
movl %edi, %r14d
movq %r14, %r15
shlq $0x5, %r15
cmpq $0x0, 0x8(%rax,%r15)
jne 0x3998
movl %edi, %ebx
movq 0x3879(%rip), %rdi      # 0x7180
callq 0x11e0
testl %eax, %eax
jne 0x39a4
cmpl %ebx, 0x4876(%rip)      # 0x8190
jbe 0x39a9
movq 0x4871(%rip), %rax      # 0x8198
movq (%rax,%r15), %rdi
xorl %esi, %esi
xorl %eax, %eax
callq 0x10d0
testl %eax, %eax
js 0x39ae
movl %eax, %ebx
movq 0x4857(%rip), %r12      # 0x8198
movb $0x0, 0x1c(%r12,%r15)
movl 0x14(%r12,%r15), %r14d
movq %r14, %rdi
callq 0x1190
movq %rax, 0x8(%r12,%r15)
testq %rax, %rax
je 0x39b6
testq %r14, %r14
je 0x3981
movl %ebx, %edi
movq %rax, %rsi
movq %r14, %rdx
callq 0x11c0
movq 0x4821(%rip), %rdi      # 0x8198
movl 0x14(%rdi,%r15), %ecx
cmpq %rcx, %rax
jne 0x39c0
movl %ebx, %edi
callq 0x12a0
leaq 0x3801(%rip), %rdi      # 0x7190
callq 0x11e0
testl %eax, %eax
jne 0x39bb
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
callq 0x21d3
callq 0x222c
movq %r14, %rdi
callq 0x2369
callq 0x231f
callq 0x22c9
addq %r15, %rdi
callq 0x2276
// File: /workspace/github_c_makefile_star2_O3/mabdi[P]bunney/bunny-flow.c
// Function: get_data
static _u8* get_data(_u32 position, _u32 len,_u8* where) {
  _u32 f, roff;
      
  if (!where) {
    where = malloc(len);
    if (!where) fatal("out of memory");
  }

  if (!len) return where;

  /* Absolutely no data left? Just return zeros */ 
  if (!cur_fuzzable) {
    memset(where, 0, len);
    return where;
  }

  /* Otherwise, just wrap the address space */
  position %= cur_fuzzable;
  
  f = lookup_file(position, 1, &roff);
  load_data(f);
  
  /* Can it be done in a single read? */
  if (roff + len <= infile[f].cur_len) {
    memcpy(where,infile[f].data + roff, len);
  /* Multiple reads needed */
  } else {
    _u32 cancopy = infile[f].cur_len - roff;
    memcpy(where,infile[f].data + roff, cancopy);
    position += cancopy;
    len -= cancopy;
    get_data(position, len, where + cancopy);
  }
  
  return where;

}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdx, %rbx
movl %esi, %r14d
movl %edi, %ebp
testq %rdx, %rdx
jne 0x39f5
movl %r14d, %edi
callq 0x1190
movq %rax, %rbx
testq %rax, %rax
je 0x3aa7
testl %r14d, %r14d
je 0x3a97
movl 0x47a0(%rip), %ecx      # 0x81a4
testl %ecx, %ecx
je 0x3a79
movl %ebp, %eax
xorl %edx, %edx
divl %ecx
movl %edx, %ebp
leaq 0xc(%rsp), %r15
movl %edx, %edi
movl $0x1, %esi
movq %r15, %rdx
callq 0x3835
movl %eax, %r12d
movl %eax, %edi
callq 0x38d9
movl (%r15), %esi
leal (%rsi,%r14), %ecx
movq 0x475c(%rip), %rdx      # 0x8198
movl %r12d, %edi
shlq $0x5, %rdi
leaq (%rdx,%rdi), %rax
movl 0x18(%rdx,%rdi), %r15d
cmpl %r15d, %ecx
jbe 0x3a88
subl %esi, %r15d
addq 0x8(%rax), %rsi
movq %rbx, %rdi
movq %r15, %rdx
callq 0x10e0
addl %r15d, %ebp
subl %r15d, %r14d
leaq (%rbx,%r15), %rdx
movl %ebp, %edi
movl %r14d, %esi
callq 0x39c8
jmp 0x3a97
movl %r14d, %edx
movq %rbx, %rdi
xorl %esi, %esi
callq 0x10c0
jmp 0x3a97
addq 0x8(%rax), %rsi
movl %r14d, %edx
movq %rbx, %rdi
callq 0x10e0
movq %rbx, %rax
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
callq 0x23d4
// File: /workspace/github_c_makefile_star2_O3/mabdi[P]bunney/bunny-flow.c
// Function: set_data
static void set_data(_u32 position, _u32 len,_u8* src) {
  _u32 f, roff;

  if (!cur_fuzzable || !len) return;
  position %= cur_fuzzable;
  
  f = lookup_file(position, 1, &roff);
  load_data(f);

  infile[f].dirty = 1;

  if (roff + len <= infile[f].cur_len) {
    memcpy(infile[f].data + roff, src, len);
  } else {
    _u32 cancopy = infile[f].cur_len - roff;
    memcpy(infile[f].data + roff, src, cancopy);
    position += cancopy;
    len -= cancopy;
    set_data(position, len, src + cancopy);
  }
  
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0x10, %rsp
movq %rdx, %rbx
movl 0x46e3(%rip), %ecx      # 0x81a4
testl %ecx, %ecx
sete %al
testl %esi, %esi
sete %dl
orb %al, %dl
jne 0x3b58
movl %esi, %r14d
movl %edi, %eax
xorl %edx, %edx
divl %ecx
movl %edx, %ebp
leaq 0xc(%rsp), %r15
movl %edx, %edi
movl $0x1, %esi
movq %r15, %rdx
callq 0x3835
movl %eax, %r12d
movl %eax, %edi
callq 0x38d9
movq 0x4695(%rip), %rcx      # 0x8198
movl %r12d, %edx
shlq $0x5, %rdx
leaq (%rcx,%rdx), %rax
movb $0x1, 0x1c(%rcx,%rdx)
movl (%r15), %edi
leal (%rdi,%r14), %esi
movl 0x18(%rcx,%rdx), %r15d
cmpl %r15d, %esi
jbe 0x3b65
subl %edi, %r15d
addq 0x8(%rax), %rdi
movq %rbx, %rsi
movq %r15, %rdx
callq 0x10e0
addl %r15d, %ebp
subl %r15d, %r14d
addq %r15, %rbx
movl %ebp, %edi
movl %r14d, %esi
movq %rbx, %rdx
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x3aac
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
retq
addq 0x8(%rax), %rdi
movl %r14d, %edx
movq %rbx, %rsi
addq $0x10, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x10e0
// File: /workspace/github_c_makefile_star2_O3/USArmyResearchLab[P]ARL_OpenSHMEM/src/autogen/shmem_collect32.c
// Function: shmem_collect32
void shmem_collect32(void *dest, const void *source, size_t nelems, 
	int pe_start, int log_pe_stride, int pe_size, long* psync)
{
	int pe = __shmem.my_pe;
	int pe_step = 0x1 << log_pe_stride;
	int pe_end = pe_start + pe_step * (pe_size - 1);
	int my_offset = 0;
	int inelems = (int)nelems;

	/* We know the value here is 0 and we can use it and reset it before
	 * it is needed in the barrier */

	volatile long* offset = psync + SHMEM_COLLECT_SYNC_SIZE - 1;

	int* neighbor_offset = (int*)shmem_ptr((void*)offset, pe + pe_step);

	if (__builtin_expect((pe == pe_start),0)) {

		*neighbor_offset = my_offset + inelems;

	} else {

		/// spin until neighbor sets offset 
		while (!(my_offset = *offset));

		*offset = SHMEM_SYNC_VALUE;

		if (__builtin_expect((pe != pe_end),1))
			*neighbor_offset = my_offset + inelems;
	}

	int i, j;
	for (i = pe_start; i <= pe_end; i += pe_step) {
		int32_t* dst = (int32_t*)shmem_ptr((void*)dest, i) + my_offset;
		for (j = 0; j < inelems; j++) dst[j] = ((int32_t*)source)[j];
	}

	shmem_barrier(pe_start, log_pe_stride, pe_size, psync);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %ecx, %r12d
movq %rdx, (%rsp)
movq %rsi, %r13
movq %rdi, 0x30(%rsp)
movq 0x70(%rsp), %rdx
leaq 0x4efc(%rip), %rax      # 0x61f0
pushq $0x1
popq %rbp
movl %r8d, %ecx
shll %cl, %ebp
movq %r9, 0x28(%rsp)
leal -0x1(%r9), %esi
movl %r8d, 0x14(%rsp)
shll %cl, %esi
movl 0x4(%rax), %ebx
movq %rsi, 0x8(%rsp)
leal (%rsi,%r12), %r14d
movq %rdx, 0x20(%rsp)
leaq 0x38(%rdx), %r15
leal (%rbx,%rbp), %esi
movq %r15, %rdi
callq 0x1e14
movq %r12, 0x18(%rsp)
cmpl %r12d, %ebx
je 0x13d2
movq (%r15), %rcx
testl %ecx, %ecx
je 0x133a
movq $0x0, (%r15)
cmpl %r14d, %ebx
je 0x13dd
movq (%rsp), %rdx
addl %ecx, %edx
movq 0x8(%rsp), %rsi
movl %edx, (%rax)
testl %esi, %esi
js 0x13ac
movslq %ecx, %rbx
shlq $0x2, %rbx
movq (%rsp), %r12
andl $0x7fffffff, %r12d      # imm = 0x7FFFFFFF
movq 0x18(%rsp), %rax
movl %eax, %r15d
movq 0x30(%rsp), %rdi
movl %r15d, %esi
callq 0x1e14
cmpl $0x0, (%rsp)
jle 0x13a4
addq %rbx, %rax
xorl %ecx, %ecx
movl (%r13,%rcx,4), %edx
movl %edx, (%rax,%rcx,4)
incq %rcx
cmpq %rcx, %r12
jne 0x1394
addl %ebp, %r15d
cmpl %r14d, %r15d
jle 0x137c
movq 0x18(%rsp), %rdi
movl 0x14(%rsp), %esi
movq 0x28(%rsp), %rdx
movq 0x20(%rsp), %rcx
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x31fc
xorl %ecx, %ecx
movq (%rsp), %rdx
jmp 0x1357
movq 0x8(%rsp), %rsi
jmp 0x135e
nopw (%rax,%rax)
// File: /workspace/github_c_makefile_star2_O3/kevinp89[P]Operating-System-EXT2-file-system-with-commands/./ext2_utils.c
// Function: check_parent
int check_parent(unsigned char *disk, char *path) {
	struct ext2_super_block *sb = (struct ext2_super_block *)(disk + 1024);
	struct ext2_group_desc *desc = (struct ext2_group_desc *)(disk + 2*1024);
	// Copying the path string into an array
	// Getting amount of dir inputs
	char *dupe = strdup(path);
	strcpy(dupe, path);
	int dircount = 0;
	int i;
	for (i = 0; dupe[i] != 0; i++) {
		if (dupe[i] == '/' && dupe[i+1] != '\0') {
			dircount++;
		}
	}
	if (dircount == 0) {
		fprintf(stderr, "Invalid directory.\n");
		exit(ENOENT);
	}
	// Creating array and copying
	char *dirs[dircount];
	char *tail = dupe;
	for (i = 0; i < dircount; i++) {
		dirs[i] = strsep(&tail, "/");
	}

	// Inode related
	struct ext2_inode *curinode;
	int node = 1; // Root directory begins at index 1
	
	i = 1;
	while (i < dircount) {
		if (strcmp(dirs[i], ".") != 0) {
			curinode = (struct ext2_inode *)((disk + 1024 * desc->bg_inode_table) + (sb->s_inode_size * node));
			node = search_directories(disk, curinode, dirs[i], 1);
			if (node == -1) {
				break;
			}
		}
		i++;
	}

	free(dupe);
	return node;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %rsi, %r15
movq %rdi, %r13
movq %rsi, %rdi
callq 0x1160
movq %rax, %r12
movq %rax, %rdi
movq %r15, %rsi
callq 0x1050
movq %r12, %rax
incq %rax
xorl %ebx, %ebx
movzbl -0x1(%rax), %ecx
cmpl $0x2f, %ecx
je 0x168e
testl %ecx, %ecx
jne 0x1694
jmp 0x1699
cmpb $0x1, (%rax)
sbbl $-0x1, %ebx
incq %rax
jmp 0x167f
testl %ebx, %ebx
je 0x1783
movl %ebx, %eax
movq %rsp, %r14
movq %rax, %rcx
leaq 0xf(,%rax,8), %rax
andq $-0x10, %rax
subq %rax, %r14
movq %r14, %rsp
movq %r12, -0x48(%rbp)
movl $0x1, -0x2c(%rbp)
testl %ebx, %ebx
jle 0x1769
movq %r13, -0x38(%rbp)
movq %r12, -0x40(%rbp)
xorl %r15d, %r15d
leaq -0x48(%rbp), %r12
movq %rcx, %r13
movq %r12, %rdi
leaq 0x92e(%rip), %rsi       # 0x2018
callq 0x1100
movq %rax, (%r14,%r15,8)
incq %r15
cmpq %r15, %r13
jne 0x16e0
cmpl $0x1, %ebx
movq -0x40(%rbp), %r12
movq -0x38(%rbp), %r15
je 0x1769
movl $0x1, -0x2c(%rbp)
movl $0x1, %ebx
movq (%r14,%rbx,8), %rdx
cmpb $0x2e, (%rdx)
jne 0x1723
cmpb $0x0, 0x1(%rdx)
je 0x1758
movl 0x808(%r15), %eax
shll $0xa, %eax
addq %r15, %rax
movzwl 0x458(%r15), %ecx
movslq -0x2c(%rbp), %rsi
imulq %rcx, %rsi
addq %rax, %rsi
movq %r15, %rdi
movl $0x1, %ecx
callq 0x1562
movl %eax, -0x2c(%rbp)
cmpl $-0x1, %eax
je 0x1762
incq %rbx
cmpq %rbx, %r13
jne 0x1714
jmp 0x1769
movl $0xffffffff, -0x2c(%rbp) # imm = 0xFFFFFFFF
movq %r12, %rdi
callq 0x1030
movl -0x2c(%rbp), %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
callq 0x1180
// File: /workspace/github_c_makefile_star2_O3/kevinp89[P]Operating-System-EXT2-file-system-with-commands/ext2_cp.c
// Function: get_free_blocks
int *get_free_blocks(int blocks_need, unsigned char *block_bit_map){

	int i,j=22;
	
	int* free_blocks = malloc(sizeof(int)*blocks_need);
	
	for(i=0; i<blocks_need; i++){
		while(check_node(j, block_bit_map) == 0){
			j++;
			//if j reaches max block count, return null
			if(j==sb->s_blocks_count){
				return NULL;
			}
		}
		free_blocks[i] = j;	
		set_node(j, block_bit_map);
	}
	return free_blocks;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movq %rsi, %rbx
movl %edi, %ebp
movslq %edi, %r14
leaq (,%r14,4), %rdi
callq 0x10f0
testl %r14d, %r14d
jle 0x181d
movl %ebp, %edx
movl $0x16, %esi
xorl %edi, %edi
movq 0x2901(%rip), %r8       # 0x40d0
leal 0x7(%rsi), %ecx
testl %esi, %esi
cmovnsl %esi, %ecx
sarl $0x3, %ecx
movslq %ecx, %r9
movl %esi, %ecx
andb $0x7, %cl
movl $0x1, %r10d
shll %cl, %r10d
movzbl (%rbx,%r9), %ecx
movl %esi, %r11d
andl $0x7, %r11d
btl %r11d, %ecx
jb 0x1807
incl %esi
cmpl 0x4(%r8), %esi
jne 0x17cf
jmp 0x181b
movl %esi, (%rax,%rdi,4)
xorb %cl, %r10b
movb %r10b, (%rbx,%r9)
incq %rdi
cmpq %rdx, %rdi
jne 0x17c8
jmp 0x181d
xorl %eax, %eax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/kevinp89[P]Operating-System-EXT2-file-system-with-commands/ext2_cp.c
// Function: find_free_block
int find_free_block(unsigned char *bmap){
	int bnode;
	for (bnode = 22; bnode < sb->s_blocks_count; bnode++) {
		if (check_node(bnode, bmap) == 0) {
			break;
		}
	}
	if(bnode == sb->s_blocks_count){
		return -1;	
	}
	set_node(bnode, bmap);
	return bnode;
}

// Assembly:
movq 0x28a7(%rip), %rax      # 0x40d0
movl 0x4(%rax), %ecx
movl $0x16, %edx
cmpl $0x17, %ecx
jb 0x1855
movl %edx, %eax
shrl $0x3, %eax
movzbl (%rdi,%rax), %eax
movl %edx, %esi
andl $0x7, %esi
btl %esi, %eax
jae 0x1855
incl %edx
cmpl %edx, %ecx
jne 0x1836
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
retq
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl %ecx, %edx
je 0x1874
movl %edx, %ecx
andb $0x7, %cl
movl $0x1, %eax
shll %cl, %eax
movl %edx, %ecx
shrl $0x3, %ecx
xorb %al, (%rdi,%rcx)
movl %edx, %eax
retq
// File: /workspace/github_c_makefile_star2_O3/chatziko-k08[P]lecture-code/programs/fibonacci/ADTIntVector_test.c
// Function: test_insert
void test_insert(void) {
	IntVector vec = int_vector_create(0);

	// insert 1000 στοιχεία ώστε να συμβούν πολλαπλά resizes
	for (int i = 0; i < 1000; i++) {
		int_vector_insert_last(vec, i);
		TEST_ASSERT(int_vector_size(vec) == i+1);	// Το size ενημερώθηκε;
		TEST_ASSERT(int_vector_get_at(vec, i) == i);	// Μπορούμε να κάνουμε at το στοιχείο που μόλις βάλαμε;
	}

	// Δοκιμή ότι μετά τα resizes τα στοιχεία είναι ακόμα προσπελάσιμα
	for (int i = 0; i < 1000; i++)
		TEST_ASSERT(int_vector_get_at(vec, i) == i);

	int_vector_destroy(vec);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
xorl %edi, %edi
callq 0x4604
movq %rax, %rbx
movl $0x3e8, %r12d           # imm = 0x3E8
leaq 0x1604(%rip), %r14      # 0x5318
leaq 0x1764(%rip), %r15      # 0x547f
xorl %ebp, %ebp
subl $0x1, %r12d
jb 0x3d96
movq %rbx, %rdi
movl %ebp, %esi
callq 0x465f
movq %rbx, %rdi
callq 0x4644
leal 0x1(%rbp), %r13d
xorl %edi, %edi
cmpl %r13d, %eax
sete %dil
movq %r14, %rsi
movl $0x1b, %edx
movq %r15, %rcx
leaq 0x15f2(%rip), %r8       # 0x5346
xorl %eax, %eax
callq 0x25cc
testl %eax, %eax
je 0x3d91
movq %rbx, %rdi
movl %ebp, %esi
callq 0x4655
xorl %edi, %edi
cmpl %ebp, %eax
sete %dil
movq %r14, %rsi
movl $0x1c, %edx
movq %r15, %rcx
leaq 0x15df(%rip), %r8       # 0x5362
xorl %eax, %eax
callq 0x25cc
movl %r13d, %ebp
testl %eax, %eax
jne 0x3d1d
callq 0x2e2b
leaq 0x157b(%rip), %r14      # 0x5318
leaq 0x16db(%rip), %r15      # 0x547f
leaq 0x15b7(%rip), %r12      # 0x5362
xorl %ebp, %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x4655
xorl %edi, %edi
cmpl %eax, %ebp
sete %dil
movq %r14, %rsi
movl $0x21, %edx
movq %r15, %rcx
movq %r12, %r8
xorl %eax, %eax
callq 0x25cc
testl %eax, %eax
je 0x3d91
incl %ebp
cmpl $0x3e8, %ebp            # imm = 0x3E8
jne 0x3dad
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x46b7
// File: /workspace/github_c_makefile_star2_O3/chatziko-k08[P]lecture-code/programs/fibonacci/ADTIntVector_test.c
// Function: test_remove
void test_remove(void) {
	IntVector vec = int_vector_create(1000);

	// replace για προσθήκη δεδομένων, χωρίς ελέγχους (έχουμε ξεχωριστό test για το replace)
	for (int i = 0; i < 1000; i++)
		int_vector_set_at(vec, i, i);

	// Διαδοχικά remove ώστε να συμβούν και resizes
	for (int i = 999; i >= 0; i--) {
		TEST_ASSERT(int_vector_get_at(vec, i) == i);
		int_vector_remove_last(vec);
		TEST_ASSERT(int_vector_size(vec) == i);
	}

	int_vector_destroy(vec);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl $0x3e8, %edi            # imm = 0x3E8
callq 0x4604
movq %rax, %rbx
xorl %ebp, %ebp
movq %rbx, %rdi
movl %ebp, %esi
movl %ebp, %edx
callq 0x4649
incl %ebp
cmpl $0x3e8, %ebp            # imm = 0x3E8
jne 0x3e12
movl $0x3e7, %ebp            # imm = 0x3E7
leaq 0x14e4(%rip), %r14      # 0x5318
leaq 0x1644(%rip), %r15      # 0x547f
leaq 0x1520(%rip), %r12      # 0x5362
leaq 0x1538(%rip), %r13      # 0x5381
movq %rbx, %rdi
movl %ebp, %esi
callq 0x4655
xorl %edi, %edi
cmpl %eax, %ebp
sete %dil
movq %r14, %rsi
movl $0x2f, %edx
movq %r15, %rcx
movq %r12, %r8
xorl %eax, %eax
callq 0x25cc
testl %eax, %eax
je 0x3ec0
movq %rbx, %rdi
callq 0x4686
movq %rbx, %rdi
callq 0x4644
xorl %edi, %edi
cmpl %eax, %ebp
sete %dil
movq %r14, %rsi
movl $0x31, %edx
movq %r15, %rcx
movq %r13, %r8
xorl %eax, %eax
callq 0x25cc
testl %eax, %eax
je 0x3ec0
addl $-0x1, %ebp
jb 0x3e49
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x46b7
callq 0x2e2b
// File: /workspace/github_c_makefile_star2_O3/chatziko-k08[P]lecture-code/programs/fibonacci/ADTIntVector_test.c
// Function: test_get_set_at
void test_get_set_at(void) {
	IntVector vec = int_vector_create(0);

	// insert πολλαπλά 0, θα τα αλλάξουμε μετά με replace
	for (int i = 0; i < 1000; i++)
		int_vector_insert_last(vec, 0);

	for (int i = 0; i < 1000; i++) {
		TEST_ASSERT(int_vector_get_at(vec, i) == 0);
		int_vector_set_at(vec, i, i);
		TEST_ASSERT(int_vector_get_at(vec, i) == i);
	}

	int_vector_destroy(vec);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
xorl %edi, %edi
callq 0x4604
movq %rax, %rbx
movl $0x3e8, %ebp            # imm = 0x3E8
movq %rbx, %rdi
xorl %esi, %esi
callq 0x465f
decl %ebp
jne 0x3edf
leaq 0x1424(%rip), %r14      # 0x5318
leaq 0x1584(%rip), %r15      # 0x547f
leaq 0x1499(%rip), %r12      # 0x539b
leaq 0x1459(%rip), %r13      # 0x5362
xorl %ebp, %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x4655
xorl %edi, %edi
testl %eax, %eax
sete %dil
movq %r14, %rsi
movl $0x3f, %edx
movq %r15, %rcx
movq %r12, %r8
xorl %eax, %eax
callq 0x25cc
testl %eax, %eax
je 0x3f8d
movq %rbx, %rdi
movl %ebp, %esi
movl %ebp, %edx
callq 0x4649
movq %rbx, %rdi
movl %ebp, %esi
callq 0x4655
xorl %edi, %edi
cmpl %eax, %ebp
sete %dil
movq %r14, %rsi
movl $0x41, %edx
movq %r15, %rcx
movq %r13, %r8
xorl %eax, %eax
callq 0x25cc
testl %eax, %eax
je 0x3f8d
incl %ebp
cmpl $0x3e8, %ebp            # imm = 0x3E8
jne 0x3f0b
movq %rbx, %rdi
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x46b7
callq 0x2e2b
// File: /workspace/github_c_makefile_star2_O3/chatziko-k08[P]lecture-code/programs/fibonacci/ADTIntVector_test.c
// Function: test_find
void test_find(void) {
	IntVector vec = int_vector_create(1000);

	// replace για προσθήκη δεδομένων
	for (int i = 0; i < 1000; i++)
		int_vector_set_at(vec, i, i);

	for (int i = 0; i < 1000; i++) {
		int p = int_vector_find(vec, i);
		TEST_ASSERT(p == i);
	}

	TEST_ASSERT(int_vector_find(vec, -12) == INT_MIN);

	int_vector_destroy(vec);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
movl $0x3e8, %edi            # imm = 0x3E8
callq 0x4604
movq %rax, %rbx
xorl %ebp, %ebp
movq %rbx, %rdi
movl %ebp, %esi
movl %ebp, %edx
callq 0x4649
incl %ebp
cmpl $0x3e8, %ebp            # imm = 0x3E8
jne 0x3fa9
leaq 0x1352(%rip), %r14      # 0x5318
leaq 0x14b2(%rip), %r15      # 0x547f
leaq 0x13e6(%rip), %r12      # 0x53ba
xorl %ebp, %ebp
movq %rbx, %rdi
movl %ebp, %esi
callq 0x4690
xorl %edi, %edi
cmpl %eax, %ebp
sete %dil
movq %r14, %rsi
movl $0x50, %edx
movq %r15, %rcx
movq %r12, %r8
xorl %eax, %eax
callq 0x25cc
testl %eax, %eax
je 0x4055
incl %ebp
cmpl $0x3e8, %ebp            # imm = 0x3E8
jne 0x3fd6
movq %rbx, %rdi
movl $0xfffffff4, %esi       # imm = 0xFFFFFFF4
callq 0x4690
xorl %edi, %edi
negl %eax
seto %dil
leaq 0x12f1(%rip), %rsi      # 0x5318
leaq 0x1451(%rip), %rcx      # 0x547f
leaq 0x138c(%rip), %r8       # 0x53c1
movl $0x53, %edx
xorl %eax, %eax
callq 0x25cc
testl %eax, %eax
je 0x4055
movq %rbx, %rdi
popq %rbx
popq %r12
popq %r14
popq %r15
popq %rbp
jmp 0x46b7
callq 0x2e2b
// File: /workspace/github_c_makefile_star2_O3/chatziko-k08[P]lecture-code/programs/fibonacci/ADTIntVector_test.c
// Function: test_destroy
void test_destroy(void) {
	// Απλά εκτελούμε την destroy, για να ελέγξουμε αν όντως δουλεύει
	// σωστά τρέχουμε το test με valgrind.

	IntVector vec = int_vector_create(1);

	int_vector_set_at(vec, 0, 1);
	int_vector_insert_last(vec, 1);
	int_vector_remove_last(vec);

	int_vector_destroy(vec);
}

// Assembly:
pushq %rbx
movl $0x1, %edi
callq 0x4604
movq %rax, %rbx
movq %rax, %rdi
xorl %esi, %esi
movl $0x1, %edx
callq 0x4649
movq %rbx, %rdi
movl $0x1, %esi
callq 0x465f
movq %rbx, %rdi
callq 0x4686
movq %rbx, %rdi
popq %rbx
jmp 0x46b7
// File: /workspace/github_c_makefile_star2_O3/chatziko-k08[P]lecture-code/programs/fibonacci/ADTIntVector.c
// Function: int_vector_create
IntVector int_vector_create(int size) {
	// Περνάμε τη free στην vector_create, ώστε κάθε στοιχείο που αφαιρείται να γίνεται free αυτόματα
	Vector vec = vector_create(size, free);

	// Ο πίνακας περιέχει size μη-αρχικοποιημένους ακεραίους, δεσμεύουμε μνήμη για αυτούς
	for (int i = 0; i < size; i ++)
		vector_set_at(vec, i, malloc(sizeof(int)));

	return (IntVector)vec;
}

// Assembly:
pushq %rbp
pushq %r14
pushq %rbx
movl %edi, %ebx
movq 0x39af(%rip), %rsi      # 0x7fc0
callq 0x46bc
movq %rax, %r14
testl %ebx, %ebx
jle 0x463c
xorl %ebp, %ebp
movl $0x4, %edi
callq 0x21a0
movq %r14, %rdi
movl %ebp, %esi
movq %rax, %rdx
callq 0x4733
incl %ebp
cmpl %ebp, %ebx
jne 0x461f
movq %r14, %rax
popq %rbx
popq %r14
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O3/chatziko-k08[P]lecture-code/programs/cat/../../modules/UsingDynamicArray/ADTVector.c
// Function: vector_set_at
void vector_set_at(Vector vec, int pos, Pointer value) {
	assert(pos >= 0 && pos < vec->size);	// LCOV_EXCL_LINE

	// Αν υπάρχει συνάρτηση destroy_value, την καλούμε για το στοιχείο που αντικαθίσταται
	if (value != vec->array[pos].value && vec->destroy_value != NULL)
		vec->destroy_value(vec->array[pos].value);

	vec->array[pos].value = value;
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
testl %esi, %esi
js 0x476e
movq %rdi, %r14
cmpl %esi, 0x8(%rdi)
jle 0x476e
movq %rdx, %rbx
movq (%r14), %rax
movl %esi, %r15d
movq (%rax,%r15,8), %rdi
cmpq %rdx, %rdi
je 0x4764
movq 0x10(%r14), %rcx
testq %rcx, %rcx
je 0x4764
callq *%rcx
movq (%r14), %rax
movq %rbx, (%rax,%r15,8)
popq %rbx
popq %r14
popq %r15
retq
leaq 0x169a(%rip), %rdi      # 0x5e0f
leaq 0x16af(%rip), %rsi      # 0x5e2b
leaq 0x16f7(%rip), %rcx      # 0x5e7a
movl $0x3a, %edx
callq 0x2110
// File: /workspace/github_c_makefile_star2_O3/chatziko-k08[P]lecture-code/programs/cat/../../modules/UsingDynamicArray/ADTVector.c
// Function: vector_remove_last
void vector_remove_last(Vector vec) {
	assert(vec->size != 0);		// LCOV_EXCL_LINE

	// Αν υπάρχει συνάρτηση destroy_value, την καλούμε για το στοιχείο που αφαιρείται
	if (vec->destroy_value != NULL)
		vec->destroy_value(vec->array[vec->size - 1].value);

	// Αφαιρούμε στοιχείο οπότε ο πίνακας μικραίνει
	vec->size--;

	// Μικραίνουμε τον πίνακα αν χρειαστεί, ώστε να μην υπάρχει υπερβολική σπατάλη χώρου.
	// Για την πολυπλοκότητα είναι σημαντικό να μειώνουμε το μέγεθος στο μισό, και μόνο
	// αν το capacity είναι τετραπλάσιο του size (δηλαδή το 75% του πίνακα είναι άδειος).
	//
	if (vec->capacity > vec->size * 4 && vec->capacity > 2*VECTOR_MIN_CAPACITY) {
		vec->capacity /= 2;
		vec->array = realloc(vec->array, vec->capacity * sizeof(*vec->array));
	}
}

// Assembly:
pushq %rbx
movslq 0x8(%rdi), %rax
testq %rax, %rax
je 0x482d
movq %rdi, %rbx
movq 0x10(%rdi), %rcx
testq %rcx, %rcx
je 0x47f4
movq (%rbx), %rdx
movq -0x8(%rdx,%rax,8), %rdi
callq *%rcx
movl 0x8(%rbx), %eax
leal -0x1(%rax), %ecx
movl %ecx, 0x8(%rbx)
movl 0xc(%rbx), %ecx
leal -0x4(,%rax,4), %eax
cmpl %eax, %ecx
setle %al
cmpl $0x15, %ecx
setl %dl
orb %al, %dl
jne 0x482b
shrl %ecx
movl %ecx, 0xc(%rbx)
movq (%rbx), %rdi
leaq (,%rcx,8), %rsi
callq 0x21d0
movq %rax, (%rbx)
popq %rbx
retq
leaq 0x166f(%rip), %rdi      # 0x5ea3
leaq 0x15f0(%rip), %rsi      # 0x5e2b
leaq 0x1670(%rip), %rcx      # 0x5eb2
movl $0x52, %edx
callq 0x2110