// File: /workspace/github_c_makefile_star2_O0/rpeepz[P]ft_ssl/srcs/rsa/rsa.c
// Function: read_key
int				read_key(char *buf, t_rsa *gg, int flag, int fd)
{
	if (flag & R_CHECK && flag & R_PUBIN)
		return (ft_error(20, NULL, NULL));
	ft_bzero(buf, PAGESIZE);
	read(fd, buf, PAGESIZE);
	flag = flag & R_PUBIN ? 1 : 0;
	if (ft_strncmp(buf, flag ? PUB_BEG : PRIV_BEG, flag ? 27 : 32))
	{
		buf += ft_strchri(buf, '\n');
		buf += ft_strchri(buf, '-');
		if (ft_strncmp(buf, flag ? PUB_BEG : PRIV_BEG, flag ? 27 : 32) &&\
			ft_error(flag ? 9 : 10, NULL, NULL))
			return (ft_printf("%s", flag ? EXPECT_PUB : EXPECT_PRV));
	}
	buf += flag ? 27 : 32;
	if (!*buf)
		return (ft_error(flag ? 11 : 12, NULL, NULL));
	buf += validate_key(buf, gg, flag);
	if (!*buf)
		return (1);
	if (ft_strncmp(buf, flag ? PUB_END : PRIV_END, flag ? 25 : 30))
		return (ft_error(flag ? 11 : 12, NULL, NULL));
	return (0);
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x20, %rsp
movq %rdi, -0x10(%rbp)
movq %rsi, -0x18(%rbp)
movl %edx, -0x1c(%rbp)
movl %ecx, -0x20(%rbp)
movl -0x1c(%rbp), %eax
andl $0x10, %eax
cmpl $0x0, %eax
je 0x6ea5
movl -0x1c(%rbp), %eax
andl $0x20, %eax
cmpl $0x0, %eax
je 0x6ea5
movl $0x14, %edi
xorl %eax, %eax
movl %eax, %edx
movq %rdx, %rsi
callq 0x33a0
movl %eax, -0x4(%rbp)
jmp 0x70d0
movq -0x10(%rbp), %rdi
movl $0x1000, %esi           # imm = 0x1000
callq 0xa600
movl -0x20(%rbp), %edi
movq -0x10(%rbp), %rsi
movl $0x1000, %edx           # imm = 0x1000
callq 0x10a0
movl -0x1c(%rbp), %edx
andl $0x20, %edx
xorl %eax, %eax
movl $0x1, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movl %eax, -0x1c(%rbp)
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %ecx
leaq 0xd104(%rip), %rsi      # 0x13fec
leaq 0xd0e1(%rip), %rax      # 0x13fd0
cmpl $0x0, %ecx
cmovneq %rax, %rsi
movl -0x1c(%rbp), %edx
movl $0x20, %eax
movl $0x1b, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movslq %eax, %rdx
callq 0xb960
cmpl $0x0, %eax
je 0x6fe6
movq -0x10(%rbp), %rdi
movl $0xa, %esi
callq 0xb7f0
movl %eax, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
movl $0x2d, %esi
callq 0xb7f0
movl %eax, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %ecx
leaq 0xd088(%rip), %rsi      # 0x13fec
leaq 0xd065(%rip), %rax      # 0x13fd0
cmpl $0x0, %ecx
cmovneq %rax, %rsi
movl -0x1c(%rbp), %edx
movl $0x20, %eax
movl $0x1b, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movslq %eax, %rdx
callq 0xb960
cmpl $0x0, %eax
je 0x6fe4
movl -0x1c(%rbp), %ecx
movl $0xa, %edi
movl $0x9, %eax
cmpl $0x0, %ecx
cmovnel %eax, %edi
xorl %eax, %eax
movl %eax, %edx
movq %rdx, %rsi
callq 0x33a0
cmpl $0x0, %eax
je 0x6fe4
movl -0x1c(%rbp), %ecx
leaq 0xd064(%rip), %rsi      # 0x14024
leaq 0xd046(%rip), %rax      # 0x1400d
cmpl $0x0, %ecx
cmovneq %rax, %rsi
leaq 0xc60d(%rip), %rdi      # 0x135e2
movb $0x0, %al
callq 0xad50
movl %eax, -0x4(%rbp)
jmp 0x70d0
jmp 0x6fe6
movl -0x1c(%rbp), %edx
movl $0x20, %ecx
movl $0x1b, %eax
cmpl $0x0, %edx
cmovnel %eax, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpb $0x0, (%rax)
jne 0x7037
movl -0x1c(%rbp), %ecx
movl $0xc, %edi
movl $0xb, %eax
cmpl $0x0, %ecx
cmovnel %eax, %edi
xorl %eax, %eax
movl %eax, %edx
movq %rdx, %rsi
callq 0x33a0
movl %eax, -0x4(%rbp)
jmp 0x70d0
movq -0x10(%rbp), %rdi
movq -0x18(%rbp), %rsi
movl -0x1c(%rbp), %edx
callq 0x6c10
movl %eax, %ecx
movq -0x10(%rbp), %rax
movslq %ecx, %rcx
addq %rcx, %rax
movq %rax, -0x10(%rbp)
movq -0x10(%rbp), %rax
cmpb $0x0, (%rax)
jne 0x7069
movl $0x1, -0x4(%rbp)
jmp 0x70d0
movq -0x10(%rbp), %rdi
movl -0x1c(%rbp), %ecx
leaq 0xcfe3(%rip), %rsi      # 0x1405a
leaq 0xcfc2(%rip), %rax      # 0x14040
cmpl $0x0, %ecx
cmovneq %rax, %rsi
movl -0x1c(%rbp), %edx
movl $0x1e, %eax
movl $0x19, %ecx
cmpl $0x0, %edx
cmovnel %ecx, %eax
movslq %eax, %rdx
callq 0xb960
cmpl $0x0, %eax
je 0x70c9
movl -0x1c(%rbp), %ecx
movl $0xc, %edi
movl $0xb, %eax
cmpl $0x0, %ecx
cmovnel %eax, %edi
xorl %eax, %eax
movl %eax, %edx
movq %rdx, %rsi
callq 0x33a0
movl %eax, -0x4(%rbp)
jmp 0x70d0
movl $0x0, -0x4(%rbp)
movl -0x4(%rbp), %eax
addq $0x20, %rsp
popq %rbp
retq
nopl (%rax)