// File: /workspace/github_c_makefile_star2_O0/snow1eo[P]IPsec_IKEv2/ike.c
// Function: receive
int receive (void)
{
    parse_buff ();
    if (HDR_recv.exchange_type == IKE_SA_INIT)
        if (HDR_recv.flags == 8)
        {
            ike_init_resp ();

            mpz_powm_sec (dh_K, dh_A, dh_b, dh_p);
            size_t *count = (size_t*) calloc (1, sizeof (size_t));
            uint32_t size = mpz_sizeinbase (dh_K, 256);
            K = calloc (1, modp/8);
            mpz_export (K + modp/8 - size, count, 0, sizeof (char), 1, 0, dh_K);
            free (count);
            // dh_clear ();
            compute_keys ();
        }
        else
        {
            proposal *acc_proposal = SA_recv.proposals;

            mpz_import (dh_B, modp/8, 1, sizeof (char), 1, 0, KE_recv.key_exchange_data);
            mpz_powm_sec (dh_K, dh_B, dh_a, dh_p);

            size_t *count = (size_t*) calloc (1, sizeof (size_t));
            uint32_t size = mpz_sizeinbase (dh_K, 256);
            K = calloc (1, modp/8);
            mpz_export (K + modp/8 - size, count, 0, sizeof (char), 1, 0, dh_K);
            free (count);
            dh_clear ();
            compute_keys (acc_proposal);
        }
    if (HDR_recv.exchange_type == IKE_AUTH)
        if (HDR_recv.flags == 8)
        {
            ike_auth_resp ();
        }
    // mem_clr ();
}

// Assembly:
pushq %rbp
movq %rsp, %rbp
subq $0x40, %rsp
callq 0x3390
movzbl 0xaede(%rip), %eax      # 0x125e2
cmpl $0x22, %eax
jne 0x78e8
movzbl 0xaecf(%rip), %eax      # 0x125e3
cmpl $0x8, %eax
jne 0x77e3
callq 0x3140
leaq 0xace7(%rip), %rdi      # 0x12410
leaq 0xacc0(%rip), %rsi      # 0x123f0
leaq 0xac89(%rip), %rdx      # 0x123c0
leaq 0xaca2(%rip), %rcx      # 0x123e0
callq 0x3380
movl $0x1, %edi
movl $0x8, %esi
callq 0x3250
movq %rax, -0x10(%rbp)
leaq 0xacb3(%rip), %rdi      # 0x12410
movl $0x100, %esi            # imm = 0x100
callq 0x3530
movl %eax, -0x14(%rbp)
movl 0xae18(%rip), %eax      # 0x12588
shrl $0x3, %eax
movl %eax, %eax
movl %eax, %esi
movl $0x1, %edi
callq 0x3250
movq %rax, 0xaeb0(%rip)      # 0x12638
movq 0xaea9(%rip), %rdi      # 0x12638
movl 0xadf3(%rip), %eax      # 0x12588
shrl $0x3, %eax
movl %eax, %eax
addq %rax, %rdi
movl -0x14(%rbp), %eax
movl %eax, %ecx
xorl %eax, %eax
subq %rcx, %rax
addq %rax, %rdi
movq -0x10(%rbp), %rsi
xorl %edx, %edx
movl $0x1, %ecx
movl $0x1, %r8d
xorl %eax, %eax
movl %eax, %r9d
leaq 0xac49(%rip), %rax      # 0x12410
movq %rax, (%rsp)
callq 0x3500
movq -0x10(%rbp), %rdi
callq 0x3060
callq 0x3150
jmp 0x78e6
movq 0xad26(%rip), %rax      # 0x12510
movq %rax, -0x20(%rbp)
movl 0xad94(%rip), %eax      # 0x12588
shrl $0x3, %eax
movl %eax, %eax
movl %eax, %esi
movq 0xadc6(%rip), %rax      # 0x125c8
leaq 0xabf7(%rip), %rdi      # 0x12400
movl $0x1, %r8d
movl $0x1, %ecx
xorl %edx, %edx
movl %edx, %r9d
movl %r8d, %edx
movq %rax, (%rsp)
callq 0x3350
leaq 0xabe4(%rip), %rdi      # 0x12410
leaq 0xabcd(%rip), %rsi      # 0x12400
leaq 0xab76(%rip), %rdx      # 0x123b0
leaq 0xab9f(%rip), %rcx      # 0x123e0
callq 0x3380
movl $0x1, %edi
movl $0x8, %esi
callq 0x3250
movq %rax, -0x28(%rbp)
leaq 0xabb0(%rip), %rdi      # 0x12410
movl $0x100, %esi            # imm = 0x100
callq 0x3530
movl %eax, -0x2c(%rbp)
movl 0xad15(%rip), %eax      # 0x12588
shrl $0x3, %eax
movl %eax, %eax
movl %eax, %esi
movl $0x1, %edi
callq 0x3250
movq %rax, 0xadad(%rip)      # 0x12638
movq 0xada6(%rip), %rdi      # 0x12638
movl 0xacf0(%rip), %eax      # 0x12588
shrl $0x3, %eax
movl %eax, %eax
addq %rax, %rdi
movl -0x2c(%rbp), %eax
movl %eax, %ecx
xorl %eax, %eax
subq %rcx, %rax
addq %rax, %rdi
movq -0x28(%rbp), %rsi
xorl %edx, %edx
movl $0x1, %ecx
movl $0x1, %r8d
xorl %eax, %eax
movl %eax, %r9d
leaq 0xab46(%rip), %rax      # 0x12410
movq %rax, (%rsp)
callq 0x3500
movq -0x28(%rbp), %rdi
callq 0x3060
callq 0x3430
callq 0x3150
jmp 0x78e8
movzbl 0xacf3(%rip), %eax      # 0x125e2
cmpl $0x23, %eax
jne 0x7907
movzbl 0xace8(%rip), %eax      # 0x125e3
cmpl $0x8, %eax
jne 0x7905
callq 0x32b0
jmp 0x7907
movl -0x4(%rbp), %eax
addq $0x40, %rsp
popq %rbp
retq