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

/* Variables and functions */
int RSA2048_load(int, char *, unsigned char *, int);
int /*<<< orphan*/ printf(char *);
int RSA2048_load_pubkey_N(int fd, unsigned char *RSA2048_N) {
  int ret;
  ret = RSA2048_load(fd, "BF51000480", RSA2048_N, 128);
  if (ret != 0) {
    printf("ERR:RSA2048_load_pubkey_N_128 failed!\n");
    return 1;
  }
  ret = RSA2048_load(fd, "BF51008480", RSA2048_N + 128, 128);
  if (ret != 0) {
    printf("ERR:RSA2048_load_pubkey_N_256 failed!\n");
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<RSA2048_load_pubkey_N>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rdx
lea    0xec3(%rip),%rsi
mov    $0x80,%ecx
call   1040 <RSA2048_load@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     116c <RSA2048_load_pubkey_N+0x4c>
lea    0xeb0(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11b7 <RSA2048_load_pubkey_N+0x97>
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rdx
add    $0x80,%rdx
lea    0xeb1(%rip),%rsi
mov    $0x80,%ecx
call   1040 <RSA2048_load@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     11b0 <RSA2048_load_pubkey_N+0x90>
lea    0xe9e(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11b7 <RSA2048_load_pubkey_N+0x97>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<RSA2048_load_pubkey_N>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xed1(%rip),%rsi
mov    %rbx,%rdx
mov    $0x80,%ecx
call   1040 <RSA2048_load@plt>
test   %eax,%eax
je     1149 <RSA2048_load_pubkey_N+0x29>
lea    0xef5(%rip),%rdi
jmp    116e <RSA2048_load_pubkey_N+0x4e>
sub    $0xffffffffffffff80,%rbx
lea    0xeb7(%rip),%rsi
mov    %ebp,%edi
mov    %rbx,%rdx
mov    $0x80,%ecx
call   1040 <RSA2048_load@plt>
test   %eax,%eax
je     117f <RSA2048_load_pubkey_N+0x5f>
lea    0xea8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
xor    %eax,%eax
jmp    1178 <RSA2048_load_pubkey_N+0x58>

LLVM IR (-O0):
@.str = [11 x i8] c"BF51000480\00"
@.str.1 = [39 x i8] c"ERR:RSA2048_load_pubkey_N_128 failed!\0A\00"
@.str.2 = [11 x i8] c"BF51008480\00"
@.str.3 = [39 x i8] c"ERR:RSA2048_load_pubkey_N_256 failed!\0A\00"
define i32 @RSA2048_load_pubkey_N(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
store i32 %0, i32* %4
store i8* %1, i8** %5
%7 = load i32, i32* %4
%8 = load i8*, i8** %5
%9 = call i32 @RSA2048_load(i32 %7, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %8, i32 128)
store i32 %9, i32* %6
%10 = load i32, i32* %6
%11 = icmp ne i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
br label %24
14: ; preds = %2
%15 = load i32, i32* %4
%16 = load i8*, i8** %5
%17 = getelementptr inbounds i8, i8* %16, i64 128
%18 = call i32 @RSA2048_load(i32 %15, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %17, i32 128)
store i32 %18, i32* %6
%19 = load i32, i32* %6
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %23
21: ; preds = %14
%22 = call i32 @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.3, i64 0, i64 0))
store i32 1, i32* %3
br label %24
23: ; preds = %14
store i32 0, i32* %3
br label %24
24: ; preds = %23, %21, %12
%25 = load i32, i32* %3
ret i32 %25
}

LLVM IR (-O2):
@.str = [11 x i8] c"BF51000480\00"
@.str.2 = [11 x i8] c"BF51008480\00"
@str = [38 x i8] c"ERR:RSA2048_load_pubkey_N_256 failed!\00"
@str.4 = [38 x i8] c"ERR:RSA2048_load_pubkey_N_128 failed!\00"
define i32 @RSA2048_load_pubkey_N(i32 %0, i8* %1) {
%3 = tail call i32 @RSA2048_load(i32 %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i8* %1, i32 128)
%4 = icmp eq i32 %3, 0
br i1 %4, label %5, label %9
5: ; preds = %2
%6 = getelementptr inbounds i8, i8* %1, i64 128
%7 = tail call i32 @RSA2048_load(i32 %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0), i8* %6, i32 128)
%8 = icmp eq i32 %7, 0
br i1 %8, label %12, label %9
9: ; preds = %5, %2
%10 = phi i8* [ getelementptr inbounds ([38 x i8], [38 x i8]* @str.4, i64 0, i64 0), %2 ], [ getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0), %5 ]
%11 = tail call i32 @puts(i8* dereferenceable(1) %10)
br label %12
12: ; preds = %9, %5
%13 = phi i32 [ 0, %5 ], [ 1, %9 ]
ret i32 %13
}