#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */
typedef int /*<<< orphan*/ BN_CTX;
typedef int /*<<< orphan*/ BIGNUM;

/* Variables and functions */
int /*<<< orphan*/ BN_mul(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                          int /*<<< orphan*/ *, int /*<<< orphan*/ *);
int /*<<< orphan*/ *BN_new();
int /*<<< orphan*/ BN_sub(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                          int /*<<< orphan*/);
int /*<<< orphan*/ BN_value_one();
int PHI_N(BIGNUM *ret, BIGNUM *p, BIGNUM *q, BN_CTX *bnctx) {
  BIGNUM *phi_p;
  BIGNUM *phi_q;
  phi_p = BN_new();
  phi_q = BN_new();
  BN_sub(phi_p, p, BN_value_one());
  BN_sub(phi_q, q, BN_value_one());
  BN_mul(ret, phi_p, phi_q, bnctx);
  return 1;
}


x86 assembly (clang, -O0):
<PHI_N>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    $0x0,%al
call   1040 <BN_new@plt>
mov    %rax,-0x28(%rbp)
mov    $0x0,%al
call   1040 <BN_new@plt>
mov    %rax,-0x30(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x50(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x48(%rbp)
mov    $0x0,%al
call   1030 <BN_value_one@plt>
mov    -0x50(%rbp),%rdi
mov    -0x48(%rbp),%rsi
mov    %eax,%edx
call   1050 <BN_sub@plt>
mov    -0x30(%rbp),%rax
mov    %rax,-0x40(%rbp)
mov    -0x18(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    $0x0,%al
call   1030 <BN_value_one@plt>
mov    -0x40(%rbp),%rdi
mov    -0x38(%rbp),%rsi
mov    %eax,%edx
call   1050 <BN_sub@plt>
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    -0x20(%rbp),%rcx
call   1060 <BN_mul@plt>
mov    $0x1,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PHI_N>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %rdx,%r12
mov    %rsi,%r13
mov    %rdi,%r15
xor    %eax,%eax
call   1040 <BN_new@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1040 <BN_new@plt>
mov    %rax,%rbp
xor    %eax,%eax
call   1030 <BN_value_one@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
mov    %eax,%edx
call   1050 <BN_sub@plt>
xor    %eax,%eax
call   1030 <BN_value_one@plt>
mov    %rbp,%rdi
mov    %r12,%rsi
mov    %eax,%edx
call   1050 <BN_sub@plt>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    %rbp,%rdx
mov    %r14,%rcx
call   1060 <BN_mul@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @PHI_N(i32* %0, i32* %1, i32* %2, i32* %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32*
store i32* %0, i32** %5
store i32* %1, i32** %6
store i32* %2, i32** %7
store i32* %3, i32** %8
%11 = call i32* (...) @BN_new()
store i32* %11, i32** %9
%12 = call i32* (...) @BN_new()
store i32* %12, i32** %10
%13 = load i32*, i32** %9
%14 = load i32*, i32** %6
%15 = call i32 (...) @BN_value_one()
%16 = call i32 @BN_sub(i32* %13, i32* %14, i32 %15)
%17 = load i32*, i32** %10
%18 = load i32*, i32** %7
%19 = call i32 (...) @BN_value_one()
%20 = call i32 @BN_sub(i32* %17, i32* %18, i32 %19)
%21 = load i32*, i32** %5
%22 = load i32*, i32** %9
%23 = load i32*, i32** %10
%24 = load i32*, i32** %8
%25 = call i32 @BN_mul(i32* %21, i32* %22, i32* %23, i32* %24)
ret i32 1
}

LLVM IR (-O2):
define i32 @PHI_N(i32* %0, i32* %1, i32* %2, i32* %3) {
%5 = tail call i32* (...) @BN_new()
%6 = tail call i32* (...) @BN_new()
%7 = tail call i32 (...) @BN_value_one()
%8 = tail call i32 @BN_sub(i32* %5, i32* %1, i32 %7)
%9 = tail call i32 (...) @BN_value_one()
%10 = tail call i32 @BN_sub(i32* %6, i32* %2, i32 %9)
%11 = tail call i32 @BN_mul(i32* %0, i32* %5, i32* %6, i32* %3)
ret i32 1
}