// File: /workspace/github_c_makefile_star2_O0/Tarsnap[P]libcperciva/liball/../util/readpass_file.c
// Function: readpass_file
int
readpass_file(char ** passwd, const char * filename)
{
	FILE * f;
	char passbuf[MAXPASSLEN];

	/* Open the file. */
	if ((f = fopen(filename, "r")) == NULL) {
		warnp("fopen(%s)", filename);
		goto err1;
	}

	/* Get a line from the file. */
	if ((fgets(passbuf, MAXPASSLEN, f)) == NULL) {
		if (ferror(f)) {
			warnp("fread(%s)", filename);
			goto err2;
		} else {
			/* We have a 0-byte password. */
			passbuf[0] = '\0';
		}
	}

	/* Bail if there's the line is too long, or if there's a second line. */
	if (fgetc(f) != EOF) {
		warn0("line too long, or more than 1 line in %s", filename);
		goto err2;
	}

	/* Close the file. */
	if (fclose(f)) {
		warnp("fclose(%s)", filename);
		goto err1;
	}

	/* Truncate at any newline character. */
	passbuf[strcspn(passbuf, "\r\n")] = '\0';

	/* Copy the password out. */
	if ((*passwd = strdup(passbuf)) == NULL) {
		warnp("Cannot allocate memory");
		goto err1;
	}

	/* Clean up. */
	insecure_memzero(passbuf, MAXPASSLEN);

	/* Success! */
	return (0);

err2:
	if (fclose(f))
		warnp("fclose");
err1:
	/* No harm in running this for all error paths. */
	insecure_memzero(passbuf, MAXPASSLEN);

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

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x820, %rsp            # imm = 0x820
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq -0x18(%rbp), %rdi
leaq 0xc4a(%rip), %rsi       # 0x2028
callq 0x1120
movq %rax, -0x20(%rbp)
cmpq $0x0, %rax
jne 0x1431
jmp 0x13ef
callq 0x1060
cmpl $0x0, (%rax)
je 0x1418
movq -0x18(%rbp), %rsi
leaq 0xc26(%rip), %rdi       # 0x202a
movb $0x0, %al
callq 0x1710
callq 0x1060
movl $0x0, (%rax)
jmp 0x142a
movq -0x18(%rbp), %rsi
leaq 0xc07(%rip), %rdi       # 0x202a
movb $0x0, %al
callq 0x1960
jmp 0x142c
jmp 0x15fb
leaq -0x820(%rbp), %rdi
movq -0x20(%rbp), %rdx
movl $0x800, %esi            # imm = 0x800
callq 0x10f0
cmpq $0x0, %rax
jne 0x14a7
movq -0x20(%rbp), %rdi
callq 0x1070
cmpl $0x0, %eax
je 0x149e
jmp 0x145c
callq 0x1060
cmpl $0x0, (%rax)
je 0x1485
movq -0x18(%rbp), %rsi
leaq 0xbc3(%rip), %rdi       # 0x2034
movb $0x0, %al
callq 0x1710
callq 0x1060
movl $0x0, (%rax)
jmp 0x1497
movq -0x18(%rbp), %rsi
leaq 0xba4(%rip), %rdi       # 0x2034
movb $0x0, %al
callq 0x1960
jmp 0x1499
jmp 0x15b2
movb $0x0, -0x820(%rbp)
jmp 0x14a7
movq -0x20(%rbp), %rdi
callq 0x10c0
cmpl $-0x1, %eax
je 0x14d9
jmp 0x14b7
movq -0x18(%rbp), %rsi
leaq 0xb7c(%rip), %rdi       # 0x203e
movb $0x0, %al
callq 0x1960
callq 0x1060
movl $0x0, (%rax)
jmp 0x15b2
movq -0x20(%rbp), %rdi
callq 0x1090
cmpl $0x0, %eax
je 0x152b
jmp 0x14e9
callq 0x1060
cmpl $0x0, (%rax)
je 0x1512
movq -0x18(%rbp), %rsi
leaq 0xb69(%rip), %rdi       # 0x2067
movb $0x0, %al
callq 0x1710
callq 0x1060
movl $0x0, (%rax)
jmp 0x1524
movq -0x18(%rbp), %rsi
leaq 0xb4a(%rip), %rdi       # 0x2067
movb $0x0, %al
callq 0x1960
jmp 0x1526
jmp 0x15fb
leaq -0x820(%rbp), %rdi
leaq 0xb39(%rip), %rsi       # 0x2072
callq 0x10e0
movb $0x0, -0x820(%rbp,%rax)
leaq -0x820(%rbp), %rdi
callq 0x1160
movq -0x10(%rbp), %rcx
movq %rax, (%rcx)
cmpq $0x0, %rax
jne 0x1598
jmp 0x1561
callq 0x1060
cmpl $0x0, (%rax)
je 0x1586
leaq 0xb03(%rip), %rdi       # 0x2075
movb $0x0, %al
callq 0x1710
callq 0x1060
movl $0x0, (%rax)
jmp 0x1594
leaq 0xae8(%rip), %rdi       # 0x2075
movb $0x0, %al
callq 0x1960
jmp 0x1596
jmp 0x15fb
leaq -0x820(%rbp), %rdi
movl $0x800, %esi            # imm = 0x800
callq 0x1620
movl $0x0, -0x4(%rbp)
jmp 0x1613
movq -0x20(%rbp), %rdi
callq 0x1090
cmpl $0x0, %eax
je 0x15f9
jmp 0x15c2
callq 0x1060
cmpl $0x0, (%rax)
je 0x15e7
leaq 0xab9(%rip), %rdi       # 0x208c
movb $0x0, %al
callq 0x1710
callq 0x1060
movl $0x0, (%rax)
jmp 0x15f5
leaq 0xa9e(%rip), %rdi       # 0x208c
movb $0x0, %al
callq 0x1960
jmp 0x15f7
jmp 0x15f9
jmp 0x15fb
leaq -0x820(%rbp), %rdi
movl $0x800, %esi            # imm = 0x800
callq 0x1620
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x820, %rsp            # imm = 0x820
popq %rbp
retq
nop