#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 */
double atof(char const *);
char *get_str(char *, int);
scalar_t__ strlen(char const *);
double get_req_double(char *line, int column_number, int *ok) {
  if (column_number >= 0) {
    const char *str = get_str(line, column_number);
    if (str && strlen(str) > 0) {
      *ok = (!(0));
      return atof(str);
    } else {
      *ok = (0);
      return 0.0;
    }
  } else {
    *ok = (0);
    return 0.0;
  }
}


x86 assembly (clang, -O0):
<get_req_double>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     11af <get_req_double+0x7f>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1050 <get_str@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1198 <get_req_double+0x68>
mov    -0x28(%rbp),%rdi
call   1040 <strlen@plt>
cmp    $0x0,%rax
jle    1198 <get_req_double+0x68>
mov    -0x20(%rbp),%rax
movl   $0x1,(%rax)
mov    -0x28(%rbp),%rdi
call   1030 <atof@plt>
movsd  %xmm0,-0x8(%rbp)
jmp    11c1 <get_req_double+0x91>
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    11c1 <get_req_double+0x91>
mov    -0x20(%rbp),%rax
movl   $0x0,(%rax)
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_req_double>:
push   %r14
push   %rbx
push   %rax
mov    %rdx,%r14
test   %esi,%esi
js     116b <get_req_double+0x3b>
call   1050 <get_str@plt>
test   %rax,%rax
je     116b <get_req_double+0x3b>
mov    %rax,%rbx
mov    %rax,%rdi
call   1040 <strlen@plt>
test   %rax,%rax
jle    116b <get_req_double+0x3b>
movl   $0x1,(%r14)
mov    %rbx,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <atof@plt>
movl   $0x0,(%r14)
xorps  %xmm0,%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define double @get_req_double(i8* %0, i32 %1, i32* %2) {
%4 = alloca double
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i8*
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32* %2, i32** %7
%9 = load i32, i32* %6
%10 = icmp sge i32 %9, 0
br i1 %10, label %11, label %27
11: ; preds = %3
%12 = load i8*, i8** %5
%13 = load i32, i32* %6
%14 = call i8* @get_str(i8* %12, i32 %13)
store i8* %14, i8** %8
%15 = load i8*, i8** %8
%16 = icmp ne i8* %15, null
br i1 %16, label %17, label %25
17: ; preds = %11
%18 = load i8*, i8** %8
%19 = call i64 @strlen(i8* %18)
%20 = icmp sgt i64 %19, 0
br i1 %20, label %21, label %25
21: ; preds = %17
%22 = load i32*, i32** %7
store i32 1, i32* %22
%23 = load i8*, i8** %8
%24 = call double @atof(i8* %23)
store double %24, double* %4
br label %29
25: ; preds = %17, %11
%26 = load i32*, i32** %7
store i32 0, i32* %26
store double 0.000000e+00, double* %4
br label %29
27: ; preds = %3
%28 = load i32*, i32** %7
store i32 0, i32* %28
store double 0.000000e+00, double* %4
br label %29
29: ; preds = %27, %25, %21
%30 = load double, double* %4
ret double %30
}

LLVM IR (-O2):
define double @get_req_double(i8* %0, i32 %1, i32* nocapture writeonly %2) {
%4 = icmp sgt i32 %1, -1
br i1 %4, label %5, label %14
5: ; preds = %3
%6 = tail call i8* @get_str(i8* %0, i32 %1)
%7 = icmp eq i8* %6, null
br i1 %7, label %13, label %8
8: ; preds = %5
%9 = tail call i64 @strlen(i8* %6)
%10 = icmp sgt i64 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %8
store i32 1, i32* %2
%12 = tail call double @atof(i8* %6)
br label %15
13: ; preds = %8, %5
store i32 0, i32* %2
br label %15
14: ; preds = %3
store i32 0, i32* %2
br label %15
15: ; preds = %11, %13, %14
%16 = phi double [ 0.000000e+00, %14 ], [ %12, %11 ], [ 0.000000e+00, %13 ]
ret double %16
}