#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 atoi(char *);
int /*<<< orphan*/ chomp(int /*<<< orphan*/);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ stdin;
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ *trim(int /*<<< orphan*/);
int *get_int(int *output, int use) {
  int *value = NULL;
  char temp[132];
  *output = use;
  if (trim(chomp(fgets(temp, 132, stdin))) != NULL) {
    if (strcmp(temp, ""))
      *output = atoi(temp);
    value = output;
  }
  return value;
}


x86 assembly (clang, -O0):
<get_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
lea    -0xa0(%rbp),%rdi
mov    0x2e67(%rip),%rax
mov    (%rax),%edx
mov    $0x84,%esi
call   1040 <fgets@plt>
mov    %eax,%edi
call   1060 <chomp@plt>
mov    %eax,%edi
call   1030 <trim@plt>
cmp    $0x0,%rax
je     11de <get_int+0x8e>
lea    -0xa0(%rbp),%rdi
lea    0xe4d(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     11d6 <get_int+0x86>
lea    -0xa0(%rbp),%rdi
call   1070 <atoi@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_int>:
push   %rbx
sub    $0x90,%rsp
mov    %rdi,%rbx
mov    %esi,(%rdi)
mov    0x2e84(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%rdi
mov    $0x84,%esi
call   1040 <fgets@plt>
mov    %eax,%edi
call   1060 <chomp@plt>
mov    %eax,%edi
call   1030 <trim@plt>
test   %rax,%rax
je     11a6 <get_int+0x56>
lea    0xe73(%rip),%rsi
mov    %rsp,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     11a8 <get_int+0x58>
mov    %rsp,%rdi
call   1070 <atoi@plt>
mov    %eax,(%rbx)
jmp    11a8 <get_int+0x58>
xor    %ebx,%ebx
mov    %rbx,%rax
add    $0x90,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [1 x i8] zeroinitializer
define i32* @get_int(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32*
%6 = alloca [132 x i8]
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32* null, i32** %5
%7 = load i32, i32* %4
%8 = load i32*, i32** %3
store i32 %7, i32* %8
%9 = getelementptr inbounds [132 x i8], [132 x i8]* %6, i64 0, i64 0
%10 = load i32, i32* @stdin
%11 = call i32 @fgets(i8* %9, i32 132, i32 %10)
%12 = call i32 @chomp(i32 %11)
%13 = call i32* @trim(i32 %12)
%14 = icmp ne i32* %13, null
br i1 %14, label %15, label %25
15: ; preds = %2
%16 = getelementptr inbounds [132 x i8], [132 x i8]* %6, i64 0, i64 0
%17 = call i64 @strcmp(i8* %16, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%18 = icmp ne i64 %17, 0
br i1 %18, label %19, label %23
19: ; preds = %15
%20 = getelementptr inbounds [132 x i8], [132 x i8]* %6, i64 0, i64 0
%21 = call i32 @atoi(i8* %20)
%22 = load i32*, i32** %3
store i32 %21, i32* %22
br label %23
23: ; preds = %19, %15
%24 = load i32*, i32** %3
store i32* %24, i32** %5
br label %25
25: ; preds = %23, %2
%26 = load i32*, i32** %5
ret i32* %26
}

LLVM IR (-O2):
@stdin = global i32 0
@.str = [1 x i8] zeroinitializer
define i32* @get_int(i32* writeonly %0, i32 %1) {
%3 = alloca [132 x i8]
%4 = getelementptr inbounds [132 x i8], [132 x i8]* %3, i64 0, i64 0
store i32 %1, i32* %0
%5 = load i32, i32* @stdin
%6 = call i32 @fgets(i8* %4, i32 132, i32 %5)
%7 = call i32 @chomp(i32 %6)
%8 = call i32* @trim(i32 %7)
%9 = icmp eq i32* %8, null
br i1 %9, label %15, label %10
10: ; preds = %2
%11 = call i64 @strcmp(i8* %4, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%12 = icmp eq i64 %11, 0
br i1 %12, label %15, label %13
13: ; preds = %10
%14 = call i32 @atoi(i8* %4)
store i32 %14, i32* %0
br label %15
15: ; preds = %10, %13, %2
%16 = phi i32* [ null, %2 ], [ %0, %13 ], [ %0, %10 ]
ret i32* %16
}