#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 */
struct icom {
  int dummy;
};

/* Variables and functions */
int BUFSIZ;
int atoi(char *);
int imget_fits_value(struct icom *, char *, char *);
int imget_fits_int_value(struct icom *comp, char *key, int *iout) {
  char tmp[BUFSIZ];
  if (imget_fits_value(comp, key, tmp) == 1) {
    *iout = atoi(tmp);
    return 1;
  } else {
    *iout = 0;
    return 0;
  }
}


x86 assembly (clang, -O0):
<imget_fits_int_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    0x2ea5(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x28(%rbp)
mov    %rax,%rcx
add    $0xf,%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdx
sub    %rcx,%rdx
mov    %rdx,-0x40(%rbp)
mov    %rdx,%rsp
mov    %rax,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <imget_fits_value@plt>
cmp    $0x1,%eax
jne    119a <imget_fits_int_value+0x7a>
mov    -0x40(%rbp),%rdi
call   1030 <atoi@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0x34(%rbp)
jmp    11b2 <imget_fits_int_value+0x92>
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0x34(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<imget_fits_int_value>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
mov    %rdx,%r14
mov    0x2eaf(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rbx
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%rbx
mov    %rbx,%rsp
mov    %rbx,%rdx
call   1040 <imget_fits_value@plt>
mov    %eax,%edx
xor    %eax,%eax
mov    $0x0,%ecx
cmp    $0x1,%edx
jne    1167 <imget_fits_int_value+0x47>
mov    %rbx,%rdi
call   1030 <atoi@plt>
mov    $0x1,%ecx
mov    %eax,(%r14)
mov    %ecx,%eax
lea    -0x10(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.icom = type { i32 }
@BUFSIZ = global i32 0
define i32 @imget_fits_int_value(%struct.icom* %0, i8* %1, i32* %2) {
%4 = alloca i32
%5 = alloca %struct.icom*
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i32
store %struct.icom* %0, %struct.icom** %5
store i8* %1, i8** %6
store i32* %2, i32** %7
%11 = load i32, i32* @BUFSIZ
%12 = zext i32 %11 to i64
%13 = call i8* @llvm.stacksave()
store i8* %13, i8** %8
%14 = alloca i8, i64 %12
store i64 %12, i64* %9
%15 = load %struct.icom*, %struct.icom** %5
%16 = load i8*, i8** %6
%17 = call i32 @imget_fits_value(%struct.icom* %15, i8* %16, i8* %14)
%18 = icmp eq i32 %17, 1
br i1 %18, label %19, label %22
19: ; preds = %3
%20 = call i32 @atoi(i8* %14)
%21 = load i32*, i32** %7
store i32 %20, i32* %21
store i32 1, i32* %4
store i32 1, i32* %10
br label %24
22: ; preds = %3
%23 = load i32*, i32** %7
store i32 0, i32* %23
store i32 0, i32* %4
store i32 1, i32* %10
br label %24
24: ; preds = %22, %19
%25 = load i8*, i8** %8
%26 = load i32, i32* %4
ret i32 %26
}

LLVM IR (-O2):
%struct.icom = type { i32 }
@BUFSIZ = global i32 0
define i32 @imget_fits_int_value(%struct.icom* %0, i8* %1, i32* nocapture writeonly %2) {
%4 = load i32, i32* @BUFSIZ
%5 = zext i32 %4 to i64
%6 = alloca i8, i64 %5
%7 = call i32 @imget_fits_value(%struct.icom* %0, i8* %1, i8* %6)
%8 = icmp eq i32 %7, 1
br i1 %8, label %9, label %11
9: ; preds = %3
%10 = call i32 @atoi(i8* %6)
br label %11
11: ; preds = %3, %9
%12 = phi i32 [ %10, %9 ], [ 0, %3 ]
%13 = phi i32 [ 1, %9 ], [ 0, %3 ]
store i32 %12, i32* %2
ret i32 %13
}