#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 BN_ULONG;
typedef int /*<<< orphan*/ BN_CTX;
typedef int /*<<< orphan*/ BIGNUM;

/* Variables and functions */
int /*<<< orphan*/ BN_CTX_free(int /*<<< orphan*/ *);
int /*<<< orphan*/ *BN_CTX_new();
int /*<<< orphan*/ BN_RAND_BOTTOM_ANY;
int /*<<< orphan*/ BN_RAND_TOP_ONE;
int /*<<< orphan*/ BN_free(int /*<<< orphan*/ *);
scalar_t__ BN_mod_exp(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                      int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                      int /*<<< orphan*/ *);
scalar_t__ BN_mod_exp_mont(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                           int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                           int /*<<< orphan*/ *, int /*<<< orphan*/ *);
scalar_t__ BN_mod_exp_mont_consttime(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                                     int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                                     int /*<<< orphan*/ *,
                                     int /*<<< orphan*/ *);
scalar_t__ BN_mod_exp_mont_word(int /*<<< orphan*/ *, int, int /*<<< orphan*/ *,
                                int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                                int /*<<< orphan*/ *);
scalar_t__ BN_mod_exp_recp(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                           int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                           int /*<<< orphan*/ *);
scalar_t__ BN_mod_exp_simple(int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                             int /*<<< orphan*/ *, int /*<<< orphan*/ *,
                             int /*<<< orphan*/ *);
int /*<<< orphan*/ *BN_new();
int /*<<< orphan*/ BN_one(int /*<<< orphan*/ *);
scalar_t__ BN_rand(int /*<<< orphan*/ *, int, int /*<<< orphan*/,
                   int /*<<< orphan*/);
int /*<<< orphan*/ BN_zero(int /*<<< orphan*/ *);
scalar_t__ a_is_zero_mod_one(char *, int /*<<< orphan*/ *,
                             int /*<<< orphan*/ *);
