#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*/ uint8_t;
typedef int /*<<< orphan*/ data;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int read_file(char *, int /*<<< orphan*/ *, int);
int /*<<< orphan*/ sign_by_pkey(char *, int /*<<< orphan*/ *, int,
                                int /*<<< orphan*/ **);
int main() {
  uint8_t *out = NULL;
  uint8_t data[1024 * 5] = {0};
  int ret = read_file("data.bin", data, sizeof(data));
  printf("ret = %d\n", ret);
  sign_by_pkey("client_secp384r1.key", data, ret, &out);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x5020,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x0,-0x10(%rbp)
lea    -0x5010(%rbp),%rdi
xor    %esi,%esi
mov    $0x5000,%edx
call   1040 <memset@plt>
lea    -0x5010(%rbp),%rsi
lea    0xe85(%rip),%rdi
mov    $0x5000,%edx
call   1050 <read_file@plt>
mov    %eax,-0x5014(%rbp)
mov    -0x5014(%rbp),%esi
lea    0xe71(%rip),%rdi
call   1030 <printf@plt>
lea    -0x5010(%rbp),%rsi
mov    -0x5014(%rbp),%edx
lea    0xe62(%rip),%rdi
lea    -0x10(%rbp),%rcx
call   1060 <sign_by_pkey@plt>
xor    %eax,%eax
add    $0x5020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
sub    $0x5018,%rsp
movq   $0x0,0x8(%rsp)
lea    0x10(%rsp),%rbx
mov    $0x5000,%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1040 <memset@plt>
lea    0xe93(%rip),%rdi
mov    %rbx,%rsi
mov    $0x5000,%edx
call   1050 <read_file@plt>
mov    %eax,%ebp
lea    0xe86(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
lea    0xe82(%rip),%rdi
lea    0x8(%rsp),%rcx
mov    %rbx,%rsi
mov    %ebp,%edx
call   1060 <sign_by_pkey@plt>
xor    %eax,%eax
add    $0x5018,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"data.bin\00"
@.str.1 = [10 x i8] c"ret = %d\0A\00"
@.str.2 = [21 x i8] c"client_secp384r1.key\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca [5120 x i32]
%4 = alloca i32
store i32 0, i32* %1
store i32* null, i32** %2
%5 = bitcast [5120 x i32]* %3 to i8*
%6 = getelementptr inbounds [5120 x i32], [5120 x i32]* %3, i64 0, i64 0
%7 = call i32 @read_file(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %6, i32 20480)
store i32 %7, i32* %4
%8 = load i32, i32* %4
%9 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%10 = getelementptr inbounds [5120 x i32], [5120 x i32]* %3, i64 0, i64 0
%11 = load i32, i32* %4
%12 = call i32 @sign_by_pkey(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32* %10, i32 %11, i32** %2)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"data.bin\00"
@.str.1 = [10 x i8] c"ret = %d\0A\00"
@.str.2 = [21 x i8] c"client_secp384r1.key\00"
define i32 @main() {
%1 = alloca i32*
%2 = alloca [5120 x i32]
%3 = bitcast i32** %1 to i8*
store i32* null, i32** %1
%4 = bitcast [5120 x i32]* %2 to i8*
%5 = getelementptr inbounds [5120 x i32], [5120 x i32]* %2, i64 0, i64 0
%6 = call i32 @read_file(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32* %5, i32 20480)
%7 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %6)
%8 = call i32 @sign_by_pkey(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32* %5, i32 %6, i32** %1)
ret i32 0
}