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

/* Variables and functions */
int /*<<< orphan*/ DEBUG4(char *, char const *, int);
char *Find_value(struct line_list *, char const *, char const *);
int strtol(char const *, char **, int);
int Find_decimal_value(struct line_list *l, const char *key, const char *sep) {
  const char *s = 0;
  char *e;
  int n = 0;
  if (l && (s = Find_value(l, key, sep))) {
    e = 0;
    n = strtol(s, &e, 10);
    if (!e || *e) {
      e = 0;
      n = strtol(s, &e, 0);
      if (!e || *e)
        n = 0;
    }
  }
  DEBUG4("Find_decimal_value: key '%s', value '%d'", key, n);
  return (n);
}


x86 assembly (clang, -O0):
<Find_decimal_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     11fb <Find_decimal_value+0xcb>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <Find_value@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
je     11fb <Find_decimal_value+0xcb>
movq   $0x0,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
mov    $0xa,%edx
call   1050 <strtol@plt>
mov    %eax,-0x2c(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     11b5 <Find_decimal_value+0x85>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11f6 <Find_decimal_value+0xc6>
movq   $0x0,-0x28(%rbp)
mov    -0x20(%rbp),%rdi
lea    -0x28(%rbp),%rsi
xor    %edx,%edx
call   1050 <strtol@plt>
mov    %eax,-0x2c(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     11ea <Find_decimal_value+0xba>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11f1 <Find_decimal_value+0xc1>
movl   $0x0,-0x2c(%rbp)
jmp    11f6 <Find_decimal_value+0xc6>
jmp    11fb <Find_decimal_value+0xcb>
mov    -0x10(%rbp),%rsi
mov    -0x2c(%rbp),%edx
lea    0xdf7(%rip),%rdi
call   1030 <DEBUG4@plt>
mov    -0x2c(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Find_decimal_value>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
xor    %ebp,%ebp
test   %rdi,%rdi
je     11a9 <Find_decimal_value+0x79>
mov    %r14,%rsi
call   1040 <Find_value@plt>
test   %rax,%rax
je     11a9 <Find_decimal_value+0x79>
mov    %rax,%rbx
movq   $0x0,0x8(%rsp)
lea    0x8(%rsp),%rsi
mov    %rax,%rdi
mov    $0xa,%edx
call   1050 <strtol@plt>
mov    %eax,%ebp
mov    0x8(%rsp),%rax
test   %rax,%rax
je     117e <Find_decimal_value+0x4e>
cmpb   $0x0,(%rax)
je     11a9 <Find_decimal_value+0x79>
movq   $0x0,0x8(%rsp)
lea    0x8(%rsp),%rsi
xor    %ebp,%ebp
mov    %rbx,%rdi
xor    %edx,%edx
call   1050 <strtol@plt>
mov    0x8(%rsp),%rcx
test   %rcx,%rcx
je     11a9 <Find_decimal_value+0x79>
cmpb   $0x0,(%rcx)
jne    11a9 <Find_decimal_value+0x79>
mov    %eax,%ebp
lea    0xe50(%rip),%rdi
mov    %r14,%rsi
mov    %ebp,%edx
call   1030 <DEBUG4@plt>
mov    %ebp,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.line_list = type { i32 }
@.str = [41 x i8] c"Find_decimal_value: key '%s', value '%d'\00"
define i32 @Find_decimal_value(%struct.line_list* %0, i8* %1, i8* %2) {
%4 = alloca %struct.line_list*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
store %struct.line_list* %0, %struct.line_list** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
store i8* null, i8** %7
store i32 0, i32* %9
%10 = load %struct.line_list*, %struct.line_list** %4
%11 = icmp ne %struct.line_list* %10, null
br i1 %11, label %12, label %41
12: ; preds = %3
%13 = load %struct.line_list*, %struct.line_list** %4
%14 = load i8*, i8** %5
%15 = load i8*, i8** %6
%16 = call i8* @Find_value(%struct.line_list* %13, i8* %14, i8* %15)
store i8* %16, i8** %7
%17 = icmp ne i8* %16, null
br i1 %17, label %18, label %41
18: ; preds = %12
store i8* null, i8** %8
%19 = load i8*, i8** %7
%20 = call i32 @strtol(i8* %19, i8** %8, i32 10)
store i32 %20, i32* %9
%21 = load i8*, i8** %8
%22 = icmp ne i8* %21, null
br i1 %22, label %23, label %28
23: ; preds = %18
%24 = load i8*, i8** %8
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp ne i32 %26, 0
br i1 %27, label %28, label %40
28: ; preds = %23, %18
store i8* null, i8** %8
%29 = load i8*, i8** %7
%30 = call i32 @strtol(i8* %29, i8** %8, i32 0)
store i32 %30, i32* %9
%31 = load i8*, i8** %8
%32 = icmp ne i8* %31, null
br i1 %32, label %33, label %38
33: ; preds = %28
%34 = load i8*, i8** %8
%35 = load i8, i8* %34
%36 = sext i8 %35 to i32
%37 = icmp ne i32 %36, 0
br i1 %37, label %38, label %39
38: ; preds = %33, %28
store i32 0, i32* %9
br label %39
39: ; preds = %38, %33
br label %40
40: ; preds = %39, %23
br label %41
41: ; preds = %40, %12, %3
%42 = load i8*, i8** %5
%43 = load i32, i32* %9
%44 = call i32 @DEBUG4(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* %42, i32 %43)
%45 = load i32, i32* %9
ret i32 %45
}

LLVM IR (-O2):
%struct.line_list = type { i32 }
@.str = [41 x i8] c"Find_decimal_value: key '%s', value '%d'\00"
define i32 @Find_decimal_value(%struct.line_list* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = bitcast i8** %4 to i8*
%6 = icmp eq %struct.line_list* %0, null
br i1 %6, label %25, label %7
7: ; preds = %3
%8 = tail call i8* @Find_value(%struct.line_list* %0, i8* %1, i8* %2)
%9 = icmp eq i8* %8, null
br i1 %9, label %25, label %10
10: ; preds = %7
store i8* null, i8** %4
%11 = call i32 @strtol(i8* %8, i8** %4, i32 10)
%12 = load i8*, i8** %4
%13 = icmp eq i8* %12, null
br i1 %13, label %17, label %14
14: ; preds = %10
%15 = load i8, i8* %12
%16 = icmp eq i8 %15, 0
br i1 %16, label %25, label %17
17: ; preds = %14, %10
store i8* null, i8** %4
%18 = call i32 @strtol(i8* %8, i8** %4, i32 0)
%19 = load i8*, i8** %4
%20 = icmp eq i8* %19, null
br i1 %20, label %24, label %21
21: ; preds = %17
%22 = load i8, i8* %19
%23 = icmp eq i8 %22, 0
br i1 %23, label %25, label %24
24: ; preds = %21, %17
br label %25
25: ; preds = %14, %24, %21, %7, %3
%26 = phi i32 [ 0, %24 ], [ %18, %21 ], [ %11, %14 ], [ 0, %7 ], [ 0, %3 ]
%27 = tail call i32 @DEBUG4(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i8* %1, i32 %26)
ret i32 %26
}