int /*<<< orphan*/ test_BN_eq_zero(char *, int, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ test_error(char *, int, char *);
int /*<<< orphan*/ test_output_bignum(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ test_ptr(char *, int, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ test_true(char *, int, char *, int);
int test_mod_exp_zero(void) {
  BIGNUM *a = NULL, *p = NULL, *m = NULL;
  BIGNUM *r = NULL;
  BN_ULONG one_word = 1;
  BN_CTX *ctx = BN_CTX_new();
  int ret = 1, failed = 0;
  if (!test_ptr("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/papyrussolution/OpenPapyrus/"
                "refs/heads/master/Src/OSF/OpenSSL-111/test/exptest.c",
                53, "m = BN_new()", m = BN_new()) ||
      !test_ptr("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/papyrussolution/OpenPapyrus/"
                "refs/heads/master/Src/OSF/OpenSSL-111/test/exptest.c",
                54, "a = BN_new()", a = BN_new()) ||
      !test_ptr("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/papyrussolution/OpenPapyrus/"
                "refs/heads/master/Src/OSF/OpenSSL-111/test/exptest.c",
                55, "p = BN_new()", p = BN_new()) ||
      !test_ptr("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/papyrussolution/OpenPapyrus/"
                "refs/heads/master/Src/OSF/OpenSSL-111/test/exptest.c",
                56, "r = BN_new()", r = BN_new()))
    goto err;
  BN_one(m);
  BN_one(a);
  BN_zero(p);
  if (!test_true(
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/papyrussolution/OpenPapyrus/refs/heads/"
          "master/Src/OSF/OpenSSL-111/test/exptest.c",
          63, "BN_rand(a, 1024, BN_RAND_TOP_ONE, BN_RAND_BOTTOM_ANY)",
          (BN_rand(a, 1024, BN_RAND_TOP_ONE, BN_RAND_BOTTOM_ANY)) != 0))
    goto err;
  if (!test_true(
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/papyrussolution/OpenPapyrus/refs/heads/"
          "master/Src/OSF/OpenSSL-111/test/exptest.c",
          66, "BN_mod_exp(r, a, p, m, ctx)",
          (BN_mod_exp(r, a, p, m, ctx)) != 0))
    goto err;
  if (!test_true(
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/papyrussolution/OpenPapyrus/refs/heads/"
          "master/Src/OSF/OpenSSL-111/test/exptest.c",
          69, "a_is_zero_mod_one(\"BN_mod_exp\", r, a)",
          (a_is_zero_mod_one("BN_mod_exp", r, a)) != 0))
    failed = 1;
  if (!test_true(
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/papyrussolution/OpenPapyrus/refs/heads/"
          "master/Src/OSF/OpenSSL-111/test/exptest.c",
          72, "BN_mod_exp_recp(r, a, p, m, ctx)",
          (BN_mod_exp_recp(r, a, p, m, ctx)) != 0))
    goto err;
  if (!test_true(
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/papyrussolution/OpenPapyrus/refs/heads/"
          "master/Src/OSF/OpenSSL-111/test/exptest.c",
          75, "a_is_zero_mod_one(\"BN_mod_exp_recp\", r, a)",
          (a_is_zero_mod_one("BN_mod_exp_recp", r, a)) != 0))
    failed = 1;
  if (!test_true(
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/papyrussolution/OpenPapyrus/refs/heads/"
          "master/Src/OSF/OpenSSL-111/test/exptest.c",
          78, "BN_mod_exp_simple(r, a, p, m, ctx)",
          (BN_mod_exp_simple(r, a, p, m, ctx)) != 0))
    goto err;
  if (!test_true(
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/papyrussolution/OpenPapyrus/refs/heads/"
          "master/Src/OSF/OpenSSL-111/test/exptest.c",
          81, "a_is_zero_mod_one(\"BN_mod_exp_simple\", r, a)",
          (a_is_zero_mod_one("BN_mod_exp_simple", r, a)) != 0))
    failed = 1;
  if (!test_true(
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/papyrussolution/OpenPapyrus/refs/heads/"
          "master/Src/OSF/OpenSSL-111/test/exptest.c",
          84, "BN_mod_exp_mont(r, a, p, m, ctx, NULL)",
          (BN_mod_exp_mont(r, a, p, m, ctx, NULL)) != 0))
    goto err;
  if (!test_true(
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/papyrussolution/OpenPapyrus/refs/heads/"
          "master/Src/OSF/OpenSSL-111/test/exptest.c",
          87, "a_is_zero_mod_one(\"BN_mod_exp_mont\", r, a)",
          (a_is_zero_mod_one("BN_mod_exp_mont", r, a)) != 0))
    failed = 1;
  if (!test_true(
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/papyrussolution/OpenPapyrus/refs/heads/"
          "master/Src/OSF/OpenSSL-111/test/exptest.c",
          90, "BN_mod_exp_mont_consttime(r, a, p, m, ctx, NULL)",
          (BN_mod_exp_mont_consttime(r, a, p, m, ctx, NULL)) != 0))
    goto err;
  if (!test_true(
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/papyrussolution/OpenPapyrus/refs/heads/"
          "master/Src/OSF/OpenSSL-111/test/exptest.c",
          93, "a_is_zero_mod_one(\"BN_mod_exp_mont_consttime\", r, a)",
          (a_is_zero_mod_one("BN_mod_exp_mont_consttime", r, a)) != 0))
    failed = 1;
  if (!test_true(
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/papyrussolution/OpenPapyrus/refs/heads/"
          "master/Src/OSF/OpenSSL-111/test/exptest.c",
          100, "BN_mod_exp_mont_word(r, one_word, p, m, ctx, NULL)",
          (BN_mod_exp_mont_word(r, one_word, p, m, ctx, NULL)) != 0))
    goto err;
  if (!test_BN_eq_zero(
          "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
          "2022-01-22/02-19-57/repos/papyrussolution/OpenPapyrus/refs/heads/"
          "master/Src/OSF/OpenSSL-111/test/exptest.c",
          103, "r", r)) {
    test_error("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/papyrussolution/OpenPapyrus/"
               "refs/heads/master/Src/OSF/OpenSSL-111/test/exptest.c",
               104,
               "BN_mod_exp_mont_word failed: "
               "1 ** 0 mod 1 = r (should be 0)");
    test_output_bignum("r", r);
    goto err;
  }
  ret = !failed;
err:
  BN_free(r);
  BN_free(a);
  BN_free(p);
  BN_free(m);
  BN_CTX_free(ctx);
  return ret;
}


x86 assembly (clang, -O0):
<test_mod_exp_zero>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movq   $0x0,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movl   $0x1,-0x24(%rbp)
mov    $0x0,%al
call   10f0 <BN_CTX_new@plt>
mov    %rax,-0x30(%rbp)
movl   $0x1,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
mov    $0x0,%al
call   1070 <BN_new@plt>
mov    %rax,%rcx
mov    %rcx,-0x18(%rbp)
lea    0xd73(%rip),%rdi
mov    $0x35,%esi
lea    0xe12(%rip),%rdx
call   10a0 <test_ptr@plt>
cmp    $0x0,%eax
je     1334 <test_mod_exp_zero+0x104>
mov    $0x0,%al
call   1070 <BN_new@plt>
mov    %rax,%rcx
mov    %rcx,-0x8(%rbp)
lea    0xd44(%rip),%rdi
mov    $0x36,%esi
lea    0xdf0(%rip),%rdx
call   10a0 <test_ptr@plt>
cmp    $0x0,%eax
je     1334 <test_mod_exp_zero+0x104>
mov    $0x0,%al
call   1070 <BN_new@plt>
mov    %rax,%rcx
mov    %rcx,-0x10(%rbp)
lea    0xd15(%rip),%rdi
mov    $0x37,%esi
lea    0xdce(%rip),%rdx
call   10a0 <test_ptr@plt>
cmp    $0x0,%eax
je     1334 <test_mod_exp_zero+0x104>
mov    $0x0,%al
call   1070 <BN_new@plt>
mov    %rax,%rcx
mov    %rcx,-0x20(%rbp)
lea    0xce6(%rip),%rdi
mov    $0x38,%esi
lea    0xdac(%rip),%rdx
call   10a0 <test_ptr@plt>
cmp    $0x0,%eax
jne    1339 <test_mod_exp_zero+0x109>
jmp    1741 <test_mod_exp_zero+0x511>
mov    -0x18(%rbp),%rdi
call   1110 <BN_one@plt>
mov    -0x8(%rbp),%rdi
call   1110 <BN_one@plt>
mov    -0x10(%rbp),%rdi
call   1100 <BN_zero@plt>
mov    -0x8(%rbp),%rdi
mov    0x2c89(%rip),%rax
mov    (%rax),%edx
mov    0x2c70(%rip),%rax
mov    (%rax),%ecx
mov    $0x400,%esi
call   1030 <BN_rand@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%ecx
lea    0xc79(%rip),%rdi
mov    $0x3f,%esi
lea    0xd4c(%rip),%rdx
call   1050 <test_true@plt>
cmp    $0x0,%eax
jne    13a6 <test_mod_exp_zero+0x176>
jmp    1741 <test_mod_exp_zero+0x511>
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x30(%rbp),%r8
call   10e0 <BN_mod_exp@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%ecx
lea    0xc2e(%rip),%rdi
mov    $0x42,%esi
lea    0xd37(%rip),%rdx
call   1050 <test_true@plt>
cmp    $0x0,%eax
jne    13f1 <test_mod_exp_zero+0x1c1>
jmp    1741 <test_mod_exp_zero+0x511>
mov    -0x20(%rbp),%rsi
mov    -0x8(%rbp),%rdx
lea    0xd57(%rip),%rdi
call   1090 <a_is_zero_mod_one@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%ecx
lea    0xbe8(%rip),%rdi
mov    $0x45,%esi
lea    0xd0d(%rip),%rdx
call   1050 <test_true@plt>
cmp    $0x0,%eax
jne    1439 <test_mod_exp_zero+0x209>
movl   $0x1,-0x38(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x30(%rbp),%r8
call   1040 <BN_mod_exp_recp@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%ecx
lea    0xb9b(%rip),%rdi
mov    $0x48,%esi
lea    0xcf1(%rip),%rdx
call   1050 <test_true@plt>
cmp    $0x0,%eax
jne    1484 <test_mod_exp_zero+0x254>
jmp    1741 <test_mod_exp_zero+0x511>
mov    -0x20(%rbp),%rsi
mov    -0x8(%rbp),%rdx
lea    0xd1b(%rip),%rdi
call   1090 <a_is_zero_mod_one@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%ecx
lea    0xb55(%rip),%rdi
mov    $0x4b,%esi
lea    0xccc(%rip),%rdx
call   1050 <test_true@plt>
cmp    $0x0,%eax
jne    14cc <test_mod_exp_zero+0x29c>
movl   $0x1,-0x38(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x30(%rbp),%r8
call   10c0 <BN_mod_exp_simple@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%ecx
lea    0xb08(%rip),%rdi
mov    $0x4e,%esi
lea    0xcba(%rip),%rdx
call   1050 <test_true@plt>
cmp    $0x0,%eax
jne    1517 <test_mod_exp_zero+0x2e7>
jmp    1741 <test_mod_exp_zero+0x511>
mov    -0x20(%rbp),%rsi
mov    -0x8(%rbp),%rdx
lea    0xce8(%rip),%rdi
call   1090 <a_is_zero_mod_one@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%ecx
lea    0xac2(%rip),%rdi
mov    $0x51,%esi
lea    0xc97(%rip),%rdx
call   1050 <test_true@plt>
cmp    $0x0,%eax
jne    155f <test_mod_exp_zero+0x32f>
movl   $0x1,-0x38(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x30(%rbp),%r8
xor    %eax,%eax
mov    %eax,%r9d
call   1150 <BN_mod_exp_mont@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%ecx
lea    0xa70(%rip),%rdi
mov    $0x54,%esi
lea    0xc84(%rip),%rdx
call   1050 <test_true@plt>
cmp    $0x0,%eax
jne    15af <test_mod_exp_zero+0x37f>
jmp    1741 <test_mod_exp_zero+0x511>
mov    -0x20(%rbp),%rsi
mov    -0x8(%rbp),%rdx
lea    0xcb4(%rip),%rdi
call   1090 <a_is_zero_mod_one@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%ecx
lea    0xa2a(%rip),%rdi
mov    $0x57,%esi
lea    0xc65(%rip),%rdx
call   1050 <test_true@plt>
cmp    $0x0,%eax
jne    15f7 <test_mod_exp_zero+0x3c7>
movl   $0x1,-0x38(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x30(%rbp),%r8
xor    %eax,%eax
mov    %eax,%r9d
call   1120 <BN_mod_exp_mont_consttime@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%ecx
lea    0x9d8(%rip),%rdi
mov    $0x5a,%esi
lea    0xc4e(%rip),%rdx
call   1050 <test_true@plt>
cmp    $0x0,%eax
jne    1647 <test_mod_exp_zero+0x417>
jmp    1741 <test_mod_exp_zero+0x511>
mov    -0x20(%rbp),%rsi
mov    -0x8(%rbp),%rdx
lea    0xc92(%rip),%rdi
call   1090 <a_is_zero_mod_one@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%ecx
lea    0x992(%rip),%rdi
mov    $0x5d,%esi
lea    0xc39(%rip),%rdx
call   1050 <test_true@plt>
cmp    $0x0,%eax
jne    168f <test_mod_exp_zero+0x45f>
movl   $0x1,-0x38(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    -0x30(%rbp),%r8
xor    %eax,%eax
mov    %eax,%r9d
call   1130 <BN_mod_exp_mont_word@plt>
cmp    $0x0,%rax
setne  %al
and    $0x1,%al
movzbl %al,%ecx
lea    0x941(%rip),%rdi
mov    $0x64,%esi
lea    0xc37(%rip),%rdx
call   1050 <test_true@plt>
cmp    $0x0,%eax
jne    16de <test_mod_exp_zero+0x4ae>
jmp    1741 <test_mod_exp_zero+0x511>
mov    -0x20(%rbp),%rcx
lea    0x917(%rip),%rdi
mov    $0x67,%esi
lea    0xc40(%rip),%rdx
call   1080 <test_BN_eq_zero@plt>
cmp    $0x0,%eax
jne    1730 <test_mod_exp_zero+0x500>
lea    0x8f6(%rip),%rdi
mov    $0x68,%esi
lea    0xc21(%rip),%rdx
call   1140 <test_error@plt>
mov    -0x20(%rbp),%rsi
lea    0xc0f(%rip),%rdi
call   1060 <test_output_bignum@plt>
jmp    1741 <test_mod_exp_zero+0x511>
cmpl   $0x0,-0x38(%rbp)
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x34(%rbp)
mov    -0x20(%rbp),%rdi
call   10d0 <BN_free@plt>
mov    -0x8(%rbp),%rdi
call   10d0 <BN_free@plt>
mov    -0x10(%rbp),%rdi
call   10d0 <BN_free@plt>
mov    -0x18(%rbp),%rdi
call   10d0 <BN_free@plt>
mov    -0x30(%rbp),%rdi
call   10b0 <BN_CTX_free@plt>
mov    -0x34(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_mod_exp_zero>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
xor    %ebx,%ebx
xor    %eax,%eax
call   10f0 <BN_CTX_new@plt>
mov    %rax,%r14
xor    %eax,%eax
call   1070 <BN_new@plt>
mov    %rax,%r15
lea    0xda5(%rip),%rdi
lea    0xe49(%rip),%rdx
mov    $0x35,%esi
mov    %rax,%rcx
call   10a0 <test_ptr@plt>
mov    $0x1,%r13d
test   %eax,%eax
je     1650 <test_mod_exp_zero+0x420>
xor    %ebx,%ebx
xor    %eax,%eax
call   1070 <BN_new@plt>
mov    %rax,%r12
lea    0xd70(%rip),%rdi
lea    0xe21(%rip),%rdx
mov    $0x36,%esi
mov    %rax,%rcx
call   10a0 <test_ptr@plt>
test   %eax,%eax
je     1657 <test_mod_exp_zero+0x427>
xor    %ebx,%ebx
xor    %eax,%eax
call   1070 <BN_new@plt>
mov    %rax,%rbp
lea    0xd41(%rip),%rdi
lea    0xdff(%rip),%rdx
mov    $0x37,%esi
mov    %rax,%rcx
call   10a0 <test_ptr@plt>
test   %eax,%eax
je     1659 <test_mod_exp_zero+0x429>
xor    %eax,%eax
call   1070 <BN_new@plt>
mov    %rax,%rbx
lea    0xd14(%rip),%rdi
lea    0xddf(%rip),%rdx
mov    $0x38,%esi
mov    %rax,%rcx
call   10a0 <test_ptr@plt>
test   %eax,%eax
je     1659 <test_mod_exp_zero+0x429>
mov    %r15,%rdi
call   1110 <BN_one@plt>
mov    %r12,%rdi
call   1110 <BN_one@plt>
mov    %rbp,%rdi
call   1100 <BN_zero@plt>
mov    0x2cc1(%rip),%rax
mov    (%rax),%edx
mov    0x2ca8(%rip),%rax
mov    (%rax),%ecx
mov    %r12,%rdi
mov    $0x400,%esi
call   1030 <BN_rand@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
lea    0xcb2(%rip),%rdi
lea    0xd8a(%rip),%rdx
mov    $0x3f,%esi
call   1050 <test_true@plt>
test   %eax,%eax
je     1659 <test_mod_exp_zero+0x429>
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %rbp,%rdx
mov    %r15,%rcx
mov    %r14,%r8
call   10e0 <BN_mod_exp@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
lea    0xc76(%rip),%rdi
lea    0xd84(%rip),%rdx
mov    $0x42,%esi
call   1050 <test_true@plt>
test   %eax,%eax
je     1659 <test_mod_exp_zero+0x429>
lea    0xdad(%rip),%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
call   1090 <a_is_zero_mod_one@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
lea    0xc3c(%rip),%rdi
lea    0xd66(%rip),%rdx
mov    $0x45,%esi
call   1050 <test_true@plt>
mov    %eax,0x14(%rsp)
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %rbp,%rdx
mov    %r15,%rcx
mov    %r14,%r8
call   1040 <BN_mod_exp_recp@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
lea    0xd66(%rip),%rdx
lea    0xbfd(%rip),%rdi
mov    $0x48,%esi
call   1050 <test_true@plt>
test   %eax,%eax
je     1659 <test_mod_exp_zero+0x429>
lea    0xd92(%rip),%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
call   1090 <a_is_zero_mod_one@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
lea    0xbca(%rip),%rdi
lea    0xd46(%rip),%rdx
mov    $0x4b,%esi
call   1050 <test_true@plt>
mov    %eax,0x10(%rsp)
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %rbp,%rdx
mov    %r15,%rcx
mov    %r14,%r8
call   10c0 <BN_mod_exp_simple@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
lea    0xd50(%rip),%rdx
lea    0xb8b(%rip),%rdi
mov    $0x4e,%esi
call   1050 <test_true@plt>
test   %eax,%eax
je     1659 <test_mod_exp_zero+0x429>
lea    0xd80(%rip),%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
call   1090 <a_is_zero_mod_one@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
lea    0xb58(%rip),%rdi
lea    0xd32(%rip),%rdx
mov    $0x51,%esi
call   1050 <test_true@plt>
mov    %eax,0xc(%rsp)
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %rbp,%rdx
mov    %r15,%rcx
mov    %r14,%r8
xor    %r9d,%r9d
call   1150 <BN_mod_exp_mont@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
lea    0xd3d(%rip),%rdx
lea    0xb16(%rip),%rdi
mov    $0x54,%esi
call   1050 <test_true@plt>
test   %eax,%eax
je     1659 <test_mod_exp_zero+0x429>
lea    0xd6f(%rip),%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
call   1090 <a_is_zero_mod_one@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
lea    0xae3(%rip),%rdi
lea    0xd23(%rip),%rdx
mov    $0x57,%esi
call   1050 <test_true@plt>
mov    %eax,0x8(%rsp)
mov    %rbx,%rdi
mov    %r12,%rsi
mov    %rbp,%rdx
mov    %r15,%rcx
mov    %r14,%r8
xor    %r9d,%r9d
call   1120 <BN_mod_exp_mont_consttime@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
lea    0xd2a(%rip),%rdx
lea    0xaa1(%rip),%rdi
mov    $0x5a,%esi
call   1050 <test_true@plt>
test   %eax,%eax
je     1659 <test_mod_exp_zero+0x429>
cmpl   $0x0,0x8(%rsp)
setne  0x8(%rsp)
cmpl   $0x0,0x14(%rsp)
setne  0x14(%rsp)
cmpl   $0x0,0x10(%rsp)
setne  0x7(%rsp)
cmpl   $0x0,0xc(%rsp)
setne  0x10(%rsp)
lea    0xd48(%rip),%rdi
mov    %rbx,%rsi
mov    %r12,%rdx
call   1090 <a_is_zero_mod_one@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
lea    0xa46(%rip),%rdi
lea    0xcf2(%rip),%rdx
mov    $0x5d,%esi
call   1050 <test_true@plt>
test   %eax,%eax
setne  0xc(%rsp)
mov    $0x1,%r13d
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %rbp,%rdx
mov    %r15,%rcx
mov    %r14,%r8
xor    %r9d,%r9d
call   1130 <BN_mod_exp_mont_word@plt>
xor    %ecx,%ecx
test   %rax,%rax
setne  %cl
lea    0xd02(%rip),%rdx
lea    0x9f9(%rip),%rdi
mov    $0x64,%esi
call   1050 <test_true@plt>
test   %eax,%eax
je     1659 <test_mod_exp_zero+0x429>
lea    0x9e4(%rip),%rdi
lea    0xd12(%rip),%rdx
mov    $0x67,%esi
mov    %rbx,%rcx
call   1080 <test_BN_eq_zero@plt>
test   %eax,%eax
je     1693 <test_mod_exp_zero+0x463>
mov    0xc(%rsp),%cl
and    0x8(%rsp),%cl
mov    0x10(%rsp),%al
and    0x7(%rsp),%al
and    %cl,%al
and    0x14(%rsp),%al
movzbl %al,%r13d
jmp    1659 <test_mod_exp_zero+0x429>
xor    %ebp,%ebp
xor    %r12d,%r12d
jmp    1659 <test_mod_exp_zero+0x429>
xor    %ebp,%ebp
mov    %rbx,%rdi
call   10d0 <BN_free@plt>
mov    %r12,%rdi
call   10d0 <BN_free@plt>
mov    %rbp,%rdi
call   10d0 <BN_free@plt>
mov    %r15,%rdi
call   10d0 <BN_free@plt>
mov    %r14,%rdi
call   10b0 <BN_CTX_free@plt>
mov    %r13d,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0x966(%rip),%rdi
lea    0xc96(%rip),%rdx
mov    $0x68,%esi
call   1140 <test_error@plt>
lea    0xc83(%rip),%rdi
mov    %rbx,%rsi
call   1060 <test_output_bignum@plt>
jmp    1659 <test_mod_exp_zero+0x429>

LLVM IR (-O0):
@.str = [171 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/papyrussolution/OpenPapyrus/refs/heads/master/Src/OSF/OpenSSL-111/test/exptest.c\00"
@.str.1 = [13 x i8] c"m = BN_new()\00"
@.str.2 = [13 x i8] c"a = BN_new()\00"
@.str.3 = [13 x i8] c"p = BN_new()\00"
@.str.4 = [13 x i8] c"r = BN_new()\00"
@.str.5 = [54 x i8] c"BN_rand(a, 1024, BN_RAND_TOP_ONE, BN_RAND_BOTTOM_ANY)\00"
@BN_RAND_TOP_ONE = global i32 0
@BN_RAND_BOTTOM_ANY = global i32 0
@.str.6 = [28 x i8] c"BN_mod_exp(r, a, p, m, ctx)\00"
@.str.7 = [38 x i8] c"a_is_zero_mod_one(\22BN_mod_exp\22, r, a)\00"
@.str.8 = [11 x i8] c"BN_mod_exp\00"
@.str.9 = [33 x i8] c"BN_mod_exp_recp(r, a, p, m, ctx)\00"
@.str.10 = [43 x i8] c"a_is_zero_mod_one(\22BN_mod_exp_recp\22, r, a)\00"
@.str.11 = [16 x i8] c"BN_mod_exp_recp\00"
@.str.12 = [35 x i8] c"BN_mod_exp_simple(r, a, p, m, ctx)\00"
@.str.13 = [45 x i8] c"a_is_zero_mod_one(\22BN_mod_exp_simple\22, r, a)\00"
@.str.14 = [18 x i8] c"BN_mod_exp_simple\00"
@.str.15 = [39 x i8] c"BN_mod_exp_mont(r, a, p, m, ctx, NULL)\00"
@.str.16 = [43 x i8] c"a_is_zero_mod_one(\22BN_mod_exp_mont\22, r, a)\00"
@.str.17 = [16 x i8] c"BN_mod_exp_mont\00"
@.str.18 = [49 x i8] c"BN_mod_exp_mont_consttime(r, a, p, m, ctx, NULL)\00"
@.str.19 = [53 x i8] c"a_is_zero_mod_one(\22BN_mod_exp_mont_consttime\22, r, a)\00"
@.str.20 = [26 x i8] c"BN_mod_exp_mont_consttime\00"
@.str.21 = [51 x i8] c"BN_mod_exp_mont_word(r, one_word, p, m, ctx, NULL)\00"
@.str.22 = [2 x i8] c"r\00"
@.str.23 = [60 x i8] c"BN_mod_exp_mont_word failed: 1 ** 0 mod 1 = r (should be 0)\00"
define i32 @test_mod_exp_zero() {
%1 = alloca i32*
%2 = alloca i32*
%3 = alloca i32*
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
store i32* null, i32** %1
store i32* null, i32** %2
store i32* null, i32** %3
store i32* null, i32** %4
store i32 1, i32* %5
%9 = call i32* (...) @BN_CTX_new()
store i32* %9, i32** %6
store i32 1, i32* %7
store i32 0, i32* %8
%10 = call i32* (...) @BN_new()
store i32* %10, i32** %3
%11 = call i32 @test_ptr(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i32 53, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32* %10)
%12 = icmp ne i32 %11, 0
br i1 %12, label %13, label %25
13: ; preds = %0
%14 = call i32* (...) @BN_new()
store i32* %14, i32** %1
%15 = call i32 @test_ptr(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i32 54, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32* %14)
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %25
17: ; preds = %13
%18 = call i32* (...) @BN_new()
store i32* %18, i32** %2
%19 = call i32 @test_ptr(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i32 55, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32* %18)
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %25
21: ; preds = %17
%22 = call i32* (...) @BN_new()
store i32* %22, i32** %4
%23 = call i32 @test_ptr(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i32 56, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32* %22)
%24 = icmp ne i32 %23, 0
br i1 %24, label %26, label %25
25: ; preds = %21, %17, %13, %0
br label %172
26: ; preds = %21
%27 = load i32*, i32** %3
%28 = call i32 @BN_one(i32* %27)
%29 = load i32*, i32** %1
%30 = call i32 @BN_one(i32* %29)
%31 = load i32*, i32** %2
%32 = call i32 @BN_zero(i32* %31)
%33 = load i32*, i32** %1
%34 = load i32, i32* @BN_RAND_TOP_ONE
%35 = load i32, i32* @BN_RAND_BOTTOM_ANY
%36 = call i64 @BN_rand(i32* %33, i32 1024, i32 %34, i32 %35)
%37 = icmp ne i64 %36, 0
%38 = zext i1 %37 to i32
%39 = call i32 @test_true(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i32 63, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.5, i64 0, i64 0), i32 %38)
%40 = icmp ne i32 %39, 0
br i1 %40, label %42, label %41
41: ; preds = %26
br label %172
42: ; preds = %26
%43 = load i32*, i32** %4
%44 = load i32*, i32** %1
%45 = load i32*, i32** %2
%46 = load i32*, i32** %3
%47 = load i32*, i32** %6
%48 = call i64 @BN_mod_exp(i32* %43, i32* %44, i32* %45, i32* %46, i32* %47)
%49 = icmp ne i64 %48, 0
%50 = zext i1 %49 to i32
%51 = call i32 @test_true(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i32 66, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i32 %50)
%52 = icmp ne i32 %51, 0
br i1 %52, label %54, label %53
53: ; preds = %42
br label %172
54: ; preds = %42
%55 = load i32*, i32** %4
%56 = load i32*, i32** %1
%57 = call i64 @a_is_zero_mod_one(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i32* %55, i32* %56)
%58 = icmp ne i64 %57, 0
%59 = zext i1 %58 to i32
%60 = call i32 @test_true(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i32 69, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.7, i64 0, i64 0), i32 %59)
%61 = icmp ne i32 %60, 0
br i1 %61, label %63, label %62
62: ; preds = %54
store i32 1, i32* %8
br label %63
63: ; preds = %62, %54
%64 = load i32*, i32** %4
%65 = load i32*, i32** %1
%66 = load i32*, i32** %2
%67 = load i32*, i32** %3
%68 = load i32*, i32** %6
%69 = call i64 @BN_mod_exp_recp(i32* %64, i32* %65, i32* %66, i32* %67, i32* %68)
%70 = icmp ne i64 %69, 0
%71 = zext i1 %70 to i32
%72 = call i32 @test_true(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i32 72, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.9, i64 0, i64 0), i32 %71)
%73 = icmp ne i32 %72, 0
br i1 %73, label %75, label %74
74: ; preds = %63
br label %172
75: ; preds = %63
%76 = load i32*, i32** %4
%77 = load i32*, i32** %1
%78 = call i64 @a_is_zero_mod_one(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.11, i64 0, i64 0), i32* %76, i32* %77)
%79 = icmp ne i64 %78, 0
%80 = zext i1 %79 to i32
%81 = call i32 @test_true(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i32 75, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.10, i64 0, i64 0), i32 %80)
%82 = icmp ne i32 %81, 0
br i1 %82, label %84, label %83
83: ; preds = %75
store i32 1, i32* %8
br label %84
84: ; preds = %83, %75
%85 = load i32*, i32** %4
%86 = load i32*, i32** %1
%87 = load i32*, i32** %2
%88 = load i32*, i32** %3
%89 = load i32*, i32** %6
%90 = call i64 @BN_mod_exp_simple(i32* %85, i32* %86, i32* %87, i32* %88, i32* %89)
%91 = icmp ne i64 %90, 0
%92 = zext i1 %91 to i32
%93 = call i32 @test_true(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i32 78, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.12, i64 0, i64 0), i32 %92)
%94 = icmp ne i32 %93, 0
br i1 %94, label %96, label %95
95: ; preds = %84
br label %172
96: ; preds = %84
%97 = load i32*, i32** %4
%98 = load i32*, i32** %1
%99 = call i64 @a_is_zero_mod_one(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.14, i64 0, i64 0), i32* %97, i32* %98)
%100 = icmp ne i64 %99, 0
%101 = zext i1 %100 to i32
%102 = call i32 @test_true(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i32 81, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.13, i64 0, i64 0), i32 %101)
%103 = icmp ne i32 %102, 0
br i1 %103, label %105, label %104
104: ; preds = %96
store i32 1, i32* %8
br label %105
105: ; preds = %104, %96
%106 = load i32*, i32** %4
%107 = load i32*, i32** %1
%108 = load i32*, i32** %2
%109 = load i32*, i32** %3
%110 = load i32*, i32** %6
%111 = call i64 @BN_mod_exp_mont(i32* %106, i32* %107, i32* %108, i32* %109, i32* %110, i32* null)
%112 = icmp ne i64 %111, 0
%113 = zext i1 %112 to i32
%114 = call i32 @test_true(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i32 84, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.15, i64 0, i64 0), i32 %113)
%115 = icmp ne i32 %114, 0
br i1 %115, label %117, label %116
116: ; preds = %105
br label %172
117: ; preds = %105
%118 = load i32*, i32** %4
%119 = load i32*, i32** %1
%120 = call i64 @a_is_zero_mod_one(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.17, i64 0, i64 0), i32* %118, i32* %119)
%121 = icmp ne i64 %120, 0
%122 = zext i1 %121 to i32
%123 = call i32 @test_true(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i32 87, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.16, i64 0, i64 0), i32 %122)
%124 = icmp ne i32 %123, 0
br i1 %124, label %126, label %125
125: ; preds = %117
store i32 1, i32* %8
br label %126
126: ; preds = %125, %117
%127 = load i32*, i32** %4
%128 = load i32*, i32** %1
%129 = load i32*, i32** %2
%130 = load i32*, i32** %3
%131 = load i32*, i32** %6
%132 = call i64 @BN_mod_exp_mont_consttime(i32* %127, i32* %128, i32* %129, i32* %130, i32* %131, i32* null)
%133 = icmp ne i64 %132, 0
%134 = zext i1 %133 to i32
%135 = call i32 @test_true(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i32 90, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.18, i64 0, i64 0), i32 %134)
%136 = icmp ne i32 %135, 0
br i1 %136, label %138, label %137
137: ; preds = %126
br label %172
138: ; preds = %126
%139 = load i32*, i32** %4
%140 = load i32*, i32** %1
%141 = call i64 @a_is_zero_mod_one(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.20, i64 0, i64 0), i32* %139, i32* %140)
%142 = icmp ne i64 %141, 0
%143 = zext i1 %142 to i32
%144 = call i32 @test_true(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i32 93, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.19, i64 0, i64 0), i32 %143)
%145 = icmp ne i32 %144, 0
br i1 %145, label %147, label %146
146: ; preds = %138
store i32 1, i32* %8
br label %147
147: ; preds = %146, %138
%148 = load i32*, i32** %4
%149 = load i32, i32* %5
%150 = load i32*, i32** %2
%151 = load i32*, i32** %3
%152 = load i32*, i32** %6
%153 = call i64 @BN_mod_exp_mont_word(i32* %148, i32 %149, i32* %150, i32* %151, i32* %152, i32* null)
%154 = icmp ne i64 %153, 0
%155 = zext i1 %154 to i32
%156 = call i32 @test_true(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i32 100, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.21, i64 0, i64 0), i32 %155)
%157 = icmp ne i32 %156, 0
br i1 %157, label %159, label %158
158: ; preds = %147
br label %172
159: ; preds = %147
%160 = load i32*, i32** %4
%161 = call i32 @test_BN_eq_zero(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i32 103, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.22, i64 0, i64 0), i32* %160)
%162 = icmp ne i32 %161, 0
br i1 %162, label %167, label %163
163: ; preds = %159
%164 = call i32 @test_error(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i32 104, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.23, i64 0, i64 0))
%165 = load i32*, i32** %4
%166 = call i32 @test_output_bignum(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.22, i64 0, i64 0), i32* %165)
br label %172
167: ; preds = %159
%168 = load i32, i32* %8
%169 = icmp ne i32 %168, 0
%170 = xor i1 %169, true
%171 = zext i1 %170 to i32
store i32 %171, i32* %7
br label %172
172: ; preds = %167, %163, %158, %137, %116, %95, %74, %53, %41, %25
%173 = load i32*, i32** %4
%174 = call i32 @BN_free(i32* %173)
%175 = load i32*, i32** %1
%176 = call i32 @BN_free(i32* %175)
%177 = load i32*, i32** %2
%178 = call i32 @BN_free(i32* %177)
%179 = load i32*, i32** %3
%180 = call i32 @BN_free(i32* %179)
%181 = load i32*, i32** %6
%182 = call i32 @BN_CTX_free(i32* %181)
%183 = load i32, i32* %7
ret i32 %183
}

