#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*/ FILE;

/* Variables and functions */
scalar_t__ FindMarker(int /*<<< orphan*/ *, char *);
int /*<<< orphan*/ ReadHex(int /*<<< orphan*/ *, unsigned char *, int, char *);
int crypto_kem_dec_SIKEp434(unsigned char *, unsigned char *, unsigned char *);
int crypto_kem_enc_SIKEp434(unsigned char *, unsigned char *, unsigned char *);
int crypto_kem_keypair_SIKEp434(unsigned char *, unsigned char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int fscanf(int /*<<< orphan*/ *, char *, int *);
scalar_t__ memcmp(unsigned char *, unsigned char *, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ randombytes_init(unsigned char *, int /*<<< orphan*/ *, int);
int /*<<< orphan*/ sprintf(char *, char *, int);
int main() {
  char fn_rsp[32];
  FILE *fp_rsp;
  unsigned char seed[48];
  unsigned char ct[346], ss[16], ss1[16], ct_rsp[346], ss_rsp[16];
  int count;
  int done;
  unsigned char pk[330], sk[374], pk_rsp[330], sk_rsp[374];
  int ret_val;
  sprintf(fn_rsp, "KAT/PQCkemKAT_%d.rsp", 374);
  if ((fp_rsp = fopen(fn_rsp, "r")) == NULL) {
    printf("Couldn't open <%s> for read\n", fn_rsp);
    return -1;
  }
  printf("# %s\n\n", "SIKEp434");
  done = 0;
  do {
    if (FindMarker(fp_rsp, "count = ")) {
      if (fscanf(fp_rsp, "%d", &count) != 1) {
        done = 1;
        break;
      }
    } else {
      done = 1;
      break;
    }
    if (!ReadHex(fp_rsp, seed, 48, "seed = ")) {
      printf("ERROR: unable to read 'seed' from <%s>\n", fn_rsp);
      return -3;
    }
    randombytes_init(seed, NULL, 256);
    if ((ret_val = crypto_kem_keypair_SIKEp434(pk, sk)) != 0) {
      printf("crypto_kem_keypair returned <%d>\n", ret_val);
      return -4;
    }
    if (!ReadHex(fp_rsp, pk_rsp, 330, "pk = ")) {
      printf("ERROR: unable to read 'pk' from <%s>\n", fn_rsp);
      return -3;
    }
    if (!ReadHex(fp_rsp, sk_rsp, 374, "sk = ")) {
      printf("ERROR: unable to read 'sk' from <%s>\n", fn_rsp);
      return -3;
    }
    if (memcmp(pk, pk_rsp, 330) != 0) {
      printf("ERROR: pk is different from <%s>\n", fn_rsp);
      return -2;
    }
    if (memcmp(sk, sk_rsp, 374) != 0) {
      printf("ERROR: sk is different from <%s>\n", fn_rsp);
      return -2;
    }
    if ((ret_val = crypto_kem_enc_SIKEp434(ct, ss, pk)) != 0) {
      printf("crypto_kem_enc returned <%d>\n", ret_val);
      return -4;
    }
    if (!ReadHex(fp_rsp, ct_rsp, 346, "ct = ")) {
      printf("ERROR: unable to read 'pk' from <%s>\n", fn_rsp);
      return -3;
    }
    if (!ReadHex(fp_rsp, ss_rsp, 16, "ss = ")) {
      printf("ERROR: unable to read 'sk' from <%s>\n", fn_rsp);
      return -3;
    }
    if (memcmp(ct, ct_rsp, 346) != 0) {
      printf("ERROR: ct is different from <%s>\n", fn_rsp);
      return -2;
    }
    if (memcmp(ss, ss_rsp, 16) != 0) {
      printf("ERROR: ss is different from <%s>\n", fn_rsp);
      return -2;
    }
    if ((ret_val = crypto_kem_dec_SIKEp434(ss1, ct, sk)) != 0) {
      printf("crypto_kem_dec returned <%d>\n", ret_val);
      return -4;
    }
    if (memcmp(ss, ss1, 16)) {
      printf("crypto_kem_dec returned bad 'ss' value\n");
      return -4;
    }
  } while (!done);
  fclose(fp_rsp);
  printf("Known Answer Tests PASSED. \n");
  printf("\n\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x920,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x30(%rbp),%rdi
lea    0xe23(%rip),%rsi
mov    $0x176,%edx
call   10e0 <sprintf@plt>
lea    -0x30(%rbp),%rdi
lea    0xe23(%rip),%rsi
call   10d0 <fopen@plt>
mov    %rax,-0x38(%rbp)
cmp    $0x0,%rax
jne    1223 <main+0x63>
lea    -0x30(%rbp),%rsi
lea    0xe07(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1652 <main+0x492>
lea    0xe0a(%rip),%rdi
lea    0xe0a(%rip),%rsi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x0,-0x368(%rbp)
mov    -0x38(%rbp),%rdi
lea    0xdf7(%rip),%rsi
call   10c0 <FindMarker@plt>
cmp    $0x0,%rax
je     1290 <main+0xd0>
mov    -0x38(%rbp),%rdi
lea    0xde6(%rip),%rsi
lea    -0x364(%rbp),%rdx
call   1080 <fscanf@plt>
cmp    $0x1,%eax
je     128b <main+0xcb>
movl   $0x1,-0x368(%rbp)
jmp    1626 <main+0x466>
jmp    129f <main+0xdf>
movl   $0x1,-0x368(%rbp)
jmp    1626 <main+0x466>
mov    -0x38(%rbp),%rdi
lea    -0x70(%rbp),%rsi
mov    $0x30,%edx
lea    0xd9d(%rip),%rcx
call   1060 <ReadHex@plt>
cmp    $0x0,%eax
jne    12df <main+0x11f>
lea    -0x30(%rbp),%rsi
lea    0xd8c(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0xfffffffd,-0x4(%rbp)
jmp    1652 <main+0x492>
lea    -0x70(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x100,%edx
call   10b0 <randombytes_init@plt>
lea    -0x4c0(%rbp),%rdi
lea    -0x640(%rbp),%rsi
call   1050 <crypto_kem_keypair_SIKEp434@plt>
mov    %eax,-0x914(%rbp)
cmp    $0x0,%eax
je     1333 <main+0x173>
mov    -0x914(%rbp),%esi
lea    0xd60(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0xfffffffc,-0x4(%rbp)
jmp    1652 <main+0x492>
mov    -0x38(%rbp),%rdi
lea    -0x790(%rbp),%rsi
mov    $0x14a,%edx
lea    0xd58(%rip),%rcx
call   1060 <ReadHex@plt>
cmp    $0x0,%eax
jne    1376 <main+0x1b6>
lea    -0x30(%rbp),%rsi
lea    0xd45(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0xfffffffd,-0x4(%rbp)
jmp    1652 <main+0x492>
mov    -0x38(%rbp),%rdi
lea    -0x910(%rbp),%rsi
mov    $0x176,%edx
lea    0xd41(%rip),%rcx
call   1060 <ReadHex@plt>
cmp    $0x0,%eax
jne    13b9 <main+0x1f9>
lea    -0x30(%rbp),%rsi
lea    0xd2e(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0xfffffffd,-0x4(%rbp)
jmp    1652 <main+0x492>
lea    -0x4c0(%rbp),%rdi
lea    -0x790(%rbp),%rsi
mov    $0x14a,%edx
call   1090 <memcmp@plt>
cmp    $0x0,%rax
je     13f9 <main+0x239>
lea    -0x30(%rbp),%rsi
lea    0xd14(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0xfffffffe,-0x4(%rbp)
jmp    1652 <main+0x492>
lea    -0x640(%rbp),%rdi
lea    -0x910(%rbp),%rsi
mov    $0x176,%edx
call   1090 <memcmp@plt>
cmp    $0x0,%rax
je     1439 <main+0x279>
lea    -0x30(%rbp),%rsi
lea    0xcf6(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0xfffffffe,-0x4(%rbp)
jmp    1652 <main+0x492>
lea    -0x1d0(%rbp),%rdi
lea    -0x1e0(%rbp),%rsi
lea    -0x4c0(%rbp),%rdx
call   1030 <crypto_kem_enc_SIKEp434@plt>
mov    %eax,-0x914(%rbp)
cmp    $0x0,%eax
je     1482 <main+0x2c2>
mov    -0x914(%rbp),%esi
lea    0xccf(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0xfffffffc,-0x4(%rbp)
jmp    1652 <main+0x492>
mov    -0x38(%rbp),%rdi
lea    -0x350(%rbp),%rsi
mov    $0x15a,%edx
lea    0xcc3(%rip),%rcx
call   1060 <ReadHex@plt>
cmp    $0x0,%eax
jne    14c5 <main+0x305>
lea    -0x30(%rbp),%rsi
lea    0xbf6(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0xfffffffd,-0x4(%rbp)
jmp    1652 <main+0x492>
mov    -0x38(%rbp),%rdi
lea    -0x360(%rbp),%rsi
mov    $0x10,%edx
lea    0xc86(%rip),%rcx
call   1060 <ReadHex@plt>
cmp    $0x0,%eax
jne    1508 <main+0x348>
lea    -0x30(%rbp),%rsi
lea    0xbdf(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0xfffffffd,-0x4(%rbp)
jmp    1652 <main+0x492>
lea    -0x1d0(%rbp),%rdi
lea    -0x350(%rbp),%rsi
mov    $0x15a,%edx
call   1090 <memcmp@plt>
cmp    $0x0,%rax
je     1548 <main+0x388>
lea    -0x30(%rbp),%rsi
lea    0xc33(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0xfffffffe,-0x4(%rbp)
jmp    1652 <main+0x492>
lea    -0x1e0(%rbp),%rdi
lea    -0x360(%rbp),%rsi
mov    $0x10,%edx
call   1090 <memcmp@plt>
cmp    $0x0,%rax
je     1588 <main+0x3c8>
lea    -0x30(%rbp),%rsi
lea    0xc15(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0xfffffffe,-0x4(%rbp)
jmp    1652 <main+0x492>
lea    -0x1f0(%rbp),%rdi
lea    -0x1d0(%rbp),%rsi
lea    -0x640(%rbp),%rdx
call   10a0 <crypto_kem_dec_SIKEp434@plt>
mov    %eax,-0x914(%rbp)
cmp    $0x0,%eax
je     15d1 <main+0x411>
mov    -0x914(%rbp),%esi
lea    0xbee(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0xfffffffc,-0x4(%rbp)
jmp    1652 <main+0x492>
lea    -0x1e0(%rbp),%rdi
lea    -0x1f0(%rbp),%rsi
mov    $0x10,%edx
call   1090 <memcmp@plt>
cmp    $0x0,%rax
je     160d <main+0x44d>
lea    0xbd0(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0xfffffffc,-0x4(%rbp)
jmp    1652 <main+0x492>
jmp    1612 <main+0x452>
cmpl   $0x0,-0x368(%rbp)
setne  %al
xor    $0xff,%al
test   $0x1,%al
jne    1242 <main+0x82>
mov    -0x38(%rbp),%rdi
call   1040 <fclose@plt>
lea    0xbbc(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
lea    0x9f4(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x920,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x8e8,%rsp
lea    0xe18(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x176,%edx
call   10f0 <sprintf@plt>
lea    0xe16(%rip),%rsi
mov    %rbx,%rdi
call   10e0 <fopen@plt>
test   %rax,%rax
je     1440 <main+0x270>
mov    %rax,%r13
lea    0xe1a(%rip),%rdi
lea    0xe1a(%rip),%rsi
xor    %eax,%eax
call   1080 <printf@plt>
lea    0xe15(%rip),%rsi
lea    0x770(%rsp),%r12
lea    0x5f0(%rsp),%r14
lea    0x490(%rsp),%rbp
mov    %r13,%rdi
call   10d0 <FindMarker@plt>
test   %rax,%rax
je     145b <main+0x28b>
mov    %r13,%rdi
lea    0xdeb(%rip),%rsi
lea    0x2c(%rsp),%rdx
call   1090 <fscanf@plt>
cmp    $0x1,%eax
jne    145b <main+0x28b>
mov    %rbp,%r15
mov    %r13,%rdi
mov    %r12,%r13
mov    %r14,%rbx
lea    0x1e0(%rsp),%r14
mov    %rdi,%rbp
lea    0x60(%rsp),%r12
mov    %r12,%rsi
mov    $0x30,%edx
lea    0xdb0(%rip),%rcx
call   1070 <ReadHex@plt>
test   %eax,%eax
je     1494 <main+0x2c4>
mov    %r12,%rdi
xor    %esi,%esi
mov    $0x100,%edx
call   10c0 <randombytes_init@plt>
lea    0x90(%rsp),%rdi
mov    %r13,%r12
mov    %r13,%rsi
call   1060 <crypto_kem_keypair_SIKEp434@plt>
test   %eax,%eax
jne    14ac <main+0x2dc>
mov    %rbp,%r13
mov    %rbp,%rdi
mov    %r14,%rbp
mov    %r14,%rsi
mov    $0x14a,%edx
lea    0xdb3(%rip),%rcx
call   1070 <ReadHex@plt>
test   %eax,%eax
je     1482 <main+0x2b2>
mov    %r13,%rdi
mov    %rbx,%r14
mov    %rbx,%rsi
mov    $0x176,%edx
lea    0xdbd(%rip),%rcx
call   1070 <ReadHex@plt>
test   %eax,%eax
je     148b <main+0x2bb>
lea    0x90(%rsp),%rdi
mov    %rbp,%rsi
mov    $0x14a,%edx
call   10a0 <memcmp@plt>
test   %rax,%rax
jne    14b5 <main+0x2e5>
mov    %r12,%rdi
mov    %r14,%rsi
mov    $0x176,%edx
call   10a0 <memcmp@plt>
test   %rax,%rax
jne    14be <main+0x2ee>
mov    %r15,%rbp
mov    %r15,%rdi
lea    0x50(%rsp),%r15
mov    %r15,%rsi
lea    0x90(%rsp),%rdx
call   1040 <crypto_kem_enc_SIKEp434@plt>
test   %eax,%eax
jne    14c7 <main+0x2f7>
mov    %r13,%rdi
lea    0x330(%rsp),%rbx
mov    %rbx,%rsi
mov    $0x15a,%edx
lea    0xdca(%rip),%rcx
call   1070 <ReadHex@plt>
test   %eax,%eax
je     1482 <main+0x2b2>
mov    %r13,%rdi
lea    0x30(%rsp),%rsi
mov    $0x10,%edx
lea    0xdaf(%rip),%rcx
call   1070 <ReadHex@plt>
test   %eax,%eax
je     148b <main+0x2bb>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    $0x15a,%edx
call   10a0 <memcmp@plt>
test   %rax,%rax
jne    14d0 <main+0x300>
mov    %r15,%rdi
lea    0x30(%rsp),%rsi
mov    $0x10,%edx
call   10a0 <memcmp@plt>
test   %rax,%rax
jne    14d9 <main+0x309>
lea    0x40(%rsp),%rbx
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    %r12,%rdx
call   10b0 <crypto_kem_dec_SIKEp434@plt>
test   %eax,%eax
jne    14f1 <main+0x321>
mov    %r15,%rdi
mov    %rbx,%rsi
mov    $0x10,%edx
call   10a0 <memcmp@plt>
test   %rax,%rax
lea    0xc1b(%rip),%rsi
je     1247 <main+0x77>
lea    0xdb0(%rip),%rdi
call   1030 <puts@plt>
jmp    1501 <main+0x331>
lea    0xbd0(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    $0xffffffff,%eax
jmp    1506 <main+0x336>
mov    %r13,%rdi
call   1050 <fclose@plt>
lea    0xd60(%rip),%rdi
call   1030 <puts@plt>
lea    0xbc3(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
jmp    1506 <main+0x336>
lea    0xc1f(%rip),%rdi
jmp    149b <main+0x2cb>
lea    0xc42(%rip),%rdi
jmp    149b <main+0x2cb>
lea    0xbbd(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    $0xfffffffd,%eax
jmp    1506 <main+0x336>
lea    0xbcd(%rip),%rdi
jmp    14f8 <main+0x328>
lea    0xc3e(%rip),%rdi
jmp    14e0 <main+0x310>
lea    0xc57(%rip),%rdi
jmp    14e0 <main+0x310>
lea    0xc70(%rip),%rdi
jmp    14f8 <main+0x328>
lea    0xc91(%rip),%rdi
jmp    14e0 <main+0x310>
lea    0xcaa(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1080 <printf@plt>
mov    $0xfffffffe,%eax
jmp    1506 <main+0x336>
lea    0xcb4(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1080 <printf@plt>
mov    $0xfffffffc,%eax
add    $0x8e8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [21 x i8] c"KAT/PQCkemKAT_%d.rsp\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [29 x i8] c"Couldn't open <%s> for read\0A\00"
@.str.3 = [7 x i8] c"# %s\0A\0A\00"
@.str.4 = [9 x i8] c"SIKEp434\00"
@.str.5 = [9 x i8] c"count = \00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [8 x i8] c"seed = \00"
@.str.8 = [40 x i8] c"ERROR: unable to read 'seed' from <%s>\0A\00"
@.str.9 = [34 x i8] c"crypto_kem_keypair returned <%d>\0A\00"
@.str.10 = [6 x i8] c"pk = \00"
@.str.11 = [38 x i8] c"ERROR: unable to read 'pk' from <%s>\0A\00"
@.str.12 = [6 x i8] c"sk = \00"
@.str.13 = [38 x i8] c"ERROR: unable to read 'sk' from <%s>\0A\00"
@.str.14 = [34 x i8] c"ERROR: pk is different from <%s>\0A\00"
@.str.15 = [34 x i8] c"ERROR: sk is different from <%s>\0A\00"
@.str.16 = [30 x i8] c"crypto_kem_enc returned <%d>\0A\00"
@.str.17 = [6 x i8] c"ct = \00"
@.str.18 = [6 x i8] c"ss = \00"
@.str.19 = [34 x i8] c"ERROR: ct is different from <%s>\0A\00"
@.str.20 = [34 x i8] c"ERROR: ss is different from <%s>\0A\00"
@.str.21 = [30 x i8] c"crypto_kem_dec returned <%d>\0A\00"
@.str.22 = [40 x i8] c"crypto_kem_dec returned bad 'ss' value\0A\00"
@.str.23 = [29 x i8] c"Known Answer Tests PASSED. \0A\00"
@.str.24 = [3 x i8] c"\0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [32 x i8]
%3 = alloca i32*
%4 = alloca [48 x i8]
%5 = alloca [346 x i8]
%6 = alloca [16 x i8]
%7 = alloca [16 x i8]
%8 = alloca [346 x i8]
%9 = alloca [16 x i8]
%10 = alloca i32
%11 = alloca i32
%12 = alloca [330 x i8]
%13 = alloca [374 x i8]
%14 = alloca [330 x i8]
%15 = alloca [374 x i8]
%16 = alloca i32
store i32 0, i32* %1
%17 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%18 = call i32 @sprintf(i8* %17, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 374)
%19 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%20 = call i32* @fopen(i8* %19, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %20, i32** %3
%21 = icmp eq i32* %20, null
br i1 %21, label %22, label %25
22: ; preds = %0
%23 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* %23)
store i32 -1, i32* %1
br label %155
25: ; preds = %0
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %11
br label %27
27: ; preds = %146, %25
%28 = load i32*, i32** %3
%29 = call i64 @FindMarker(i32* %28, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
%30 = icmp ne i64 %29, 0
br i1 %30, label %31, label %37
31: ; preds = %27
%32 = load i32*, i32** %3
%33 = call i32 @fscanf(i32* %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %10)
%34 = icmp ne i32 %33, 1
br i1 %34, label %35, label %36
35: ; preds = %31
store i32 1, i32* %11
br label %150
36: ; preds = %31
br label %38
37: ; preds = %27
store i32 1, i32* %11
br label %150
38: ; preds = %36
%39 = load i32*, i32** %3
%40 = getelementptr inbounds [48 x i8], [48 x i8]* %4, i64 0, i64 0
%41 = call i32 @ReadHex(i32* %39, i8* %40, i32 48, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
%42 = icmp ne i32 %41, 0
br i1 %42, label %46, label %43
43: ; preds = %38
%44 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.8, i64 0, i64 0), i8* %44)
store i32 -3, i32* %1
br label %155
46: ; preds = %38
%47 = getelementptr inbounds [48 x i8], [48 x i8]* %4, i64 0, i64 0
%48 = call i32 @randombytes_init(i8* %47, i32* null, i32 256)
%49 = getelementptr inbounds [330 x i8], [330 x i8]* %12, i64 0, i64 0
%50 = getelementptr inbounds [374 x i8], [374 x i8]* %13, i64 0, i64 0
%51 = call i32 @crypto_kem_keypair_SIKEp434(i8* %49, i8* %50)
store i32 %51, i32* %16
%52 = icmp ne i32 %51, 0
br i1 %52, label %53, label %56
53: ; preds = %46
%54 = load i32, i32* %16
%55 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.9, i64 0, i64 0), i32 %54)
store i32 -4, i32* %1
br label %155
56: ; preds = %46
%57 = load i32*, i32** %3
%58 = getelementptr inbounds [330 x i8], [330 x i8]* %14, i64 0, i64 0
%59 = call i32 @ReadHex(i32* %57, i8* %58, i32 330, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0))
%60 = icmp ne i32 %59, 0
br i1 %60, label %64, label %61
61: ; preds = %56
%62 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.11, i64 0, i64 0), i8* %62)
store i32 -3, i32* %1
br label %155
64: ; preds = %56
%65 = load i32*, i32** %3
%66 = getelementptr inbounds [374 x i8], [374 x i8]* %15, i64 0, i64 0
%67 = call i32 @ReadHex(i32* %65, i8* %66, i32 374, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0))
%68 = icmp ne i32 %67, 0
br i1 %68, label %72, label %69
69: ; preds = %64
%70 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.13, i64 0, i64 0), i8* %70)
store i32 -3, i32* %1
br label %155
72: ; preds = %64
%73 = getelementptr inbounds [330 x i8], [330 x i8]* %12, i64 0, i64 0
%74 = getelementptr inbounds [330 x i8], [330 x i8]* %14, i64 0, i64 0
%75 = call i64 @memcmp(i8* %73, i8* %74, i32 330)
%76 = icmp ne i64 %75, 0
br i1 %76, label %77, label %80
77: ; preds = %72
%78 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.14, i64 0, i64 0), i8* %78)
store i32 -2, i32* %1
br label %155
80: ; preds = %72
%81 = getelementptr inbounds [374 x i8], [374 x i8]* %13, i64 0, i64 0
%82 = getelementptr inbounds [374 x i8], [374 x i8]* %15, i64 0, i64 0
%83 = call i64 @memcmp(i8* %81, i8* %82, i32 374)
%84 = icmp ne i64 %83, 0
br i1 %84, label %85, label %88
85: ; preds = %80
%86 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.15, i64 0, i64 0), i8* %86)
store i32 -2, i32* %1
br label %155
88: ; preds = %80
%89 = getelementptr inbounds [346 x i8], [346 x i8]* %5, i64 0, i64 0
%90 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%91 = getelementptr inbounds [330 x i8], [330 x i8]* %12, i64 0, i64 0
%92 = call i32 @crypto_kem_enc_SIKEp434(i8* %89, i8* %90, i8* %91)
store i32 %92, i32* %16
%93 = icmp ne i32 %92, 0
br i1 %93, label %94, label %97
94: ; preds = %88
%95 = load i32, i32* %16
%96 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.16, i64 0, i64 0), i32 %95)
store i32 -4, i32* %1
br label %155
97: ; preds = %88
%98 = load i32*, i32** %3
%99 = getelementptr inbounds [346 x i8], [346 x i8]* %8, i64 0, i64 0
%100 = call i32 @ReadHex(i32* %98, i8* %99, i32 346, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.17, i64 0, i64 0))
%101 = icmp ne i32 %100, 0
br i1 %101, label %105, label %102
102: ; preds = %97
%103 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%104 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.11, i64 0, i64 0), i8* %103)
store i32 -3, i32* %1
br label %155
105: ; preds = %97
%106 = load i32*, i32** %3
%107 = getelementptr inbounds [16 x i8], [16 x i8]* %9, i64 0, i64 0
%108 = call i32 @ReadHex(i32* %106, i8* %107, i32 16, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.18, i64 0, i64 0))
%109 = icmp ne i32 %108, 0
br i1 %109, label %113, label %110
110: ; preds = %105
%111 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%112 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.13, i64 0, i64 0), i8* %111)
store i32 -3, i32* %1
br label %155
113: ; preds = %105
%114 = getelementptr inbounds [346 x i8], [346 x i8]* %5, i64 0, i64 0
%115 = getelementptr inbounds [346 x i8], [346 x i8]* %8, i64 0, i64 0
%116 = call i64 @memcmp(i8* %114, i8* %115, i32 346)
%117 = icmp ne i64 %116, 0
br i1 %117, label %118, label %121
118: ; preds = %113
%119 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%120 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.19, i64 0, i64 0), i8* %119)
store i32 -2, i32* %1
br label %155
121: ; preds = %113
%122 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%123 = getelementptr inbounds [16 x i8], [16 x i8]* %9, i64 0, i64 0
%124 = call i64 @memcmp(i8* %122, i8* %123, i32 16)
%125 = icmp ne i64 %124, 0
br i1 %125, label %126, label %129
126: ; preds = %121
%127 = getelementptr inbounds [32 x i8], [32 x i8]* %2, i64 0, i64 0
%128 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.20, i64 0, i64 0), i8* %127)
store i32 -2, i32* %1
br label %155
129: ; preds = %121
%130 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 0
%131 = getelementptr inbounds [346 x i8], [346 x i8]* %5, i64 0, i64 0
%132 = getelementptr inbounds [374 x i8], [374 x i8]* %13, i64 0, i64 0
%133 = call i32 @crypto_kem_dec_SIKEp434(i8* %130, i8* %131, i8* %132)
store i32 %133, i32* %16
%134 = icmp ne i32 %133, 0
br i1 %134, label %135, label %138
135: ; preds = %129
%136 = load i32, i32* %16
%137 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.21, i64 0, i64 0), i32 %136)
store i32 -4, i32* %1
br label %155
138: ; preds = %129
%139 = getelementptr inbounds [16 x i8], [16 x i8]* %6, i64 0, i64 0
%140 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 0
%141 = call i64 @memcmp(i8* %139, i8* %140, i32 16)
%142 = icmp ne i64 %141, 0
br i1 %142, label %143, label %145
143: ; preds = %138
%144 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.22, i64 0, i64 0))
store i32 -4, i32* %1
br label %155
145: ; preds = %138
br label %146
146: ; preds = %145
%147 = load i32, i32* %11
%148 = icmp ne i32 %147, 0
%149 = xor i1 %148, true
br i1 %149, label %27, label %150
150: ; preds = %146, %37, %35
%151 = load i32*, i32** %3
%152 = call i32 @fclose(i32* %151)
%153 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.23, i64 0, i64 0))
%154 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.24, i64 0, i64 0))
store i32 0, i32* %1
br label %155
155: ; preds = %150, %143, %135, %126, %118, %110, %102, %94, %85, %77, %69, %61, %53, %43, %22
%156 = load i32, i32* %1
ret i32 %156
}

