// File: /workspace/github_c_makefile_star2_O0/Tarsnap[P]kivaloo/liball/../libcperciva/aws/aws_readkeys.c
// Function: aws_readkeys
int
aws_readkeys(const char * fname, char ** key_id, char ** key_secret)
{
	FILE * f;
	char buf[1024];
	char * p;

	/* No keys yet. */
	*key_id = *key_secret = NULL;

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

	/* Read lines of up to 1024 characters. */
	while (fgets(buf, sizeof(buf), f) != NULL) {
		/* Find the first EOL character and truncate. */
		p = buf + strcspn(buf, "\r\n");
		if (*p == '\0') {
			warn0("Missing EOL in %s", fname);
			break;
		} else
			*p = '\0';

		/* Look for the first = character. */
		p = strchr(buf, '=');

		/* Missing separator? */
		if (p == NULL)
			goto err3;

		/* Replace separator with NUL and point p at the value. */
		*p++ = '\0';

		/* We should have ACCESS_KEY_ID or ACCESS_KEY_SECRET. */
		if (strcmp(buf, "ACCESS_KEY_ID") == 0) {
			/* Copy key ID string. */
			if (*key_id != NULL) {
				warn0("ACCESS_KEY_ID specified twice");
				goto err2;
			}
			if ((*key_id = strdup(p)) == NULL)
				goto err2;
		} else if (strcmp(buf, "ACCESS_KEY_SECRET") == 0) {
			/* Copy key secret string. */
			if (*key_secret != NULL) {
				warn0("ACCESS_KEY_SECRET specified twice");
				goto err2;
			}
			if ((*key_secret = strdup(p)) == NULL)
				goto err2;
		} else
			goto err3;
	}

	/* Check for error. */
	if (ferror(f)) {
		warnp("Error reading %s", fname);
		goto err2;
	}

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

	/* Check that we got the necessary keys. */
	if ((*key_id == NULL) || (*key_secret == NULL)) {
		warn0("Need ACCESS_KEY_ID and ACCESS_KEY_SECRET");
		goto err1;
	}

	/* Success! */
	return (0);

err3:
	warn0("Lines in %s must be ACCESS_KEY_(ID|SECRET)=...", fname);
err2:
	if (fclose(f))
		warnp("fclose");
err1:
	free(*key_id);
	if (*key_secret) {
		insecure_memzero(*key_secret, strlen(*key_secret));
		free(*key_secret);
	}
err0:
	/* Failure! */
	return (-1);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x450, %rsp            # imm = 0x450
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movq %rdx, -0x20(%rbp)
movq -0x20(%rbp), %rax
movq $0x0, (%rax)
movq -0x18(%rbp), %rax
movq $0x0, (%rax)
movq -0x10(%rbp), %rdi
leaq 0x1b2d9(%rip), %rsi     # 0x1f331
callq 0x3450
movq %rax, -0x28(%rbp)
cmpq $0x0, %rax
jne 0x40ab
jmp 0x4069
callq 0x3040
cmpl $0x0, (%rax)
je 0x4092
movq -0x10(%rbp), %rsi
leaq 0x1a117(%rip), %rdi     # 0x1e195
movb $0x0, %al
callq 0x66e0
callq 0x3040
movl $0x0, (%rax)
jmp 0x40a4
movq -0x10(%rbp), %rsi
leaq 0x1a0f8(%rip), %rdi     # 0x1e195
movb $0x0, %al
callq 0x6930
jmp 0x40a6
jmp 0x43dd
jmp 0x40ad
leaq -0x430(%rbp), %rdi
movq -0x28(%rbp), %rdx
movl $0x400, %esi            # imm = 0x400
callq 0x3560
cmpq $0x0, %rax
je 0x424d
leaq -0x430(%rbp), %rax
movq %rax, -0x440(%rbp)
leaq -0x430(%rbp), %rdi
leaq 0x1af36(%rip), %rsi     # 0x1f01e
callq 0x3080
movq %rax, %rcx
movq -0x440(%rbp), %rax
addq %rcx, %rax
movq %rax, -0x438(%rbp)
movq -0x438(%rbp), %rax
movsbl (%rax), %eax
cmpl $0x0, %eax
jne 0x4134
jmp 0x4112
movq -0x10(%rbp), %rsi
leaq 0x1a082(%rip), %rdi     # 0x1e19f
movb $0x0, %al
callq 0x6930
callq 0x3040
movl $0x0, (%rax)
jmp 0x424d
movq -0x438(%rbp), %rax
movb $0x0, (%rax)
leaq -0x430(%rbp), %rdi
movl $0x3d, %esi
callq 0x3170
movq %rax, -0x438(%rbp)
cmpq $0x0, -0x438(%rbp)
jne 0x4165
jmp 0x4326
movq -0x438(%rbp), %rax
movq %rax, %rcx
addq $0x1, %rcx
movq %rcx, -0x438(%rbp)
movb $0x0, (%rax)
leaq -0x430(%rbp), %rdi
leaq 0x1a026(%rip), %rsi     # 0x1e1b1
callq 0x3500
cmpl $0x0, %eax
jne 0x41df
movq -0x18(%rbp), %rax
cmpq $0x0, (%rax)
je 0x41bf
jmp 0x41a1
leaq 0x1a017(%rip), %rdi     # 0x1e1bf
movb $0x0, %al
callq 0x6930
callq 0x3040
movl $0x0, (%rax)
jmp 0x4347
movq -0x438(%rbp), %rdi
callq 0x35f0
movq -0x18(%rbp), %rcx
movq %rax, (%rcx)
cmpq $0x0, %rax
jne 0x41dd
jmp 0x4347
jmp 0x4248
leaq -0x430(%rbp), %rdi
leaq 0x1a041(%rip), %rsi     # 0x1e22e
callq 0x3500
cmpl $0x0, %eax
jne 0x4241
movq -0x20(%rbp), %rax
cmpq $0x0, (%rax)
je 0x4221
jmp 0x4203
leaq 0x19fd3(%rip), %rdi     # 0x1e1dd
movb $0x0, %al
callq 0x6930
callq 0x3040
movl $0x0, (%rax)
jmp 0x4347
movq -0x438(%rbp), %rdi
callq 0x35f0
movq -0x20(%rbp), %rcx
movq %rax, (%rcx)
cmpq $0x0, %rax
jne 0x423f
jmp 0x4347
jmp 0x4246
jmp 0x4326
jmp 0x4248
jmp 0x40ad
movq -0x28(%rbp), %rdi
callq 0x3610
cmpl $0x0, %eax
je 0x429f
jmp 0x425d
callq 0x3040
cmpl $0x0, (%rax)
je 0x4286
movq -0x10(%rbp), %rsi
leaq 0x19f8d(%rip), %rdi     # 0x1e1ff
movb $0x0, %al
callq 0x66e0
callq 0x3040
movl $0x0, (%rax)
jmp 0x4298
movq -0x10(%rbp), %rsi
leaq 0x19f6e(%rip), %rdi     # 0x1e1ff
movb $0x0, %al
callq 0x6930
jmp 0x429a
jmp 0x4347
movq -0x28(%rbp), %rdi
callq 0x33b0
cmpl $0x0, %eax
je 0x42e9
jmp 0x42af
callq 0x3040
cmpl $0x0, (%rax)
je 0x42d4
leaq 0x19f50(%rip), %rdi     # 0x1e210
movb $0x0, %al
callq 0x66e0
callq 0x3040
movl $0x0, (%rax)
jmp 0x42e2
leaq 0x19f35(%rip), %rdi     # 0x1e210
movb $0x0, %al
callq 0x6930
jmp 0x42e4
jmp 0x4390
movq -0x18(%rbp), %rax
cmpq $0x0, (%rax)
je 0x42fd
movq -0x20(%rbp), %rax
cmpq $0x0, (%rax)
jne 0x431a
jmp 0x42ff
leaq 0x19f11(%rip), %rdi     # 0x1e217
movb $0x0, %al
callq 0x6930
callq 0x3040
movl $0x0, (%rax)
jmp 0x4390
movl $0x0, -0x4(%rbp)
jmp 0x43e4
jmp 0x4328
movq -0x10(%rbp), %rsi
leaq 0x19f0d(%rip), %rdi     # 0x1e240
movb $0x0, %al
callq 0x6930
callq 0x3040
movl $0x0, (%rax)
jmp 0x4347
movq -0x28(%rbp), %rdi
callq 0x33b0
cmpl $0x0, %eax
je 0x438e
jmp 0x4357
callq 0x3040
cmpl $0x0, (%rax)
je 0x437c
leaq 0x19ea8(%rip), %rdi     # 0x1e210
movb $0x0, %al
callq 0x66e0
callq 0x3040
movl $0x0, (%rax)
jmp 0x438a
leaq 0x19e8d(%rip), %rdi     # 0x1e210
movb $0x0, %al
callq 0x6930
jmp 0x438c
jmp 0x438e
jmp 0x4390
movq -0x18(%rbp), %rax
movq (%rax), %rdi
callq 0x3460
movq -0x20(%rbp), %rax
cmpq $0x0, (%rax)
je 0x43db
movq -0x20(%rbp), %rax
movq (%rax), %rax
movq %rax, -0x448(%rbp)
movq -0x20(%rbp), %rax
movq (%rax), %rdi
callq 0x31a0
movq -0x448(%rbp), %rdi
movq %rax, %rsi
callq 0x43f0
movq -0x20(%rbp), %rax
movq (%rax), %rdi
callq 0x3460
jmp 0x43dd
movl $0xffffffff, -0x4(%rbp) # imm = 0xFFFFFFFF
movl -0x4(%rbp), %eax
addq $0x450, %rsp            # imm = 0x450
popq %rbp
retq