#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 *);
long strtol(char const *, char **, int /*<<< orphan*/);
long config_get_long_value(const char *key) {
  const char *value = config_get_value(key);
  char *endptr;
  long result = strtol(value, &endptr, 0);
  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"
              ":"
              "62"
              ": "
              "error: "
              "config_get_long_value: invalid value for key: %s",
              key);
  return result;
}


x86 assembly (clang, -O0):
<config_get_long_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <config_get_value@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
xor    %edx,%edx
call   1050 <strtol@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1179 <config_get_long_value+0x49>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1189 <config_get_long_value+0x59>
mov    -0x8(%rbp),%rsi
lea    0xe7c(%rip),%rdi
call   1030 <log_error@plt>
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<config_get_long_value>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%r15
call   1040 <config_get_value@plt>
mov    %rax,%rbx
lea    0x8(%rsp),%rsi
mov    %rax,%rdi
xor    %edx,%edx
call   1050 <strtol@plt>
mov    %rax,%r14
cmpb   $0x0,(%rbx)
je     1165 <config_get_long_value+0x35>
mov    0x8(%rsp),%rax
cmpb   $0x0,(%rax)
je     1174 <config_get_long_value+0x44>
lea    0xe94(%rip),%rdi
mov    %r15,%rsi
call   1030 <log_error@plt>
mov    %r14,%rax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [202 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:62: error: config_get_long_value: invalid value for key: %s\00"
define i64 @config_get_long_value(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
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 i64 @strtol(i8* %8, i8** %4, i32 0)
store i64 %9, i64* %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 ([202 x i8], [202 x i8]* @.str, i64 0, i64 0), i8* %21)
br label %23
23: ; preds = %20, %14
%24 = load i64, i64* %5
ret i64 %24
}

LLVM IR (-O2):
@.str = [202 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:62: error: config_get_long_value: invalid value for key: %s\00"
define i64 @config_get_long_value(i8* %0) {
%2 = alloca i8*
%3 = tail call i8* @config_get_value(i8* %0)
%4 = bitcast i8** %2 to i8*
%5 = call i64 @strtol(i8* %3, i8** %2, i32 0)
%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 ([202 x i8], [202 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %14
14: ; preds = %12, %8
ret i64 %5
}