#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 /*<<< orphan*/);
int Find_flag_value(struct line_list *l, const char *key, const char *sep) {
  const char *s;
  char *e;
  int n = 0;
  if (l && (s = Find_value(l, key, sep))) {
    e = 0;
    n = strtol(s, &e, 0);
    if (!e || *e)
      n = 0;
  }
  DEBUG4("Find_flag_value: key '%s', value '%d'", key, n);
  return (n);
}


x86 assembly (clang, -O0):
<Find_flag_value>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     11b6 <Find_flag_value+0x86>
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     11b6 <Find_flag_value+0x86>
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     11aa <Find_flag_value+0x7a>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11b1 <Find_flag_value+0x81>
movl   $0x0,-0x2c(%rbp)
jmp    11b6 <Find_flag_value+0x86>
mov    -0x10(%rbp),%rsi
mov    -0x2c(%rbp),%edx
lea    0xe3c(%rip),%rdi
call   1030 <DEBUG4@plt>
mov    -0x2c(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Find_flag_value>:
push   %rbp
push   %rbx
push   %rax
mov    %rsi,%rbx
xor    %ebp,%ebp
test   %rdi,%rdi
je     1171 <Find_flag_value+0x41>
mov    %rbx,%rsi
call   1040 <Find_value@plt>
test   %rax,%rax
je     1171 <Find_flag_value+0x41>
movq   $0x0,(%rsp)
mov    %rsp,%rsi
xor    %ebp,%ebp
mov    %rax,%rdi
xor    %edx,%edx
call   1050 <strtol@plt>
mov    (%rsp),%rcx
test   %rcx,%rcx
je     1171 <Find_flag_value+0x41>
cmpb   $0x0,(%rcx)
jne    1171 <Find_flag_value+0x41>
mov    %eax,%ebp
lea    0xe88(%rip),%rdi
mov    %rbx,%rsi
mov    %ebp,%edx
call   1030 <DEBUG4@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.line_list = type { i32 }
@.str = [38 x i8] c"Find_flag_value: key '%s', value '%d'\00"
define i32 @Find_flag_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 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 %30
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 %30
18: ; preds = %12
store i8* null, i8** %8
%19 = load i8*, i8** %7
%20 = call i32 @strtol(i8* %19, i8** %8, i32 0)
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 %29
28: ; preds = %23, %18
store i32 0, i32* %9
br label %29
29: ; preds = %28, %23
br label %30
30: ; preds = %29, %12, %3
%31 = load i8*, i8** %5
%32 = load i32, i32* %9
%33 = call i32 @DEBUG4(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %31, i32 %32)
%34 = load i32, i32* %9
ret i32 %34
}

LLVM IR (-O2):
%struct.line_list = type { i32 }
@.str = [38 x i8] c"Find_flag_value: key '%s', value '%d'\00"
define i32 @Find_flag_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 %18, 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 %18, label %10
10: ; preds = %7
store i8* null, i8** %4
%11 = call i32 @strtol(i8* %8, i8** %4, i32 0)
%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 %18, label %17
17: ; preds = %14, %10
br label %18
18: ; preds = %14, %17, %7, %3
%19 = phi i32 [ 0, %17 ], [ %11, %14 ], [ 0, %7 ], [ 0, %3 ]
%20 = tail call i32 @DEBUG4(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0), i8* %1, i32 %19)
ret i32 %19
}