LLVM IR (-O2):
@.str = [171 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/papyrussolution/OpenPapyrus/refs/heads/master/Src/OSF/OpenSSL-111/test/exptest.c\00"
@.str.1 = [13 x i8] c"m = BN_new()\00"
@.str.2 = [13 x i8] c"a = BN_new()\00"
@.str.3 = [13 x i8] c"p = BN_new()\00"
@.str.4 = [13 x i8] c"r = BN_new()\00"
@.str.5 = [54 x i8] c"BN_rand(a, 1024, BN_RAND_TOP_ONE, BN_RAND_BOTTOM_ANY)\00"
@BN_RAND_TOP_ONE = global i32 0
@BN_RAND_BOTTOM_ANY = global i32 0
@.str.6 = [28 x i8] c"BN_mod_exp(r, a, p, m, ctx)\00"
@.str.7 = [38 x i8] c"a_is_zero_mod_one(\22BN_mod_exp\22, r, a)\00"
@.str.8 = [11 x i8] c"BN_mod_exp\00"
@.str.9 = [33 x i8] c"BN_mod_exp_recp(r, a, p, m, ctx)\00"
@.str.10 = [43 x i8] c"a_is_zero_mod_one(\22BN_mod_exp_recp\22, r, a)\00"
@.str.11 = [16 x i8] c"BN_mod_exp_recp\00"
@.str.12 = [35 x i8] c"BN_mod_exp_simple(r, a, p, m, ctx)\00"
@.str.13 = [45 x i8] c"a_is_zero_mod_one(\22BN_mod_exp_simple\22, r, a)\00"
@.str.14 = [18 x i8] c"BN_mod_exp_simple\00"
@.str.15 = [39 x i8] c"BN_mod_exp_mont(r, a, p, m, ctx, NULL)\00"
@.str.16 = [43 x i8] c"a_is_zero_mod_one(\22BN_mod_exp_mont\22, r, a)\00"
@.str.17 = [16 x i8] c"BN_mod_exp_mont\00"
@.str.18 = [49 x i8] c"BN_mod_exp_mont_consttime(r, a, p, m, ctx, NULL)\00"
@.str.19 = [53 x i8] c"a_is_zero_mod_one(\22BN_mod_exp_mont_consttime\22, r, a)\00"
@.str.20 = [26 x i8] c"BN_mod_exp_mont_consttime\00"
@.str.21 = [51 x i8] c"BN_mod_exp_mont_word(r, one_word, p, m, ctx, NULL)\00"
@.str.22 = [2 x i8] c"r\00"
@.str.23 = [60 x i8] c"BN_mod_exp_mont_word failed: 1 ** 0 mod 1 = r (should be 0)\00"
define i32 @test_mod_exp_zero() {
%1 = tail call i32* (...) @BN_CTX_new()
%2 = tail call i32* (...) @BN_new()
%3 = tail call i32 @test_ptr(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i32 53, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%4 = icmp eq i32 %3, 0
br i1 %4, label %101, label %5
5: ; preds = %0
%6 = tail call i32* (...) @BN_new()
%7 = tail call i32 @test_ptr(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i32 54, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0), i32* %6)
%8 = icmp eq i32 %7, 0
br i1 %8, label %101, label %9
9: ; preds = %5
%10 = tail call i32* (...) @BN_new()
%11 = tail call i32 @test_ptr(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i32 55, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.3, i64 0, i64 0), i32* %10)
%12 = icmp eq i32 %11, 0
br i1 %12, label %101, label %13
13: ; preds = %9
%14 = tail call i32* (...) @BN_new()
%15 = tail call i32 @test_ptr(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i32 56, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i32* %14)
%16 = icmp eq i32 %15, 0
br i1 %16, label %101, label %17
17: ; preds = %13
%18 = tail call i32 @BN_one(i32* %2)
%19 = tail call i32 @BN_one(i32* %6)
%20 = tail call i32 @BN_zero(i32* %10)
%21 = load i32, i32* @BN_RAND_TOP_ONE
%22 = load i32, i32* @BN_RAND_BOTTOM_ANY
%23 = tail call i64 @BN_rand(i32* %6, i32 1024, i32 %21, i32 %22)
%24 = icmp ne i64 %23, 0
%25 = zext i1 %24 to i32
%26 = tail call i32 @test_true(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i32 63, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.5, i64 0, i64 0), i32 %25)
%27 = icmp eq i32 %26, 0
br i1 %27, label %101, label %28
28: ; preds = %17
%29 = tail call i64 @BN_mod_exp(i32* %14, i32* %6, i32* %10, i32* %2, i32* %1)
%30 = icmp ne i64 %29, 0
%31 = zext i1 %30 to i32
%32 = tail call i32 @test_true(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i32 66, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.6, i64 0, i64 0), i32 %31)
%33 = icmp eq i32 %32, 0
br i1 %33, label %101, label %34
34: ; preds = %28
%35 = tail call i64 @a_is_zero_mod_one(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.8, i64 0, i64 0), i32* %14, i32* %6)
%36 = icmp ne i64 %35, 0
%37 = zext i1 %36 to i32
%38 = tail call i32 @test_true(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i32 69, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.7, i64 0, i64 0), i32 %37)
%39 = tail call i64 @BN_mod_exp_recp(i32* %14, i32* %6, i32* %10, i32* %2, i32* %1)
%40 = icmp ne i64 %39, 0
%41 = zext i1 %40 to i32
%42 = tail call i32 @test_true(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i32 72, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.9, i64 0, i64 0), i32 %41)
%43 = icmp eq i32 %42, 0
br i1 %43, label %101, label %44
44: ; preds = %34
%45 = tail call i64 @a_is_zero_mod_one(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.11, i64 0, i64 0), i32* %14, i32* %6)
%46 = icmp ne i64 %45, 0
%47 = zext i1 %46 to i32
%48 = tail call i32 @test_true(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i32 75, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.10, i64 0, i64 0), i32 %47)
%49 = tail call i64 @BN_mod_exp_simple(i32* %14, i32* %6, i32* %10, i32* %2, i32* %1)
%50 = icmp ne i64 %49, 0
%51 = zext i1 %50 to i32
%52 = tail call i32 @test_true(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i32 78, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.12, i64 0, i64 0), i32 %51)
%53 = icmp eq i32 %52, 0
br i1 %53, label %101, label %54
54: ; preds = %44
%55 = tail call i64 @a_is_zero_mod_one(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.14, i64 0, i64 0), i32* %14, i32* %6)
%56 = icmp ne i64 %55, 0
%57 = zext i1 %56 to i32
%58 = tail call i32 @test_true(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i32 81, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.13, i64 0, i64 0), i32 %57)
%59 = tail call i64 @BN_mod_exp_mont(i32* %14, i32* %6, i32* %10, i32* %2, i32* %1, i32* null)
%60 = icmp ne i64 %59, 0
%61 = zext i1 %60 to i32
%62 = tail call i32 @test_true(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i32 84, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.15, i64 0, i64 0), i32 %61)
%63 = icmp eq i32 %62, 0
br i1 %63, label %101, label %64
64: ; preds = %54
%65 = tail call i64 @a_is_zero_mod_one(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.17, i64 0, i64 0), i32* %14, i32* %6)
%66 = icmp ne i64 %65, 0
%67 = zext i1 %66 to i32
%68 = tail call i32 @test_true(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i32 87, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.16, i64 0, i64 0), i32 %67)
%69 = tail call i64 @BN_mod_exp_mont_consttime(i32* %14, i32* %6, i32* %10, i32* %2, i32* %1, i32* null)
%70 = icmp ne i64 %69, 0
%71 = zext i1 %70 to i32
%72 = tail call i32 @test_true(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i32 90, i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.18, i64 0, i64 0), i32 %71)
%73 = icmp eq i32 %72, 0
br i1 %73, label %101, label %74
74: ; preds = %64
%75 = icmp ne i32 %68, 0
%76 = icmp ne i32 %38, 0
%77 = icmp ne i32 %48, 0
%78 = icmp ne i32 %58, 0
%79 = tail call i64 @a_is_zero_mod_one(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.20, i64 0, i64 0), i32* %14, i32* %6)
%80 = icmp ne i64 %79, 0
%81 = zext i1 %80 to i32
%82 = tail call i32 @test_true(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i32 93, i8* getelementptr inbounds ([53 x i8], [53 x i8]* @.str.19, i64 0, i64 0), i32 %81)
%83 = icmp ne i32 %82, 0
%84 = select i1 %83, i1 %75, i1 false
%85 = select i1 %84, i1 %78, i1 false
%86 = select i1 %85, i1 %77, i1 false
%87 = select i1 %86, i1 %76, i1 false
%88 = tail call i64 @BN_mod_exp_mont_word(i32* %14, i32 1, i32* %10, i32* %2, i32* %1, i32* null)
%89 = icmp ne i64 %88, 0
%90 = zext i1 %89 to i32
%91 = tail call i32 @test_true(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i32 100, i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.21, i64 0, i64 0), i32 %90)
%92 = icmp eq i32 %91, 0
br i1 %92, label %101, label %93
93: ; preds = %74
%94 = tail call i32 @test_BN_eq_zero(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i32 103, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.22, i64 0, i64 0), i32* %14)
%95 = icmp eq i32 %94, 0
br i1 %95, label %96, label %99
96: ; preds = %93
%97 = tail call i32 @test_error(i8* getelementptr inbounds ([171 x i8], [171 x i8]* @.str, i64 0, i64 0), i32 104, i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.23, i64 0, i64 0))
%98 = tail call i32 @test_output_bignum(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.22, i64 0, i64 0), i32* %14)
br label %101
99: ; preds = %93
%100 = zext i1 %87 to i32
br label %101
101: ; preds = %74, %64, %54, %44, %34, %28, %17, %0, %5, %9, %13, %99, %96
%102 = phi i32* [ %14, %99 ], [ %14, %96 ], [ %14, %74 ], [ %14, %64 ], [ %14, %54 ], [ %14, %44 ], [ %14, %34 ], [ %14, %28 ], [ %14, %17 ], [ %14, %13 ], [ null, %9 ], [ null, %5 ], [ null, %0 ]
%103 = phi i32* [ %10, %99 ], [ %10, %96 ], [ %10, %74 ], [ %10, %64 ], [ %10, %54 ], [ %10, %44 ], [ %10, %34 ], [ %10, %28 ], [ %10, %17 ], [ %10, %13 ], [ %10, %9 ], [ null, %5 ], [ null, %0 ]
%104 = phi i32* [ %6, %99 ], [ %6, %96 ], [ %6, %74 ], [ %6, %64 ], [ %6, %54 ], [ %6, %44 ], [ %6, %34 ], [ %6, %28 ], [ %6, %17 ], [ %6, %13 ], [ %6, %9 ], [ %6, %5 ], [ null, %0 ]
%105 = phi i32 [ %100, %99 ], [ 1, %96 ], [ 1, %74 ], [ 1, %64 ], [ 1, %54 ], [ 1, %44 ], [ 1, %34 ], [ 1, %28 ], [ 1, %17 ], [ 1, %13 ], [ 1, %9 ], [ 1, %5 ], [ 1, %0 ]
%106 = tail call i32 @BN_free(i32* %102)
%107 = tail call i32 @BN_free(i32* %104)
%108 = tail call i32 @BN_free(i32* %103)
%109 = tail call i32 @BN_free(i32* %2)
%110 = tail call i32 @BN_CTX_free(i32* %1)
ret i32 %105
}