#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 */
char *config_get_value(char const *);
int /*<<< orphan*/ log_error(char *, char const *);
double strtod(char const *, char **);
double config_get_double_value(const char *key) {
  const char *value = config_get_value(key);
  char *endptr;
  double result = strtod(value, &endptr);
  if (!value[0] || endptr[0])
    log_error("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/Uga-Agga/Game/refs/heads/master/src/"
              "ticker/config.c"
              ":"
              "74"
              ": "
              "error: "
              "config_get_double_value: invalid value for key: %s",
              key);
  return result;
}


x86 assembly (clang, -O0):
<config_get_double_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <config_get_value@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <strtod@plt>
movsd  %xmm0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1178 <config_get_double_value+0x48>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1188 <config_get_double_value+0x58>
mov    -0x8(%rbp),%rsi
lea    0xe7d(%rip),%rdi
call   1040 <log_error@plt>
movsd  -0x20(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<config_get_double_value>:
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%r14
call   1050 <config_get_value@plt>
mov    %rax,%rbx
lea    0x10(%rsp),%rsi
mov    %rax,%rdi
call   1030 <strtod@plt>
cmpb   $0x0,(%rbx)
je     115e <config_get_double_value+0x2e>
mov    0x10(%rsp),%rax
cmpb   $0x0,(%rax)
je     1179 <config_get_double_value+0x49>
lea    0xe9b(%rip),%rdi
mov    %r14,%rsi
movsd  %xmm0,0x8(%rsp)
call   1040 <log_error@plt>
movsd  0x8(%rsp),%xmm0
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [204 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Uga-Agga/Game/refs/heads/master/src/ticker/config.c:74: error: config_get_double_value: invalid value for key: %s\00"
define double @config_get_double_value(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca double
store i8* %0, i8** %2
%6 = load i8*, i8** %2
%7 = call i8* @config_get_value(i8* %6)
store i8* %7, i8** %3
%8 = load i8*, i8** %3
%9 = call double @strtod(i8* %8, i8** %4)
store double %9, double* %5
%10 = load i8*, i8** %3
%11 = getelementptr inbounds i8, i8* %10, i64 0
%12 = load i8, i8* %11
%13 = icmp ne i8 %12, 0
br i1 %13, label %14, label %20
14: ; preds = %1
%15 = load i8*, i8** %4
%16 = getelementptr inbounds i8, i8* %15, i64 0
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %23
20: ; preds = %14, %1
%21 = load i8*, i8** %2
%22 = call i32 @log_error(i8* getelementptr inbounds ([204 x i8], [204 x i8]* @.str, i64 0, i64 0), i8* %21)
br label %23
23: ; preds = %20, %14
%24 = load double, double* %5
ret double %24
}

LLVM IR (-O2):
@.str = [204 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/Uga-Agga/Game/refs/heads/master/src/ticker/config.c:74: error: config_get_double_value: invalid value for key: %s\00"
define double @config_get_double_value(i8* %0) {
%2 = alloca i8*
%3 = tail call i8* @config_get_value(i8* %0)
%4 = bitcast i8** %2 to i8*
%5 = call double @strtod(i8* %3, i8** %2)
%6 = load i8, i8* %3
%7 = icmp eq i8 %6, 0
br i1 %7, label %12, label %8
8: ; preds = %1
%9 = load i8*, i8** %2
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %14, label %12
12: ; preds = %8, %1
%13 = tail call i32 @log_error(i8* getelementptr inbounds ([204 x i8], [204 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %14
14: ; preds = %12, %8
ret double %5
}