LLM4Binary/decompile-bench-makefile huggingface dataset:
// File: /workspace/github_c_makefile_star2_O1/Tarsnap[P]kivaloo/liball/../lib/proto_s3/proto_s3_client.c
// Function: callback_range
static int
callback_range(void * cookie, uint8_t * buf, size_t buflen)
{
	struct get_cookie * C = cookie;
	int failed = 1;
	uint32_t status;
	uint32_t len;
	size_t lens = (size_t)(-1);
	uint8_t * dbuf = NULL;
	int rc;

	/* If we have a packet, parse it. */
	if (buf != NULL) {
		/* Do we have the right packet length? */
		if (buflen < 8)
			BAD("RANGE", "bogus length");

		/* Parse the packet. */
		status = be32dec(&buf[0]);
		len = be32dec(&buf[4]);

		/* Check status. */
		if ((status != 0) && ((status < 100) || (status > 599)))
			BAD("RANGE", "Invalid HTTP status");

		/* Do we have the right packet length? */
		if (len != (uint32_t)(-1)) {
			if (buflen != 8 + len)
				BAD("RANGE", "bogus length");
		} else {
			if (buflen != 8)
				BAD("RANGE", "bogus length");
		}

		/* Warn about HTTP 200 responses. */
		if (status == 200)
			BAD("RANGE", "HTTP 200 response");

		/* Did the operation succeed? */
		if (status == 206)
			failed = 0;

		/* Do we have data? */
		if ((failed == 0) && (len != (uint32_t)(-1))) {
			lens = len;
			dbuf = &buf[8];
		}
	}

failed:
	/* Invoke the upstream callback. */
	rc = (C->callback)(C->cookie, failed, lens, dbuf);

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

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x1, %ebp
movq $-0x1, %r14
testq %rsi, %rsi
je 0x4a1e
cmpq $0x7, %rdx
ja 0x4a23
leaq 0x5ad8(%rip), %rdi      # 0xa4e6
leaq 0x5b17(%rip), %rsi      # 0xa52c
leaq 0x5aeb(%rip), %rdx      # 0xa507
jmp 0x4a56
xorl %r15d, %r15d
jmp 0x4a6b
movl (%rsi), %eax
bswapl %eax
testl %eax, %eax
sete %cl
leal -0x258(%rax), %edi
cmpl $0xfffffe0c, %edi       # imm = 0xFFFFFE0C
setae %dil
orb %cl, %dil
jne 0x4a90
leaq 0x5a9e(%rip), %rdi      # 0xa4e6
leaq 0x5add(%rip), %rsi      # 0xa52c
leaq 0x5abe(%rip), %rdx      # 0xa514
xorl %r15d, %r15d
xorl %eax, %eax
callq 0x4233
callq 0x2090
movl $0x0, (%rax)
movq 0x8(%rbx), %rdi
movl %ebp, %esi
movq %r14, %rdx
movq %r15, %rcx
callq *(%rbx)
movl %eax, %ebp
movq %rbx, %rdi
callq 0x2040
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
movl 0x4(%rsi), %ecx
bswapl %ecx
cmpl $-0x1, %ecx
je 0x4aa8
leal 0x8(%rcx), %edi
cmpq %rdx, %rdi
jne 0x4a07
jmp 0x4ab2
cmpq $0x8, %rdx
jne 0x4a07
cmpl $0xc8, %eax
jne 0x4ad0
leaq 0x5a26(%rip), %rdi      # 0xa4e6
leaq 0x5a65(%rip), %rsi      # 0xa52c
leaq 0x5a64(%rip), %rdx      # 0xa532
jmp 0x4a56
xorl %r15d, %r15d
xorl %ebp, %ebp
cmpl $0xce, %eax
setne %bpl
jne 0x4a6b
cmpl $-0x1, %ecx
je 0x4a6b
movl %ecx, %r14d
addq $0x8, %rsi
xorl %ebp, %ebp
movq %rsi, %r15
jmp 0x4a6b
// File: /workspace/github_c_makefile_star2_O1/Tarsnap[P]kivaloo/liball/../lib/proto_s3/proto_s3_client.c
// Function: proto_s3_request_head
int
proto_s3_request_head(struct wire_requestqueue * Q, const char * bucket,
    const char * object,
    int (* callback)(void *, int, size_t), void * cookie)
{
	struct head_cookie * C;
	uint8_t *rbuf, *p;
	size_t rlen;

	/* Validate bucket and object name lengths. */
	if ((strlen(bucket) > 255) || (strlen(object) > 255)) {
		warn0("Bucket or object name is too long");
		goto err0;
	}

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

	/* Compute request packet size. */
	rlen = 6 + strlen(bucket) + strlen(object);

	/* Start writing a request. */
	if ((p = rbuf =
	    wire_requestqueue_add_getbuf(Q, rlen, callback_head, C)) == NULL)
		goto err1;

	/* Construct request. */
	be32enc(p, PROTO_S3_HEAD);
	p += 4;
	*p++ = (uint8_t)strlen(bucket);
	memcpy(p, bucket, strlen(bucket));
	p += strlen(bucket);
	*p++ = (uint8_t)strlen(object);
	memcpy(p, object, strlen(object));

	/* Finish writing request. */
	if (wire_requestqueue_add_done(Q, rbuf, rlen))
		goto err1;

	/* Success! */
	return (0);

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r8, 0x8(%rsp)
movq %rcx, %r12
movq %rdx, %rbp
movq %rsi, %r13
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x2110
cmpq $0xff, %rax
ja 0x4b38
movq %rax, %r14
movq %rbp, %rdi
callq 0x2110
cmpq $0x100, %rax            # imm = 0x100
jb 0x4b67
leaq 0x5936(%rip), %rdi      # 0xa475
xorl %eax, %eax
callq 0x4233
callq 0x2090
movl $0x0, (%rax)
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r15
movq %rbp, 0x18(%rsp)
movq %rbx, 0x20(%rsp)
movl $0x10, %edi
callq 0x2200
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x4b56
movq %r12, (%rax)
movq 0x8(%rsp), %rcx
movq %rcx, 0x8(%rax)
addq %r15, %r14
addq $0x6, %r14
leaq 0xb9(%rip), %rdx        # 0x4c5b
movq 0x20(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
movq %rax, 0x8(%rsp)
movq %rax, %rcx
callq 0x5295
testq %rax, %rax
je 0x4c45
movq %rax, %rbp
movl $0x20000100, (%rax)     # imm = 0x20000100
movq %r13, %rdi
callq 0x2110
movq %r14, 0x10(%rsp)
leaq 0x5(%rbp), %r14
movb %al, 0x4(%rbp)
movq %r13, %rdi
callq 0x2110
movq %r14, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x21e0
movq %r13, %rdi
callq 0x2110
movq %rax, %r14
movq 0x18(%rsp), %r13
movq %r13, %rdi
callq 0x2110
leaq (%r14,%rbp), %r15
addq $0x6, %r15
movb %al, 0x5(%rbp,%r14)
movq %r13, %rdi
callq 0x2110
movq %r15, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x21e0
movq %r12, %rdi
movq %rbp, %rsi
movq 0x10(%rsp), %rdx
callq 0x5571
testl %eax, %eax
je 0x4c54
movq 0x8(%rsp), %rdi
callq 0x2040
jmp 0x4b56
xorl %ebx, %ebx
jmp 0x4b56
// File: /workspace/github_c_makefile_star2_O1/Tarsnap[P]kivaloo/liball/../lib/proto_s3/proto_s3_client.c
// Function: callback_head
static int
callback_head(void * cookie, uint8_t * buf, size_t buflen)
{
	struct head_cookie * C = cookie;
	uint32_t status = 0;
	uint32_t len;
	size_t lens = (size_t)(-1);
	int rc;

	/* If we have a packet, parse it. */
	if (buf != NULL) {
		/* Do we have the right packet length? */
		if (buflen != 8)
			BAD("HEAD", "bogus length");

		/* Parse the packet. */
		status = be32dec(&buf[0]);
		len = be32dec(&buf[4]);

		/* Check status. */
		if ((status != 0) && ((status < 100) || (status > 599)))
			BAD("HEAD", "Invalid HTTP status");

		/* If status == 200 and len != -1, we have a length. */
		if ((status == 200) && (len != (uint32_t)(-1)))
			lens = len;
	}

failed:
	/* Invoke the upstream callback. */
	rc = (C->callback)(C->cookie, (int)status, lens);

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

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rdi, %rbx
movq $-0x1, %r14
testq %rsi, %rsi
je 0x4cae
cmpq $0x8, %rdx
jne 0x4cb3
movl (%rsi), %r15d
bswapl %r15d
testl %r15d, %r15d
sete %al
leal -0x258(%r15), %ecx
cmpl $0xfffffe0c, %ecx       # imm = 0xFFFFFE0C
setae %cl
orb %al, %cl
jne 0x4cdf
leaq 0x5848(%rip), %rdi      # 0xa4e6
leaq 0x589f(%rip), %rsi      # 0xa544
leaq 0x5868(%rip), %rdx      # 0xa514
jmp 0x4ccb
xorl %r15d, %r15d
jmp 0x4d01
leaq 0x582c(%rip), %rdi      # 0xa4e6
leaq 0x5883(%rip), %rsi      # 0xa544
leaq 0x583f(%rip), %rdx      # 0xa507
xorl %r15d, %r15d
xorl %eax, %eax
callq 0x4233
callq 0x2090
movl $0x0, (%rax)
jmp 0x4d01
movl 0x4(%rsi), %eax
bswapl %eax
movl $0xc8, %ecx
cmpl %ecx, %r15d
sete %dl
cmpl $-0x1, %eax
setne %sil
testb %sil, %dl
cmovneq %rax, %r14
cmovnel %ecx, %r15d
movq 0x8(%rbx), %rdi
movl %r15d, %esi
movq %r14, %rdx
callq *(%rbx)
movl %eax, %ebp
movq %rbx, %rdi
callq 0x2040
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/Tarsnap[P]kivaloo/liball/../lib/proto_s3/proto_s3_client.c
// Function: proto_s3_request_delete
int
proto_s3_request_delete(struct wire_requestqueue * Q, const char * bucket,
    const char * object, int (* callback)(void *, int), void * cookie)
{
	struct delete_cookie * C;
	uint8_t *rbuf, *p;
	size_t rlen;

	/* Validate bucket and object name lengths. */
	if ((strlen(bucket) > 255) || (strlen(object) > 255)) {
		warn0("Bucket or object name is too long");
		goto err0;
	}

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

	/* Compute request packet size. */
	rlen = 6 + strlen(bucket) + strlen(object);

	/* Start writing a request. */
	if ((p = rbuf =
	    wire_requestqueue_add_getbuf(Q, rlen, callback_delete, C)) == NULL)
		goto err1;

	/* Construct request. */
	be32enc(p, PROTO_S3_DELETE);
	p += 4;
	*p++ = (uint8_t)strlen(bucket);
	memcpy(p, bucket, strlen(bucket));
	p += strlen(bucket);
	*p++ = (uint8_t)strlen(object);
	memcpy(p, object, strlen(object));

	/* Finish writing request. */
	if (wire_requestqueue_add_done(Q, rbuf, rlen))
		goto err1;

	/* Success! */
	return (0);

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

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x28, %rsp
movq %r8, 0x8(%rsp)
movq %rcx, %r12
movq %rdx, %rbp
movq %rsi, %r13
movq %rdi, %rbx
movq %rsi, %rdi
callq 0x2110
cmpq $0xff, %rax
ja 0x4d66
movq %rax, %r14
movq %rbp, %rdi
callq 0x2110
cmpq $0x100, %rax            # imm = 0x100
jb 0x4d95
leaq 0x5708(%rip), %rdi      # 0xa475
xorl %eax, %eax
callq 0x4233
callq 0x2090
movl $0x0, (%rax)
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
movl %ebx, %eax
addq $0x28, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
movq %rax, %r15
movq %rbp, 0x18(%rsp)
movq %rbx, 0x20(%rsp)
movl $0x10, %edi
callq 0x2200
movl $0xffffffff, %ebx       # imm = 0xFFFFFFFF
testq %rax, %rax
je 0x4d84
movq %r12, (%rax)
movq 0x8(%rsp), %rcx
movq %rcx, 0x8(%rax)
addq %r15, %r14
addq $0x6, %r14
leaq 0xb9(%rip), %rdx        # 0x4e89
movq 0x20(%rsp), %r12
movq %r12, %rdi
movq %r14, %rsi
movq %rax, 0x8(%rsp)
movq %rax, %rcx
callq 0x5295
testq %rax, %rax
je 0x4e73
movq %rax, %rbp
movl $0x30000100, (%rax)     # imm = 0x30000100
movq %r13, %rdi
callq 0x2110
movq %r14, 0x10(%rsp)
leaq 0x5(%rbp), %r14
movb %al, 0x4(%rbp)
movq %r13, %rdi
callq 0x2110
movq %r14, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x21e0
movq %r13, %rdi
callq 0x2110
movq %rax, %r14
movq 0x18(%rsp), %r13
movq %r13, %rdi
callq 0x2110
leaq (%r14,%rbp), %r15
addq $0x6, %r15
movb %al, 0x5(%rbp,%r14)
movq %r13, %rdi
callq 0x2110
movq %r15, %rdi
movq %r13, %rsi
movq %rax, %rdx
callq 0x21e0
movq %r12, %rdi
movq %rbp, %rsi
movq 0x10(%rsp), %rdx
callq 0x5571
testl %eax, %eax
je 0x4e82
movq 0x8(%rsp), %rdi
callq 0x2040
jmp 0x4d84
xorl %ebx, %ebx
jmp 0x4d84
// File: /workspace/github_c_makefile_star2_O1/Tarsnap[P]kivaloo/liball/../lib/proto_s3/proto_s3_client.c
// Function: callback_delete
static int
callback_delete(void * cookie, uint8_t * buf, size_t buflen)
{
	struct delete_cookie * C = cookie;
	int failed = 1;
	uint32_t status;
	int rc;

	/* If we have a packet, parse it. */
	if (buf != NULL) {
		/* Do we have the right packet length? */
		if (buflen != 4)
			BAD("DELETE", "bogus length");

		/* Parse the packet. */
		status = be32dec(&buf[0]);

		/* Check status. */
		if ((status != 0) && ((status < 100) || (status > 599)))
			BAD("DELETE", "Invalid HTTP status");

		/* Did the operation succeed? */
		if (status == 204)
			failed = 0;
	}

failed:
	/* Invoke the upstream callback. */
	rc = (C->callback)(C->cookie, failed);

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

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

// Assembly:
pushq %rbp
pushq %rbx
pushq %rax
movq %rdi, %rbx
movl $0x1, %ebp
testq %rsi, %rsi
je 0x4f06
cmpq $0x4, %rdx
jne 0x4ed2
movl (%rsi), %eax
bswapl %eax
testl %eax, %eax
sete %cl
leal -0x258(%rax), %edx
cmpl $0xfffffe0c, %edx       # imm = 0xFFFFFE0C
setae %dl
orb %cl, %dl
jne 0x4efb
leaq 0x5624(%rip), %rdi      # 0xa4e6
leaq 0x5680(%rip), %rsi      # 0xa549
leaq 0x5644(%rip), %rdx      # 0xa514
jmp 0x4ee7
leaq 0x560d(%rip), %rdi      # 0xa4e6
leaq 0x5669(%rip), %rsi      # 0xa549
leaq 0x5620(%rip), %rdx      # 0xa507
xorl %eax, %eax
callq 0x4233
callq 0x2090
movl $0x0, (%rax)
jmp 0x4f06
xorl %ebp, %ebp
cmpl $0xcc, %eax
setne %bpl
movq 0x8(%rbx), %rdi
movl %ebp, %esi
callq *(%rbx)
movl %eax, %ebp
movq %rbx, %rdi
callq 0x2040
movl %ebp, %eax
addq $0x8, %rsp
popq %rbx
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/ohkimur[P]the-c-programming-language-2nd-edition-solutions/chapter_5/exercise_5_03/strcat.c
// Function: main
int main(void)
{
  char s[100] = "This is the first string";
  char t[] = ", this second string!";

  strcat_ptr(s, t);

  puts(s);

  return 0;
}

// Assembly:
subq $0x68, %rsp
leaq 0xec9(%rip), %rsi       # 0x2010
movq %rsp, %rax
movl $0xc, %ecx
movq %rax, %rdi
rep  movsq (%rsi), %es:(%rdi)
movl $0x0, 0x60(%rax)
cmpb $0x0, (%rax)
leaq 0x1(%rax), %rax
jne 0x115c
movaps 0xf14(%rip), %xmm0      # 0x2080
movups %xmm0, -0x1(%rax)
movabsq $0x21676e69727473, %rcx # imm = 0x21676E69727473
movq %rcx, 0xd(%rax)
movq %rsp, %rdi
callq 0x1030
xorl %eax, %eax
addq $0x68, %rsp
retq
// File: /workspace/github_c_makefile_star2_O1/ohkimur[P]the-c-programming-language-2nd-edition-solutions/chapter_5/exercise_5_03/strcat.c
// Function: strcat_ptr
void strcat_ptr(char *s, char *t)
{
  // Find the end of s
  while (*s)
      ++s;

  // copy t to the end of s
  while (*s++ = *t++)
    ;
}

// Assembly:
cmpb $0x0, (%rdi)
leaq 0x1(%rdi), %rdi
jne 0x118d
xorl %eax, %eax
movb (%rsi,%rax), %cl
movb %cl, -0x1(%rdi,%rax)
incq %rax
testb %cl, %cl
jne 0x1198
retq
// File: /workspace/github_c_makefile_star2_O1/pipde[P]deos-songlib/utils/dcshift/dcshift.c
// Function: writeCommentOut
void writeCommentOut(FILE *in, FILE *out)
    {
    int ch;

    while((ch = fgetc(in)) && (ch != EOF) && ch != '\n')
        {
        fprintf(out,"%c",ch);

        continue;
        }
    fprintf(out,"\n");      
    }

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movq %rsi, %rbx
movq %rdi, %r14
movl $0x803, %r15d           # imm = 0x803
movq %r14, %rdi
callq 0x10e0
leal 0x1(%rax), %ecx
cmpl $0xb, %ecx
ja 0x1668
btl %ecx, %r15d
jb 0x1674
movl %eax, %edi
movq %rbx, %rsi
callq 0x1100
jmp 0x1652
movl $0xa, %edi
movq %rbx, %rsi
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
jmp 0x1100
// File: /workspace/github_c_makefile_star2_O1/CSerxzm[P]WindowstoLinuxInterface/src/MD.c
// Function: main
int main(int argc, char* argv[]){
    char lines[argc+1][255];
    predealLine(argc, argv, lines);
    if(strcmp(lines[0],"MD")==0||strcmp(lines[0],"md")==0){
        for(int i=1;i<argc;i++){
            if(access(lines[i],R_OK)){
                char cm[255]="./";
                strcat(cm, lines[i]);
                mkdir(lines[i],S_IRWXU|S_IRGRP|S_IROTH);
            }
            else{
                printf("%s", lines[0]);
                printf("不能创建文件夹: %s :\n", lines[i]);
                printf("文件已经存在或权限不允许!\n");
            }
        }
    }
    else{
        printf("%s: ", lines[0]);
        printf("error\n");
    }

    return 0;
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movl %edi, %r14d
leal 0x1(%r14), %eax
movq %rax, %rcx
shlq $0x8, %rcx
subq %rax, %rcx
addq $0xf, %rcx
movabsq $0x1fffffffff0, %rax    # imm = 0x1FFFFFFFFF0
andq %rcx, %rax
movq %rsp, %rbx
subq %rax, %rbx
movq %rbx, %rsp
movq %rbx, %rdx
callq 0x11ac
leaq 0xd13(%rip), %rsi       # 0x2004
movq %rbx, %rdi
callq 0x1070
testl %eax, %eax
je 0x132f
leaq 0xd03(%rip), %rsi       # 0x2007
movq %rbx, %rdi
callq 0x1070
testl %eax, %eax
je 0x132f
leaq 0xd13(%rip), %rdi       # 0x202a
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1060
leaq 0xd07(%rip), %rdi       # 0x202f
callq 0x1040
jmp 0x13a9
cmpl $0x2, %r14d
jl 0x13a9
movl %r14d, %eax
movq %rax, %r14
shlq $0x8, %r14
subq %rax, %r14
movl $0xff, %r15d
leaq 0xce6(%rip), %r12       # 0x2035
leaq (%rbx,%r15), %r13
movq %r13, %rdi
movl $0x4, %esi
callq 0x1080
testl %eax, %eax
je 0x1373
movq %r13, %rdi
movl $0x1e4, %esi            # imm = 0x1E4
callq 0x1030
jmp 0x139d
leaq 0xc90(%rip), %rdi       # 0x200a
movq %rbx, %rsi
xorl %eax, %eax
callq 0x1060
leaq 0xc82(%rip), %rdi       # 0x200d
movq %r13, %rsi
xorl %eax, %eax
callq 0x1060
movq %r12, %rdi
callq 0x1040
addq $0xff, %r15
cmpq %r15, %r14
jne 0x134f
xorl %eax, %eax
leaq -0x28(%rbp), %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/zecoxao[P]ps3_decrypt_tools/lib/aes.c
// Function: aes_crypt_cbc
int aes_crypt_cbc(aes_context *ctx,
        int mode,
        size_t length,
        unsigned char iv[16],
        const unsigned char *input,
        unsigned char *output) {
    int i;
    unsigned char temp[16];

    if (length % 16)
        return ( POLARSSL_ERR_AES_INVALID_INPUT_LENGTH);

    if (mode == AES_DECRYPT) {
        while (length > 0) {
            memcpy(temp, input, 16);
            aes_crypt_ecb(ctx, mode, input, output);

            for (i = 0; i < 16; i++)
                output[i] = (unsigned char) (output[i] ^ iv[i]);

            memcpy(iv, temp, 16);

            input += 16;
            output += 16;
            length -= 16;
        }
    } else {
        while (length > 0) {
            for (i = 0; i < 16; i++)
                output[i] = (unsigned char) (input[i] ^ iv[i]);

            aes_crypt_ecb(ctx, mode, output, output);
            memcpy(iv, output, 16);

            input += 16;
            output += 16;
            length -= 16;
        }
    }

    return ( 0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdx, %r12
movl $0xffffffde, %eax       # imm = 0xFFFFFFDE
testb $0xf, %r12b
jne 0x1f6d
movq %r9, %rbx
movq %r8, %r14
movq %rcx, %r15
movl %esi, %ebp
movq %rdi, %r13
testl %esi, %esi
je 0x1f26
testq %r12, %r12
je 0x1f6b
xorl %eax, %eax
movb (%r15,%rax), %cl
xorb (%r14,%rax), %cl
movb %cl, (%rbx,%rax)
incq %rax
cmpq $0x10, %rax
jne 0x1eeb
movq %r13, %rdi
movl %ebp, %esi
movq %rbx, %rdx
movq %rbx, %rcx
callq 0x16d7
movups (%rbx), %xmm0
movups %xmm0, (%r15)
addq $0x10, %r14
addq $0x10, %rbx
addq $-0x10, %r12
jne 0x1ee9
jmp 0x1f6b
testq %r12, %r12
je 0x1f6b
movups (%r14), %xmm0
movaps %xmm0, (%rsp)
movq %r13, %rdi
movl %ebp, %esi
movq %r14, %rdx
movq %rbx, %rcx
callq 0x16d7
xorl %eax, %eax
movb (%r15,%rax), %cl
xorb %cl, (%rbx,%rax)
incq %rax
cmpq $0x10, %rax
jne 0x1f45
movaps (%rsp), %xmm0
movups %xmm0, (%r15)
addq $0x10, %r14
addq $0x10, %rbx
addq $-0x10, %r12
jne 0x1f2b
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/zecoxao[P]ps3_decrypt_tools/lib/aes.c
// Function: aes_crypt_ctr
int aes_crypt_ctr(aes_context *ctx,
        size_t length,
        size_t *nc_off,
        unsigned char nonce_counter[16],
        unsigned char stream_block[16],
        const unsigned char *input,
        unsigned char *output) {
    int c, i, cb;
    size_t n = *nc_off;

    while (length--) {
        if (n == 0) {
            aes_crypt_ecb(ctx, AES_ENCRYPT, nonce_counter, stream_block);

            i = 15;
            do {
                nonce_counter[i]++;
                cb = nonce_counter[i] == 0;
            } while (i-- && cb);

        }
        c = *input++;
        *output++ = (unsigned char) (c ^ stream_block[n]);

        n = (n + 1) & 0x0F;
    }

    *nc_off = n;

    return ( 0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movq %rdi, 0x10(%rsp)
movq %rdx, 0x8(%rsp)
movq (%rdx), %rbx
testq %rsi, %rsi
je 0x1ffa
movq %r9, %r14
movq %r8, %r15
movq %rcx, %r12
movq %rsi, %r13
movq 0x50(%rsp), %rbp
testq %rbx, %rbx
jne 0x1fdd
movq 0x10(%rsp), %rdi
movl $0x1, %esi
movq %r12, %rdx
movq %r15, %rcx
callq 0x16d7
movl $0xf, %eax
incb (%r12,%rax)
sete %cl
addq $-0x1, %rax
jae 0x1fdd
testb %cl, %cl
jne 0x1fcc
decq %r13
movb (%r15,%rbx), %al
xorb (%r14), %al
incq %r14
movb %al, (%rbp)
incq %rbp
incl %ebx
andl $0xf, %ebx
testq %r13, %r13
jne 0x1fad
movq 0x8(%rsp), %rax
movq %rbx, (%rax)
xorl %eax, %eax
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O1/zecoxao[P]ps3_decrypt_tools/lib/sha1.c
// Function: sha1_starts
void sha1_starts(sha1_context *ctx) {
    ctx->total[0] = 0;
    ctx->total[1] = 0;

    ctx->state[0] = 0x67452301;
    ctx->state[1] = 0xEFCDAB89;
    ctx->state[2] = 0x98BADCFE;
    ctx->state[3] = 0x10325476;
    ctx->state[4] = 0xC3D2E1F0;
}

// Assembly:
xorps %xmm0, %xmm0
movups %xmm0, (%rdi)
movq $0x67452301, 0x10(%rdi) # imm = 0x67452301
movl $0x98badcfe, %eax       # imm = 0x98BADCFE
leaq 0x5712ce8b(%rax), %rcx
movq %rcx, 0x18(%rdi)
movq %rax, 0x20(%rdi)
movq $0x10325476, 0x28(%rdi) # imm = 0x10325476
addq $0x2b1804f2, %rax       # imm = 0x2B1804F2
movq %rax, 0x30(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O1/zecoxao[P]ps3_decrypt_tools/lib/sha1.c
// Function: sha1_update
void sha1_update(sha1_context *ctx, const unsigned char *input, size_t ilen) {
    size_t fill;
    unsigned long left;

    if (ilen <= 0)
        return;

    left = ctx->total[0] & 0x3F;
    fill = 64 - left;

    ctx->total[0] += (unsigned long) ilen;
    ctx->total[0] &= 0xFFFFFFFF;

    if (ctx->total[0] < (unsigned long) ilen)
        ctx->total[1]++;

    if (left && ilen >= fill) {
        memcpy((void *) (ctx->buffer + left),
                (void *) input, fill);
        sha1_process(ctx, ctx->buffer);
        input += fill;
        ilen -= fill;
        left = 0;
    }

    while (ilen >= 64) {
        sha1_process(ctx, input);
        input += 64;
        ilen -= 64;
    }

    if (ilen > 0) {
        memcpy((void *) (ctx->buffer + left),
                (void *) input, ilen);
    }
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
testq %rdx, %rdx
je 0x2108
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
movq (%rdi), %r13
leal (%rdx,%r13), %eax
andl $0x3f, %r13d
movq %rax, (%rdi)
cmpq %rdx, %rax
jae 0x207d
incq 0x8(%r14)
testq %r13, %r13
je 0x20c0
movl $0x40, %r12d
subq %r13, %r12
movq %r15, %rbp
subq %r12, %rbp
jb 0x20c3
leaq 0x38(%r14), %r15
leaq (%r14,%r13), %rdi
addq $0x38, %rdi
movq %rbx, %rsi
movq %r12, %rdx
callq 0x10f0
movq %r14, %rdi
movq %r15, %rsi
callq 0x2117
addq %r12, %rbx
xorl %r13d, %r13d
movq %rbp, %r15
jmp 0x20c3
xorl %r13d, %r13d
cmpq $0x40, %r15
jb 0x20e2
movq %r14, %rdi
movq %rbx, %rsi
callq 0x2117
addq $0x40, %rbx
addq $-0x40, %r15
cmpq $0x3f, %r15
ja 0x20c9
testq %r15, %r15
je 0x2108
leaq (%r14,%r13), %rdi
addq $0x38, %rdi
movq %rbx, %rsi
movq %r15, %rdx
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x10f0
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/zecoxao[P]ps3_decrypt_tools/lib/sha1.c
// Function: sha1_finish
void sha1_finish(sha1_context *ctx, unsigned char output[20]) {
    unsigned long last, padn;
    unsigned long high, low;
    unsigned char msglen[8];

    high = (ctx->total[0] >> 29)
            | (ctx->total[1] << 3);
    low = (ctx->total[0] << 3);

    PUT_ULONG_BE(high, msglen, 0);
    PUT_ULONG_BE(low, msglen, 4);

    last = ctx->total[0] & 0x3F;
    padn = (last < 56) ? (56 - last) : (120 - last);

    sha1_update(ctx, (unsigned char *) sha1_padding, padn);
    sha1_update(ctx, msglen, 8);

    PUT_ULONG_BE(ctx->state[0], output, 0);
    PUT_ULONG_BE(ctx->state[1], output, 4);
    PUT_ULONG_BE(ctx->state[2], output, 8);
    PUT_ULONG_BE(ctx->state[3], output, 12);
    PUT_ULONG_BE(ctx->state[4], output, 16);
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x10, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq (%rdi), %rax
movq 0x8(%rdi), %rcx
movq %rax, %rdx
shrq $0x1d, %rdx
shlq $0x3, %rcx
orq %rdx, %rcx
leal (,%rax,8), %edx
movl %ecx, %esi
shrl $0x18, %esi
leaq 0x8(%rsp), %r15
movb %sil, (%r15)
movl %ecx, %esi
shrl $0x10, %esi
movb %sil, 0x1(%r15)
movb %ch, 0xa(%rsp)
movb %cl, 0x3(%r15)
movl %eax, %ecx
shrl $0x15, %ecx
movb %cl, 0x4(%r15)
movl %eax, %ecx
shrl $0xd, %ecx
movb %cl, 0x5(%r15)
movl %eax, %ecx
shrl $0x5, %ecx
movb %cl, 0x6(%r15)
movb %dl, 0x7(%r15)
andl $0x3f, %eax
xorl %edx, %edx
cmpq $0x38, %rax
setae %dl
shll $0x6, %edx
orq $0x38, %rdx
subq %rax, %rdx
leaq 0x8543(%rip), %rsi      # 0xc280
callq 0x2049
movl $0x8, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2049
movb 0x13(%r14), %al
movb %al, (%rbx)
movb 0x12(%r14), %al
movb %al, 0x1(%rbx)
movb 0x11(%r14), %al
movb %al, 0x2(%rbx)
movb 0x10(%r14), %al
movb %al, 0x3(%rbx)
movb 0x1b(%r14), %al
movb %al, 0x4(%rbx)
movb 0x1a(%r14), %al
movb %al, 0x5(%rbx)
movb 0x19(%r14), %al
movb %al, 0x6(%rbx)
movb 0x18(%r14), %al
movb %al, 0x7(%rbx)
movb 0x23(%r14), %al
movb %al, 0x8(%rbx)
movb 0x22(%r14), %al
movb %al, 0x9(%rbx)
movb 0x21(%r14), %al
movb %al, 0xa(%rbx)
movb 0x20(%r14), %al
movb %al, 0xb(%rbx)
movb 0x2b(%r14), %al
movb %al, 0xc(%rbx)
movb 0x2a(%r14), %al
movb %al, 0xd(%rbx)
movb 0x29(%r14), %al
movb %al, 0xe(%rbx)
movb 0x28(%r14), %al
movb %al, 0xf(%rbx)
movb 0x33(%r14), %al
movb %al, 0x10(%rbx)
movb 0x32(%r14), %al
movb %al, 0x11(%rbx)
movb 0x31(%r14), %al
movb %al, 0x12(%rbx)
movb 0x30(%r14), %al
movb %al, 0x13(%rbx)
addq $0x10, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/zecoxao[P]ps3_decrypt_tools/lib/sha1.c
// Function: sha1
void sha1(const unsigned char *input, size_t ilen, unsigned char output[20]) {
    sha1_context ctx;

    sha1_starts(&ctx);
    sha1_update(&ctx, input, ilen);
    sha1_finish(&ctx, output);

    memset(&ctx, 0, sizeof ( sha1_context));
}

// Assembly:
pushq %r14
pushq %rbx
subq $0xf8, %rsp
movq %rdx, %rbx
movq %rsi, %rdx
movq %rdi, %rsi
xorps %xmm0, %xmm0
movq %rsp, %r14
movaps %xmm0, (%r14)
movq $0x67452301, 0x10(%r14) # imm = 0x67452301
movl $0x98badcfe, %eax       # imm = 0x98BADCFE
leaq 0x5712ce8b(%rax), %rcx
movq %rcx, 0x18(%r14)
movq %rax, 0x20(%r14)
movq $0x10325476, 0x28(%r14) # imm = 0x10325476
addq $0x2b1804f2, %rax       # imm = 0x2B1804F2
movq %rax, 0x30(%r14)
movq %r14, %rdi
callq 0x2049
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3cb8
movl $0xf8, %edx
movq %r14, %rdi
xorl %esi, %esi
callq 0x10a0
addq $0xf8, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/zecoxao[P]ps3_decrypt_tools/lib/sha1.c
// Function: sha1_hmac_starts
void sha1_hmac_starts(sha1_context *ctx, const unsigned char *key, size_t keylen) {
    size_t i;
    unsigned char sum[20];

    if (keylen > 64) {
        sha1(key, keylen, sum);
        keylen = 20;
        key = sum;
    }

    memset(ctx->ipad, 0x36, 64);
    memset(ctx->opad, 0x5C, 64);

    for (i = 0; i < keylen; i++) {
        ctx->ipad[i] = (unsigned char) (ctx->ipad[i] ^ key[i]);
        ctx->opad[i] = (unsigned char) (ctx->opad[i] ^ key[i]);
    }

    sha1_starts(ctx);
    sha1_update(ctx, ctx->ipad, 64);

    memset(sum, 0, sizeof ( sum));
}

// Assembly:
pushq %r14
pushq %rbx
subq $0x18, %rsp
movq %rsi, %rax
movq %rdi, %rbx
cmpq $0x41, %rdx
jb 0x3e8b
movq %rsp, %r14
movq %rax, %rdi
movq %rdx, %rsi
movq %r14, %rdx
callq 0x3de7
movl $0x14, %edx
movq %r14, %rax
leaq 0x78(%rbx), %rsi
movaps 0x83ca(%rip), %xmm0     # 0xc260
movups %xmm0, 0xa8(%rbx)
movups %xmm0, 0x98(%rbx)
movups %xmm0, 0x88(%rbx)
movups %xmm0, 0x78(%rbx)
movaps 0x83ba(%rip), %xmm0     # 0xc270
movups %xmm0, 0xb8(%rbx)
movups %xmm0, 0xc8(%rbx)
movups %xmm0, 0xd8(%rbx)
movups %xmm0, 0xe8(%rbx)
testq %rdx, %rdx
je 0x3ef9
leaq 0xb8(%rbx), %rcx
xorl %edi, %edi
movb (%rax,%rdi), %r8b
xorb %r8b, -0x40(%rcx,%rdi)
movb (%rax,%rdi), %r8b
xorb %r8b, (%rcx,%rdi)
incq %rdi
cmpq %rdi, %rdx
jne 0x3ee0
xorps %xmm0, %xmm0
movups %xmm0, (%rbx)
movq $0x67452301, 0x10(%rbx) # imm = 0x67452301
movl $0x98badcfe, %eax       # imm = 0x98BADCFE
leaq 0x5712ce8b(%rax), %rcx
movq %rcx, 0x18(%rbx)
movq %rax, 0x20(%rbx)
movq $0x10325476, 0x28(%rbx) # imm = 0x10325476
addq $0x2b1804f2, %rax       # imm = 0x2B1804F2
movq %rax, 0x30(%rbx)
movl $0x40, %edx
movq %rbx, %rdi
callq 0x2049
addq $0x18, %rsp
popq %rbx
popq %r14
retq
// File: /workspace/github_c_makefile_star2_O1/zecoxao[P]ps3_decrypt_tools/lib/sha1.c
// Function: sha1_hmac_finish
void sha1_hmac_finish(sha1_context *ctx, unsigned char output[20]) {
    unsigned char tmpbuf[20];

    sha1_finish(ctx, tmpbuf);
    sha1_starts(ctx);
    sha1_update(ctx, ctx->opad, 64);
    sha1_update(ctx, tmpbuf, 20);
    sha1_finish(ctx, output);

    memset(tmpbuf, 0, sizeof ( tmpbuf));
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
subq $0x20, %rsp
movq %rsi, %rbx
movq %rdi, %r14
movq %rsp, %r15
movq %r15, %rsi
callq 0x3cb8
xorps %xmm0, %xmm0
movups %xmm0, (%r14)
movq $0x67452301, 0x10(%r14) # imm = 0x67452301
movl $0x98badcfe, %eax       # imm = 0x98BADCFE
leaq 0x5712ce8b(%rax), %rcx
movq %rcx, 0x18(%r14)
movq %rax, 0x20(%r14)
movq $0x10325476, 0x28(%r14) # imm = 0x10325476
addq $0x2b1804f2, %rax       # imm = 0x2B1804F2
movq %rax, 0x30(%r14)
leaq 0xb8(%r14), %rsi
movl $0x40, %edx
movq %r14, %rdi
callq 0x2049
movl $0x14, %edx
movq %r14, %rdi
movq %r15, %rsi
callq 0x2049
movq %r14, %rdi
movq %rbx, %rsi
callq 0x3cb8
addq $0x20, %rsp
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/zecoxao[P]ps3_decrypt_tools/lib/sha1.c
// Function: sha1_hmac
void sha1_hmac(const unsigned char *key, size_t keylen,
        const unsigned char *input, size_t ilen,
        unsigned char output[20]) {
    sha1_context ctx;

    sha1_hmac_starts(&ctx, key, keylen);
    sha1_hmac_update(&ctx, input, ilen);
    sha1_hmac_finish(&ctx, output);

    memset(&ctx, 0, sizeof ( sha1_context));
}

// Assembly:
pushq %r15
pushq %r14
pushq %r12
pushq %rbx
subq $0xf8, %rsp
movq %r8, %rbx
movq %rcx, %r14
movq %rdx, %r15
movq %rsi, %rdx
movq %rdi, %rsi
movq %rsp, %r12
movq %r12, %rdi
callq 0x3e5f
movq %r12, %rdi
movq %r15, %rsi
movq %r14, %rdx
callq 0x2049
movq %r12, %rdi
movq %rbx, %rsi
callq 0x3f47
movl $0xf8, %edx
movq %r12, %rdi
xorl %esi, %esi
callq 0x10a0
addq $0xf8, %rsp
popq %rbx
popq %r12
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/zecoxao[P]ps3_decrypt_tools/lib/des.c
// Function: des_setkey_dec
int des_setkey_dec(des_context *ctx, const unsigned char key[DES_KEY_SIZE]) {
    int i;

    des_setkey(ctx->sk, key);

    for (i = 0; i < 16; i += 2) {
        SWAP(ctx->sk[i ], ctx->sk[30 - i]);
        SWAP(ctx->sk[i + 1], ctx->sk[31 - i]);
    }

    return ( 0);
}

// Assembly:
pushq %rbx
movq %rdi, %rbx
addq $0x4, %rdi
callq 0x40ec
leaq 0x80(%rbx), %rax
movq $-0x2, %rcx
movl 0xc(%rbx,%rcx,4), %edx
movl -0x4(%rax), %esi
movl %esi, 0xc(%rbx,%rcx,4)
movl %edx, -0x4(%rax)
movl 0x10(%rbx,%rcx,4), %edx
movl (%rax), %esi
movl %esi, 0x10(%rbx,%rcx,4)
movl %edx, (%rax)
addq $0x2, %rcx
addq $-0x8, %rax
cmpq $0xe, %rcx
jb 0x4580
xorl %eax, %eax
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/zecoxao[P]ps3_decrypt_tools/lib/des.c
// Function: des3_set2key_enc
int des3_set2key_enc(des3_context *ctx, const unsigned char key[DES_KEY_SIZE * 2]) {
    uint32_t sk[96];

    des3_set2key(ctx->sk, sk, key);
    memset(sk, 0, sizeof ( sk));

    return ( 0);
}

// Assembly:
pushq %rbx
subq $0x180, %rsp            # imm = 0x180
movq %rsi, %rdx
addq $0x4, %rdi
movq %rsp, %rbx
movq %rbx, %rsi
callq 0x45e0
movl $0x180, %edx            # imm = 0x180
movq %rbx, %rdi
xorl %esi, %esi
callq 0x10a0
xorl %eax, %eax
addq $0x180, %rsp            # imm = 0x180
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/zecoxao[P]ps3_decrypt_tools/lib/des.c
// Function: des3_set2key
static void des3_set2key(uint32_t esk[96],
        uint32_t dsk[96],
        const unsigned char key[DES_KEY_SIZE * 2]) {
    int i;

    des_setkey(esk, key);
    des_setkey(dsk + 32, key + 8);

    for (i = 0; i < 32; i += 2) {
        dsk[i ] = esk[30 - i];
        dsk[i + 1] = esk[31 - i];

        esk[i + 32] = dsk[62 - i];
        esk[i + 33] = dsk[63 - i];

        esk[i + 64] = esk[i ];
        esk[i + 65] = esk[i + 1];

        dsk[i + 64] = dsk[i ];
        dsk[i + 65] = dsk[i + 1];
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
movq %rdx, %rsi
callq 0x40ec
leaq 0x80(%rbx), %rdi
addq $0x8, %r15
movq %r15, %rsi
callq 0x40ec
movl $0x41, %ecx
movl $0x3f, %eax
movl -0x84(%r14,%rax,4), %edx
movl %edx, -0x104(%rbx,%rcx,4)
movl -0x80(%r14,%rax,4), %edx
movl %edx, -0x100(%rbx,%rcx,4)
movl -0x4(%rbx,%rax,4), %edx
movl %edx, -0x84(%r14,%rcx,4)
movl (%rbx,%rax,4), %edx
movl %edx, -0x80(%r14,%rcx,4)
movq -0x104(%r14,%rcx,4), %rdx
movq %rdx, -0x4(%r14,%rcx,4)
movq -0x104(%rbx,%rcx,4), %rdx
movq %rdx, -0x4(%rbx,%rcx,4)
leaq 0x2(%rcx), %rdx
addq $-0x41, %rcx
addq $-0x2, %rax
cmpq $0x1e, %rcx
movq %rdx, %rcx
jb 0x4613
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/zecoxao[P]ps3_decrypt_tools/lib/des.c
// Function: des3_set2key_dec
int des3_set2key_dec(des3_context *ctx, const unsigned char key[DES_KEY_SIZE * 2]) {
    uint32_t sk[96];

    des3_set2key(sk, ctx->sk, key);
    memset(sk, 0, sizeof ( sk));

    return ( 0);
}

// Assembly:
pushq %rbx
subq $0x180, %rsp            # imm = 0x180
movq %rsi, %rdx
leaq 0x4(%rdi), %rsi
movq %rsp, %rbx
movq %rbx, %rdi
callq 0x45e0
movl $0x180, %edx            # imm = 0x180
movq %rbx, %rdi
xorl %esi, %esi
callq 0x10a0
xorl %eax, %eax
addq $0x180, %rsp            # imm = 0x180
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/zecoxao[P]ps3_decrypt_tools/lib/des.c
// Function: des3_set3key_enc
int des3_set3key_enc(des3_context *ctx, const unsigned char key[DES_KEY_SIZE * 3]) {
    uint32_t sk[96];

    des3_set3key(ctx->sk, sk, key);
    memset(sk, 0, sizeof ( sk));

    return ( 0);
}

// Assembly:
pushq %rbx
subq $0x180, %rsp            # imm = 0x180
movq %rsi, %rdx
addq $0x4, %rdi
movq %rsp, %rbx
movq %rbx, %rsi
callq 0x46df
movl $0x180, %edx            # imm = 0x180
movq %rbx, %rdi
xorl %esi, %esi
callq 0x10a0
xorl %eax, %eax
addq $0x180, %rsp            # imm = 0x180
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/zecoxao[P]ps3_decrypt_tools/lib/des.c
// Function: des3_set3key
static void des3_set3key(uint32_t esk[96],
        uint32_t dsk[96],
        const unsigned char key[24]) {
    int i;

    des_setkey(esk, key);
    des_setkey(dsk + 32, key + 8);
    des_setkey(esk + 64, key + 16);

    for (i = 0; i < 32; i += 2) {
        dsk[i ] = esk[94 - i];
        dsk[i + 1] = esk[95 - i];

        esk[i + 32] = dsk[62 - i];
        esk[i + 33] = dsk[63 - i];

        dsk[i + 64] = esk[30 - i];
        dsk[i + 65] = esk[31 - i];
    }
}

// Assembly:
pushq %r15
pushq %r14
pushq %rbx
movq %rdx, %r15
movq %rsi, %rbx
movq %rdi, %r14
movq %rdx, %rsi
callq 0x40ec
leaq 0x80(%rbx), %rdi
leaq 0x8(%r15), %rsi
callq 0x40ec
leaq 0x100(%r14), %rdi
addq $0x10, %r15
movq %r15, %rsi
callq 0x40ec
movq $-0x2, %rax
movl $0x3e, %ecx
movl 0x80(%r14,%rcx,4), %edx
movl %edx, 0x8(%rbx,%rax,4)
movl 0x84(%r14,%rcx,4), %edx
movl %edx, 0xc(%rbx,%rax,4)
movl (%rbx,%rcx,4), %edx
movl %edx, 0x88(%r14,%rax,4)
movl 0x4(%rbx,%rcx,4), %edx
movl %edx, 0x8c(%r14,%rax,4)
movl -0x80(%r14,%rcx,4), %edx
movl %edx, 0x108(%rbx,%rax,4)
movl -0x7c(%r14,%rcx,4), %edx
movl %edx, 0x10c(%rbx,%rax,4)
addq $0x2, %rax
addq $-0x2, %rcx
cmpq $0x1e, %rax
jb 0x4724
popq %rbx
popq %r14
popq %r15
retq
// File: /workspace/github_c_makefile_star2_O1/zecoxao[P]ps3_decrypt_tools/lib/des.c
// Function: des3_set3key_dec
int des3_set3key_dec(des3_context *ctx, const unsigned char key[DES_KEY_SIZE * 3]) {
    uint32_t sk[96];

    des3_set3key(sk, ctx->sk, key);
    memset(sk, 0, sizeof ( sk));

    return ( 0);
}

// Assembly:
pushq %rbx
subq $0x180, %rsp            # imm = 0x180
movq %rsi, %rdx
leaq 0x4(%rdi), %rsi
movq %rsp, %rbx
movq %rbx, %rdi
callq 0x46df
movl $0x180, %edx            # imm = 0x180
movq %rbx, %rdi
xorl %esi, %esi
callq 0x10a0
xorl %eax, %eax
addq $0x180, %rsp            # imm = 0x180
popq %rbx
retq
// File: /workspace/github_c_makefile_star2_O1/zecoxao[P]ps3_decrypt_tools/lib/des.c
// Function: des_crypt_cbc
int des_crypt_cbc(des_context *ctx,
        int mode,
        size_t length,
        unsigned char iv[8],
        const unsigned char *input,
        unsigned char *output) {
    int i;
    unsigned char temp[8];

    if (length % 8)
        return ( POLARSSL_ERR_DES_INVALID_INPUT_LENGTH);

    if (mode == DES_ENCRYPT) {
        while (length > 0) {
            for (i = 0; i < 8; i++)
                output[i] = (unsigned char) (input[i] ^ iv[i]);

            des_crypt_ecb(ctx, output, output);
            memcpy(iv, output, 8);

            input += 8;
            output += 8;
            length -= 8;
        }
    } else /* DES_DECRYPT */ {
        while (length > 0) {
            memcpy(temp, input, 8);
            des_crypt_ecb(ctx, input, output);

            for (i = 0; i < 8; i++)
                output[i] = (unsigned char) (output[i] ^ iv[i]);

            memcpy(iv, temp, 8);

            input += 8;
            output += 8;
            length -= 8;
        }
    }

    return ( 0);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
pushq %rax
movq %rdx, %r12
movl $0xffffffce, %eax       # imm = 0xFFFFFFCE
testb $0x7, %r12b
jne 0x4aa3
movq %r9, %rbx
movq %r8, %r14
movq %rcx, %r15
movq %rdi, %r13
cmpl $0x1, %esi
jne 0x4a68
testq %r12, %r12
je 0x4aa1
xorl %eax, %eax
movb (%r15,%rax), %cl
xorb (%r14,%rax), %cl
movb %cl, (%rbx,%rax)
incq %rax
cmpq $0x8, %rax
jne 0x4a30
movq %r13, %rdi
movq %rbx, %rsi
movq %rbx, %rdx
callq 0x47b3
movq (%rbx), %rax
movq %rax, (%r15)
addq $0x8, %r14
addq $0x8, %rbx
addq $-0x8, %r12
jne 0x4a2e
jmp 0x4aa1
testq %r12, %r12
je 0x4aa1
movq (%r14), %rbp
movq %r13, %rdi
movq %r14, %rsi
movq %rbx, %rdx
callq 0x47b3
xorl %eax, %eax
movb (%r15,%rax), %cl
xorb %cl, (%rbx,%rax)
incq %rax
cmpq $0x8, %rax
jne 0x4a80
movq %rbp, (%r15)
addq $0x8, %r14
addq $0x8, %rbx
addq $-0x8, %r12
jne 0x4a6d
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/zecoxao[P]ps3_decrypt_tools/lib/aes_omac.c
// Function: gf_mul
void _gf_mul(unsigned char *pad) {
    unsigned int i;
    unsigned cxor = (pad[0] & 0x80) ? 0x87 : 0;

    for (i = 0; i < 15; i++)
        pad[i] = (pad[i] << 1) | (pad[i + 1] >> 7);
    pad[15] = (pad[15] << 1) ^ cxor;
}

// Assembly:
movb (%rdi), %al
xorl %ecx, %ecx
movb (%rdi,%rcx), %dl
movb 0x1(%rdi,%rcx), %sil
shrb $0x7, %sil
addb %dl, %dl
orb %sil, %dl
movb %dl, (%rdi,%rcx)
leaq 0x1(%rcx), %rdx
movq %rdx, %rcx
cmpq $0xf, %rdx
jne 0x501c
sarb $0x7, %al
andb $-0x79, %al
movb 0xf(%rdi), %cl
addb %cl, %cl
xorb %al, %cl
movb %cl, 0xf(%rdi)
retq
// File: /workspace/github_c_makefile_star2_O1/zecoxao[P]ps3_decrypt_tools/lib/kgen.c
// Function: generate_ata_keys
void generate_ata_keys(u8 *eid_root_key, u8 *eid_root_iv, u8 *data_key_dst, u8 *tweak_key_dst) {
    aes_context aes_ctxt;
    u8 iv[0x10];

    //Generate ATA data key.
    aes_setkey_enc(&aes_ctxt, eid_root_key, 0x100);
    memcpy(iv, eid_root_iv, 0x10);
    aes_crypt_cbc(&aes_ctxt, AES_ENCRYPT, 0x20, iv, sb_indiv_seed_00, data_key_dst);

    //Generate ATA tweak key.
    aes_setkey_enc(&aes_ctxt, eid_root_key, 0x100);
    memcpy(iv, eid_root_iv, 0x10);
    aes_crypt_cbc(&aes_ctxt, AES_ENCRYPT, 0x20, iv, sb_indiv_seed_20, tweak_key_dst);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x248, %rsp            # imm = 0x248
movq %rcx, %rbx
movq %rdx, %r13
movq %rsi, %r15
movq %rdi, %rbp
leaq 0x18(%rsp), %r14
movq %r14, %rdi
movq %rbp, %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x125c
movups (%r15), %xmm0
movq %rsp, %r12
movaps %xmm0, (%r12)
leaq 0xb31b(%rip), %r8       # 0x10570
movl $0x20, %edx
movq %r14, %rdi
movl $0x1, %esi
movq %r12, %rcx
movq %r13, %r9
callq 0x1eae
movq %r14, %rdi
movq %rbp, %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x125c
movups (%r15), %xmm0
movaps %xmm0, (%r12)
leaq 0xb303(%rip), %r8       # 0x10590
movl $0x20, %edx
movq %r14, %rdi
movl $0x1, %esi
movq %r12, %rcx
movq %rbx, %r9
callq 0x1eae
addq $0x248, %rsp            # imm = 0x248
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/zecoxao[P]ps3_decrypt_tools/lib/kgen.c
// Function: generate_encdec_keys
void generate_encdec_keys(u8 *eid_root_key, u8 *eid_root_iv, u8 *data_key_dst, u8 *tweak_key_dst) {
    aes_context aes_ctxt;
    u8 iv[0x10];

    //Generate encdec_k1.
    aes_setkey_enc(&aes_ctxt, eid_root_key, 0x100);
    memcpy(iv, eid_root_iv, 0x10);
    aes_crypt_cbc(&aes_ctxt, AES_ENCRYPT, 0x20, iv, encdec_seed_00, data_key_dst);

    //Generate encdec_k3.
    aes_setkey_enc(&aes_ctxt, eid_root_key, 0x100);
    memcpy(iv, eid_root_iv, 0x10);
    aes_crypt_cbc(&aes_ctxt, AES_ENCRYPT, 0x20, iv, encdec_seed_20, tweak_key_dst);
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x248, %rsp            # imm = 0x248
movq %rcx, %rbx
movq %rdx, %r13
movq %rsi, %r15
movq %rdi, %rbp
leaq 0x18(%rsp), %r14
movq %r14, %rdi
movq %rbp, %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x125c
movups (%r15), %xmm0
movq %rsp, %r12
movaps %xmm0, (%r12)
leaq 0xb234(%rip), %r8       # 0x10530
movl $0x20, %edx
movq %r14, %rdi
movl $0x1, %esi
movq %r12, %rcx
movq %r13, %r9
callq 0x1eae
movq %r14, %rdi
movq %rbp, %rsi
movl $0x100, %edx            # imm = 0x100
callq 0x125c
movups (%r15), %xmm0
movaps %xmm0, (%r12)
leaq 0xb21c(%rip), %r8       # 0x10550
movl $0x20, %edx
movq %r14, %rdi
movl $0x1, %esi
movq %r12, %rcx
movq %rbx, %r9
callq 0x1eae
addq $0x248, %rsp            # imm = 0x248
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nop
// File: /workspace/github_c_makefile_star2_O1/zecoxao[P]ps3_decrypt_tools/lib/aes_xts.c
// Function: aes_xts_init
int aes_xts_init(aes_xts_ctxt_t *ctxt, int mode, const u8 *data_key, const u8 *tweak_key, int keybits) {
    ctxt->mode = mode;
    ctxt->keybits = keybits;
    aes_setkey_enc(&ctxt->twk_ctxt, tweak_key, keybits);

    if (mode == AES_ENCRYPT)
        aes_setkey_enc(&ctxt->aes_ctxt, data_key, keybits);
    else if (mode == AES_DECRYPT)
        aes_setkey_dec(&ctxt->aes_ctxt, data_key, keybits);
    else
        return -1;

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %rbx
pushq %rax
movl %r8d, %ebx
movq %rdx, %r14
movl %esi, %ebp
movq %rdi, %r15
movl %esi, 0x460(%rdi)
movl %r8d, 0x464(%rdi)
movq %rcx, %rsi
movl %r8d, %edx
callq 0x125c
testl %ebp, %ebp
je 0x53ae
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
cmpl $0x1, %ebp
jne 0x53c4
addq $0x230, %r15            # imm = 0x230
movq %r15, %rdi
movq %r14, %rsi
movl %ebx, %edx
callq 0x125c
jmp 0x53c2
addq $0x230, %r15            # imm = 0x230
movq %r15, %rdi
movq %r14, %rsi
movl %ebx, %edx
callq 0x153b
xorl %eax, %eax
addq $0x8, %rsp
popq %rbx
popq %r14
popq %r15
popq %rbp
retq
// File: /workspace/github_c_makefile_star2_O1/zecoxao[P]ps3_decrypt_tools/lib/aes_xts.c
// Function: aes_xts_crypt
int aes_xts_crypt(aes_xts_ctxt_t *ctxt, u64 seqno, u32 sector_size, const u8 *in, u8 *out) {
    u32 i = 0, j = 0;
    u8 tweak[0x10], buf[0x10];
    u8 carry_in, carry_out;

    //Check alignment.
    if (!(sector_size % 0x10 == 0))
        return -1;

    //Init tweak.
    ((u64 *) tweak)[0] = seqno; //_ES64(seqno);
    ((u64 *) tweak)[1] = 0;
    aes_crypt_ecb(&ctxt->twk_ctxt, AES_ENCRYPT, tweak, tweak);

    //En-/decrypt sector.
    for (i = 0; i < sector_size; i += 0x10) {
        for (j = 0; j < 0x10; j++)
            buf[j] = in[i + j] ^ tweak[j];

        //En-/decrypt 0x10 bytes.
        aes_crypt_ecb(&ctxt->aes_ctxt, ctxt->mode, buf, buf);

        for (j = 0; j < 0x10; j++)
            out[i + j] = buf[j] ^ tweak[j];

        //Update tweak (GF MUL).
        carry_in = 0;
        for (j = 0; j < 0x10; j++) {
            carry_out = (tweak[j] >> 7) & 1;
            tweak[j] = ((tweak[j] << 1) + carry_in) & 0xFF;
            carry_in = carry_out;
        }
        if (carry_out)
            tweak[0] ^= 0x87;
    }

    return 0;
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x38, %rsp
movl %edx, %ebp
movl $0xffffffff, %eax       # imm = 0xFFFFFFFF
testb $0xf, %bpl
jne 0x54ba
movq %r8, %r14
movq %rcx, %rbx
movq %rdi, %r15
movq %rsp, %rcx
movq %rsi, (%rcx)
movq $0x0, 0x8(%rcx)
movl $0x1, %esi
movq %rcx, %rdx
callq 0x16d7
testl %ebp, %ebp
je 0x54b8
movq %rbx, 0x18(%rsp)
movq %r15, 0x10(%rsp)
leaq 0x230(%r15), %r12
xorl %ebx, %ebx
leaq 0x20(%rsp), %r13
movl %ebx, %eax
movq %r14, %r15
addq %rax, %r14
addq 0x18(%rsp), %rax
xorl %ecx, %ecx
movb (%rsp,%rcx), %dl
xorb (%rax,%rcx), %dl
movb %dl, 0x20(%rsp,%rcx)
incq %rcx
cmpq $0x10, %rcx
jne 0x5441
movq 0x10(%rsp), %rax
movl 0x460(%rax), %esi
movq %r12, %rdi
movq %r13, %rdx
movq %r13, %rcx
callq 0x16d7
xorl %eax, %eax
movb (%rsp,%rax), %cl
xorb 0x20(%rsp,%rax), %cl
movb %cl, (%r14,%rax)
incq %rax
cmpq $0x10, %rax
jne 0x546f
xorl %eax, %eax
xorl %edx, %edx
movb (%rsp,%rax), %cl
leal (%rcx,%rcx), %esi
orb %dl, %sil
movl %ecx, %edx
shrb $0x7, %dl
movb %sil, (%rsp,%rax)
incq %rax
cmpq $0x10, %rax
jne 0x5487
testb %cl, %cl
movq %r15, %r14
jns 0x54ad
xorb $-0x79, (%rsp)
addl $0x10, %ebx
cmpl %ebp, %ebx
jb 0x5432
xorl %eax, %eax
addq $0x38, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
retq
nopl (%rax)
// File: /workspace/github_c_makefile_star2_O1/zecoxao[P]ps3_decrypt_tools/lib/util.c
// Function: hexdump
void _hexdump(FILE *fp, const char *name, u32 offset, u8 *buf, int len, BOOL print_addr) {
    int i, j, align = strlen(name) + 1;

    fprintf(fp, "%s ", name);
    if (print_addr == TRUE)
        fprintf(fp, "%08x: ", offset);
    for (i = 0; i < len; i++) {
        if (i % 16 == 0 && i != 0) {
            fprintf(fp, "\n");
            for (j = 0; j < align; j++)
                putchar(' ');
            if (print_addr == TRUE)
                fprintf(fp, "%08X: ", offset + i);
        }
        fprintf(fp, "%02X ", buf[i]);
    }
    fprintf(fp, "\n");
}

// Assembly:
pushq %rbp
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
subq $0x18, %rsp
movl %r9d, %ebx
movl %r8d, %r12d
movq %rcx, %r14
movq %rdx, 0x8(%rsp)
movq %rsi, %rbp
movq %rdi, %r15
movq %rsi, %rdi
callq 0x1080
movq %rax, 0x10(%rsp)
leaq 0x773e(%rip), %rsi      # 0xcc40
movq %r15, %rdi
movq %rbp, %rdx
xorl %eax, %eax
callq 0x10d0
movl %ebx, 0x4(%rsp)
cmpl $0x1, %ebx
jne 0x552e
leaq 0x7725(%rip), %rsi      # 0xcc44
movq %r15, %rdi
movq 0x8(%rsp), %rdx
xorl %eax, %eax
callq 0x10d0
testl %r12d, %r12d
jle 0x55c1
movl %r12d, %r12d
movq 0x10(%rsp), %rax
incl %eax
movl %eax, (%rsp)
leaq 0x7707(%rip), %rbp      # 0xcc52
xorl %ebx, %ebx
testb $0xf, %bl
setne %al
testq %rbx, %rbx
sete %cl
orb %al, %cl
jne 0x55a7
movl $0xa, %edi
movq %r15, %rsi
callq 0x10b0
cmpl $0x7ffffffe, 0x10(%rsp) # imm = 0x7FFFFFFE
ja 0x5587
movl (%rsp), %r13d
movl $0x20, %edi
callq 0x1040
decl %r13d
jne 0x5578
cmpl $0x1, 0x4(%rsp)
jne 0x55a7
movq 0x8(%rsp), %rax
leal (%rbx,%rax), %edx
movq %r15, %rdi
leaq 0x76ab(%rip), %rsi      # 0xcc4b
xorl %eax, %eax
callq 0x10d0
movzbl (%r14,%rbx), %edx
movq %r15, %rdi
movq %rbp, %rsi
xorl %eax, %eax
callq 0x10d0
incq %rbx
cmpq %r12, %rbx
jne 0x554d
movl $0xa, %edi
movq %r15, %rsi
addq $0x18, %rsp
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
popq %rbp
jmp 0x10b0
// File: /workspace/github_c_makefile_star2_O1/zecoxao[P]ps3_decrypt_tools/lib/util.c
// Function: read_buffer
u8 *_read_buffer(s8 *file, u32 *length) {
    FILE *fp;
    u32 size;

    if ((fp = fopen(file, "rb")) == NULL)
        return NULL;

    fseek(fp, 0, SEEK_END);
    size = ftell(fp);
    fseek(fp, 0, SEEK_SET);

    u8 *buffer = (u8 *) malloc(sizeof (u8) * size);
    fread(buffer, sizeof (u8), size, fp);

    if (length != NULL)
        *length = size;

    fclose(fp);

    return buffer;
}

// Assembly:
pushq %r15
pushq %r14
pushq %r13
pushq %r12
pushq %rbx
movq %rsi, %rbx
leaq 0x7669(%rip), %rsi      # 0xcc58
callq 0x1120
testq %rax, %rax
je 0x5655
movq %rax, %r14
movq %rax, %rdi
xorl %esi, %esi
movl $0x2, %edx
callq 0x1110
movq %r14, %rdi
callq 0x10e0
movq %rax, %r15
movq %r14, %rdi
xorl %esi, %esi
xorl %edx, %edx
callq 0x1110
movl %r15d, %r13d
movq %r13, %rdi
callq 0x1100
movq %rax, %r12
movl $0x1, %esi
movq %rax, %rdi
movq %r13, %rdx
movq %r14, %rcx
callq 0x1060
testq %rbx, %rbx
je 0x564b
movl %r15d, (%rbx)
movq %r14, %rdi
callq 0x1070
jmp 0x5658
xorl %r12d, %r12d
movq %r12, %rax
popq %rbx
popq %r12
popq %r13
popq %r14
popq %r15
retq