// File: /workspace/github_c_makefile_star2_O0/skeeto[P]enchive/src/enchive.c
// Function: pinentry
static void
pinentry(FILE *pfi, FILE *pfo, char *buf, size_t len, char *prompt)
{
    char line[ENCHIVE_PASSPHRASE_MAX * 3 + 32];

    if (!fgets(line, sizeof(line), pfo))
        /* Likely caused by exec() failure, so exit quietly. */
        exit(EXIT_FAILURE);
    if (strncmp(line, "OK", 2) != 0)
        fatal("pinentry startup failure");

    if (fprintf(pfi, "SETPROMPT %s\n", prompt) < 0 || fflush(pfi) < 0)
        fatal("pinentry write() -- %s", strerror(errno));

    if (!fgets(line, sizeof(line), pfo))
        fatal("pinentry read() -- %s", strerror(errno));
    if (strncmp(line, "OK", 2) != 0)
        fatal("pinentry protocol failure");

    if (fprintf(pfi, "GETPIN\n") < 0 || fflush(pfi) < 0)
        fatal("pinentry write() -- %s", strerror(errno));

    if (!fgets(line, sizeof(line), pfo))
        fatal("pinentry read() -- %s", strerror(errno));
    if (strncmp(line, "ERR ", 4) == 0)
        fatal("passphrase entry canceled");
    else if (strncmp(line, "OK", 2) == 0)
        buf[0] = 0;
    else if (strncmp(line, "D ", 2) == 0)
        pinentry_decode(buf, len, line + 2);
    else
        fatal("pinentry protocol failure");

    if (fprintf(pfi, "BYE\n") < 0 || fflush(pfi) < 0)
        fatal("pinentry write() -- %s", strerror(errno));
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0xc50, %rsp            # imm = 0xC50
movq %rdi, -0x8(%rbp)
movq %rsi, -0x10(%rbp)
movq %rdx, -0x18(%rbp)
movq %rcx, -0x20(%rbp)
movq %r8, -0x28(%rbp)
leaq -0xc50(%rbp), %rdi
movq -0x10(%rbp), %rdx
movl $0xc20, %esi            # imm = 0xC20
callq 0x21d0
cmpq $0x0, %rax
jne 0x5d24
movl $0x1, %edi
callq 0x2310
leaq -0xc50(%rbp), %rdi
leaq 0x5e27(%rip), %rsi      # 0xbb59
movl $0x2, %edx
callq 0x20a0
cmpl $0x0, %eax
je 0x5d4f
leaq 0x5e14(%rip), %rdi      # 0xbb5c
movb $0x0, %al
callq 0x3340
movq -0x8(%rbp), %rdi
movq -0x28(%rbp), %rdx
leaq 0x5e17(%rip), %rsi      # 0xbb75
movb $0x0, %al
callq 0x21f0
cmpl $0x0, %eax
jl 0x5d78
movq -0x8(%rbp), %rdi
callq 0x2250
cmpl $0x0, %eax
jge 0x5d95
callq 0x2070
movl (%rax), %edi
callq 0x2350
movq %rax, %rsi
leaq 0x5df5(%rip), %rdi      # 0xbb83
movb $0x0, %al
callq 0x3340
leaq -0xc50(%rbp), %rdi
movq -0x10(%rbp), %rdx
movl $0xc20, %esi            # imm = 0xC20
callq 0x21d0
cmpq $0x0, %rax
jne 0x5dcd
callq 0x2070
movl (%rax), %edi
callq 0x2350
movq %rax, %rsi
leaq 0x5dd4(%rip), %rdi      # 0xbb9a
movb $0x0, %al
callq 0x3340
leaq -0xc50(%rbp), %rdi
leaq 0x5d7e(%rip), %rsi      # 0xbb59
movl $0x2, %edx
callq 0x20a0
cmpl $0x0, %eax
je 0x5df8
leaq 0x5dbf(%rip), %rdi      # 0xbbb0
movb $0x0, %al
callq 0x3340
movq -0x8(%rbp), %rdi
leaq 0x5dc7(%rip), %rsi      # 0xbbca
movb $0x0, %al
callq 0x21f0
cmpl $0x0, %eax
jl 0x5e1d
movq -0x8(%rbp), %rdi
callq 0x2250
cmpl $0x0, %eax
jge 0x5e3a
callq 0x2070
movl (%rax), %edi
callq 0x2350
movq %rax, %rsi
leaq 0x5d50(%rip), %rdi      # 0xbb83
movb $0x0, %al
callq 0x3340
leaq -0xc50(%rbp), %rdi
movq -0x10(%rbp), %rdx
movl $0xc20, %esi            # imm = 0xC20
callq 0x21d0
cmpq $0x0, %rax
jne 0x5e72
callq 0x2070
movl (%rax), %edi
callq 0x2350
movq %rax, %rsi
leaq 0x5d2f(%rip), %rdi      # 0xbb9a
movb $0x0, %al
callq 0x3340
leaq -0xc50(%rbp), %rdi
leaq 0x5d52(%rip), %rsi      # 0xbbd2
movl $0x4, %edx
callq 0x20a0
cmpl $0x0, %eax
jne 0x5e9f
leaq 0x5d41(%rip), %rdi      # 0xbbd7
movb $0x0, %al
callq 0x3340
jmp 0x5f0e
leaq -0xc50(%rbp), %rdi
leaq 0x5cac(%rip), %rsi      # 0xbb59
movl $0x2, %edx
callq 0x20a0
cmpl $0x0, %eax
jne 0x5ec5
movq -0x18(%rbp), %rax
movb $0x0, (%rax)
jmp 0x5f0c
leaq -0xc50(%rbp), %rdi
leaq 0x5d1e(%rip), %rsi      # 0xbbf1
movl $0x2, %edx
callq 0x20a0
cmpl $0x0, %eax
jne 0x5efc
movq -0x18(%rbp), %rdi
movq -0x20(%rbp), %rsi
leaq -0xc50(%rbp), %rdx
addq $0x2, %rdx
callq 0x5f60
jmp 0x5f0a
leaq 0x5cad(%rip), %rdi      # 0xbbb0
movb $0x0, %al
callq 0x3340
jmp 0x5f0c
jmp 0x5f0e
movq -0x8(%rbp), %rdi
leaq 0x5cdb(%rip), %rsi      # 0xbbf4
movb $0x0, %al
callq 0x21f0
cmpl $0x0, %eax
jl 0x5f33
movq -0x8(%rbp), %rdi
callq 0x2250
cmpl $0x0, %eax
jge 0x5f50
callq 0x2070
movl (%rax), %edi
callq 0x2350
movq %rax, %rsi
leaq 0x5c3a(%rip), %rdi      # 0xbb83
movb $0x0, %al
callq 0x3340
addq $0xc50, %rsp            # imm = 0xC50
popq %rbp
retq
nopl (%rax)