#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;
float atof(char *);
int imget_fits_value(struct icom *, char *, char *);
int imget_fits_float_value(struct icom *comp, char *key, float *fout) {
  char tmp[BUFSIZ];
  if (imget_fits_value(comp, key, tmp) == 1) {
    *fout = atof(tmp);
    return 1;
  } else {
    *fout = 0;
    return 0;
  }
}


x86 assembly (clang, -O0):
<imget_fits_float_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_float_value+0x7a>
mov    -0x40(%rbp),%rdi
call   1030 <atof@plt>
mov    -0x20(%rbp),%rax
movss  %xmm0,(%rax)
movl   $0x1,-0x4(%rbp)
movl   $0x1,-0x34(%rbp)
jmp    11b3 <imget_fits_float_value+0x93>
mov    -0x20(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,(%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_float_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>
cmp    $0x1,%eax
jne    1160 <imget_fits_float_value+0x40>
mov    %rbx,%rdi
call   1030 <atof@plt>
mov    $0x1,%eax
jmp    1165 <imget_fits_float_value+0x45>
xor    %eax,%eax
xorps  %xmm0,%xmm0
movss  %xmm0,(%r14)
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_float_value(%struct.icom* %0, i8* %1, float* %2) {
%4 = alloca i32
%5 = alloca %struct.icom*
%6 = alloca i8*
%7 = alloca float*
%8 = alloca i8*
%9 = alloca i64
%10 = alloca i32
store %struct.icom* %0, %struct.icom** %5
store i8* %1, i8** %6
store float* %2, float** %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 float @atof(i8* %14)
%21 = load float*, float** %7
store float %20, float* %21
store i32 1, i32* %4
store i32 1, i32* %10
br label %24
22: ; preds = %3
%23 = load float*, float** %7
store float 0.000000e+00, float* %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_float_value(%struct.icom* %0, i8* %1, float* 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 float @atof(i8* %6)
br label %11
11: ; preds = %3, %9
%12 = phi float [ %10, %9 ], [ 0.000000e+00, %3 ]
%13 = phi i32 [ 1, %9 ], [ 0, %3 ]
store float %12, float* %2
ret i32 %13
}