LLVM IR (-O2):
@.str = [21 x i8] c"KAT/PQCkemKAT_%d.rsp\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [29 x i8] c"Couldn't open <%s> for read\0A\00"
@.str.3 = [7 x i8] c"# %s\0A\0A\00"
@.str.4 = [9 x i8] c"SIKEp434\00"
@.str.5 = [9 x i8] c"count = \00"
@.str.6 = [3 x i8] c"%d\00"
@.str.7 = [8 x i8] c"seed = \00"
@.str.8 = [40 x i8] c"ERROR: unable to read 'seed' from <%s>\0A\00"
@.str.9 = [34 x i8] c"crypto_kem_keypair returned <%d>\0A\00"
@.str.10 = [6 x i8] c"pk = \00"
@.str.11 = [38 x i8] c"ERROR: unable to read 'pk' from <%s>\0A\00"
@.str.12 = [6 x i8] c"sk = \00"
@.str.13 = [38 x i8] c"ERROR: unable to read 'sk' from <%s>\0A\00"
@.str.14 = [34 x i8] c"ERROR: pk is different from <%s>\0A\00"
@.str.15 = [34 x i8] c"ERROR: sk is different from <%s>\0A\00"
@.str.16 = [30 x i8] c"crypto_kem_enc returned <%d>\0A\00"
@.str.17 = [6 x i8] c"ct = \00"
@.str.18 = [6 x i8] c"ss = \00"
@.str.19 = [34 x i8] c"ERROR: ct is different from <%s>\0A\00"
@.str.20 = [34 x i8] c"ERROR: ss is different from <%s>\0A\00"
@.str.21 = [30 x i8] c"crypto_kem_dec returned <%d>\0A\00"
@str = [28 x i8] c"Known Answer Tests PASSED. \00"
@str.25 = [2 x i8] c"\0A\00"
@str.26 = [39 x i8] c"crypto_kem_dec returned bad 'ss' value\00"
define i32 @main() {
%1 = alloca [32 x i8]
%2 = alloca [48 x i8]
%3 = alloca [346 x i8]
%4 = alloca [16 x i8]
%5 = alloca [16 x i8]
%6 = alloca [346 x i8]
%7 = alloca [16 x i8]
%8 = alloca i32
%9 = alloca [330 x i8]
%10 = alloca [374 x i8]
%11 = alloca [330 x i8]
%12 = alloca [374 x i8]
%13 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 0
%14 = getelementptr inbounds [48 x i8], [48 x i8]* %2, i64 0, i64 0
%15 = getelementptr inbounds [346 x i8], [346 x i8]* %3, i64 0, i64 0
%16 = getelementptr inbounds [16 x i8], [16 x i8]* %4, i64 0, i64 0
%17 = getelementptr inbounds [16 x i8], [16 x i8]* %5, i64 0, i64 0
%18 = getelementptr inbounds [346 x i8], [346 x i8]* %6, i64 0, i64 0
%19 = getelementptr inbounds [16 x i8], [16 x i8]* %7, i64 0, i64 0
%20 = bitcast i32* %8 to i8*
%21 = getelementptr inbounds [330 x i8], [330 x i8]* %9, i64 0, i64 0
%22 = getelementptr inbounds [374 x i8], [374 x i8]* %10, i64 0, i64 0
%23 = getelementptr inbounds [330 x i8], [330 x i8]* %11, i64 0, i64 0
%24 = getelementptr inbounds [374 x i8], [374 x i8]* %12, i64 0, i64 0
%25 = call i32 @sprintf(i8* %13, i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 374)
%26 = call i32* @fopen(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%27 = icmp eq i32* %26, null
br i1 %27, label %28, label %30
28: ; preds = %0
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.2, i64 0, i64 0), i8* %13)
br label %108
30: ; preds = %0
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0))
br label %32
32: ; preds = %99, %30
%33 = call i64 @FindMarker(i32* %26, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
%34 = icmp eq i64 %33, 0
br i1 %34, label %104, label %35
35: ; preds = %32
%36 = call i32 @fscanf(i32* %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i32* %8)
%37 = icmp eq i32 %36, 1
br i1 %37, label %38, label %104
38: ; preds = %35
%39 = call i32 @ReadHex(i32* %26, i8* %14, i32 48, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.7, i64 0, i64 0))
%40 = icmp eq i32 %39, 0
br i1 %40, label %41, label %43
41: ; preds = %38
%42 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.8, i64 0, i64 0), i8* %13)
br label %108
43: ; preds = %38
%44 = call i32 @randombytes_init(i8* %14, i32* null, i32 256)
%45 = call i32 @crypto_kem_keypair_SIKEp434(i8* %21, i8* %22)
%46 = icmp eq i32 %45, 0
br i1 %46, label %49, label %47
47: ; preds = %43
%48 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.9, i64 0, i64 0), i32 %45)
br label %108
49: ; preds = %43
%50 = call i32 @ReadHex(i32* %26, i8* %23, i32 330, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.10, i64 0, i64 0))
%51 = icmp eq i32 %50, 0
br i1 %51, label %52, label %54
52: ; preds = %49
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.11, i64 0, i64 0), i8* %13)
br label %108
54: ; preds = %49
%55 = call i32 @ReadHex(i32* %26, i8* %24, i32 374, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.12, i64 0, i64 0))
%56 = icmp eq i32 %55, 0
br i1 %56, label %57, label %59
57: ; preds = %54
%58 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.13, i64 0, i64 0), i8* %13)
br label %108
59: ; preds = %54
%60 = call i64 @memcmp(i8* %21, i8* %23, i32 330)
%61 = icmp eq i64 %60, 0
br i1 %61, label %64, label %62
62: ; preds = %59
%63 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.14, i64 0, i64 0), i8* %13)
br label %108
64: ; preds = %59
%65 = call i64 @memcmp(i8* %22, i8* %24, i32 374)
%66 = icmp eq i64 %65, 0
br i1 %66, label %69, label %67
67: ; preds = %64
%68 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.15, i64 0, i64 0), i8* %13)
br label %108
69: ; preds = %64
%70 = call i32 @crypto_kem_enc_SIKEp434(i8* %15, i8* %16, i8* %21)
%71 = icmp eq i32 %70, 0
br i1 %71, label %74, label %72
72: ; preds = %69
%73 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.16, i64 0, i64 0), i32 %70)
br label %108
74: ; preds = %69
%75 = call i32 @ReadHex(i32* %26, i8* %18, i32 346, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.17, i64 0, i64 0))
%76 = icmp eq i32 %75, 0
br i1 %76, label %77, label %79
77: ; preds = %74
%78 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.11, i64 0, i64 0), i8* %13)
br label %108
79: ; preds = %74
%80 = call i32 @ReadHex(i32* %26, i8* %19, i32 16, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.18, i64 0, i64 0))
%81 = icmp eq i32 %80, 0
br i1 %81, label %82, label %84
82: ; preds = %79
%83 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.13, i64 0, i64 0), i8* %13)
br label %108
84: ; preds = %79
%85 = call i64 @memcmp(i8* %15, i8* %18, i32 346)
%86 = icmp eq i64 %85, 0
br i1 %86, label %89, label %87
87: ; preds = %84
%88 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.19, i64 0, i64 0), i8* %13)
br label %108
89: ; preds = %84
%90 = call i64 @memcmp(i8* %16, i8* %19, i32 16)
%91 = icmp eq i64 %90, 0
br i1 %91, label %94, label %92
92: ; preds = %89
%93 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.20, i64 0, i64 0), i8* %13)
br label %108
94: ; preds = %89
%95 = call i32 @crypto_kem_dec_SIKEp434(i8* %17, i8* %15, i8* %22)
%96 = icmp eq i32 %95, 0
br i1 %96, label %99, label %97
97: ; preds = %94
%98 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @.str.21, i64 0, i64 0), i32 %95)
br label %108
99: ; preds = %94
%100 = call i64 @memcmp(i8* %16, i8* %17, i32 16)
%101 = icmp eq i64 %100, 0
br i1 %101, label %32, label %102
102: ; preds = %99
%103 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @str.26, i64 0, i64 0))
br label %108
104: ; preds = %32, %35
%105 = call i32 @fclose(i32* %26)
%106 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
%107 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str.25, i64 0, i64 0))
br label %108
108: ; preds = %104, %102, %97, %92, %87, %82, %77, %72, %67, %62, %57, %52, %47, %41, %28
%109 = phi i32 [ -1, %28 ], [ 0, %104 ], [ -4, %47 ], [ -2, %62 ], [ -2, %67 ], [ -4, %72 ], [ -2, %87 ], [ -2, %92 ], [ -4, %97 ], [ -4, %102 ], [ -3, %82 ], [ -3, %77 ], [ -3, %57 ], [ -3, %52 ], [ -3, %41 ]
ret i32 %109
}