#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 csvdata {
  int dummy;
};

/* Variables and functions */
char *csvdata_value_string(struct csvdata *, int, int, char const *);
double trans_double(char const *, double);
double csvdata_value_double(struct csvdata *csv, int line, int row,
                            double def) {
  const char *val = csvdata_value_string(csv, line, row, (const char *)NULL);
  if (!val)
    return def;
  return trans_double(val, def);
}


x86 assembly (clang, -O0):
<csvdata_value_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %edx,-0x18(%rbp)
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
xor    %eax,%eax
mov    %eax,%ecx
call   1030 <csvdata_value_string@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
jne    1168 <csvdata_value_double+0x48>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    117b <csvdata_value_double+0x5b>
mov    -0x28(%rbp),%rdi
movsd  -0x20(%rbp),%xmm0
call   1040 <trans_double@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<csvdata_value_double>:
push   %rax
movsd  %xmm0,(%rsp)
xor    %ecx,%ecx
call   1030 <csvdata_value_string@plt>
test   %rax,%rax
je     1140 <csvdata_value_double+0x20>
mov    %rax,%rdi
movsd  (%rsp),%xmm0
pop    %rax
jmp    1040 <trans_double@plt>
movsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
%struct.csvdata = type { i32 }
define double @csvdata_value_double(%struct.csvdata* %0, i32 %1, i32 %2, double %3) {
%5 = alloca double
%6 = alloca %struct.csvdata*
%7 = alloca i32
%8 = alloca i32
%9 = alloca double
%10 = alloca i8*
store %struct.csvdata* %0, %struct.csvdata** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store double %3, double* %9
%11 = load %struct.csvdata*, %struct.csvdata** %6
%12 = load i32, i32* %7
%13 = load i32, i32* %8
%14 = call i8* @csvdata_value_string(%struct.csvdata* %11, i32 %12, i32 %13, i8* null)
store i8* %14, i8** %10
%15 = load i8*, i8** %10
%16 = icmp ne i8* %15, null
br i1 %16, label %19, label %17
17: ; preds = %4
%18 = load double, double* %9
store double %18, double* %5
br label %23
19: ; preds = %4
%20 = load i8*, i8** %10
%21 = load double, double* %9
%22 = call double @trans_double(i8* %20, double %21)
store double %22, double* %5
br label %23
23: ; preds = %19, %17
%24 = load double, double* %5
ret double %24
}

LLVM IR (-O2):
%struct.csvdata = type { i32 }
define double @csvdata_value_double(%struct.csvdata* %0, i32 %1, i32 %2, double %3) {
%5 = tail call i8* @csvdata_value_string(%struct.csvdata* %0, i32 %1, i32 %2, i8* null)
%6 = icmp eq i8* %5, null
br i1 %6, label %9, label %7
7: ; preds = %4
%8 = tail call double @trans_double(i8* %5, double %3)
br label %9
9: ; preds = %4, %7
%10 = phi double [ %8, %7 ], [ %3, %4 ]
ret double %10
}