#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 */
scalar_t__ strcmp(char *, char *);
int strtol(char *, char **, int);
int /*<<< orphan*/ write_log_standard(char *, char *);
int cfgfile_intval(char *option, char *value, char *name, int *location,
                   int scale) {
  int base = 10;
  char *endptr;
  if (strcmp(option, name) != 0)
    return 0;
  if (value[0] == '0' && value[1] == 'x')
    value += 2, base = 16;
  *location = strtol(value, &endptr, base) * scale;
  if (*endptr != '\0' || *value == '\0')
    write_log_standard("Option `%s' requires a numeric argument.\n", option);
  return 1;
}


x86 assembly (clang, -O0):
<cfgfile_intval>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8d,-0x2c(%rbp)
movl   $0xa,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     1176 <cfgfile_intval+0x46>
movl   $0x0,-0x4(%rbp)
jmp    11fd <cfgfile_intval+0xcd>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jne    11aa <cfgfile_intval+0x7a>
mov    -0x18(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x78,%eax
jne    11aa <cfgfile_intval+0x7a>
mov    -0x18(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x18(%rbp)
movl   $0x10,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x30(%rbp),%edx
lea    -0x38(%rbp),%rsi
call   1040 <strtol@plt>
mov    %eax,%ecx
imul   -0x2c(%rbp),%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x38(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    11e6 <cfgfile_intval+0xb6>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    11f6 <cfgfile_intval+0xc6>
mov    -0x10(%rbp),%rsi
lea    0xe0f(%rip),%rdi
call   1050 <write_log_standard@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cfgfile_intval>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %r8d,%ebp
mov    %rcx,%r15
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rdx,%rsi
call   1030 <strcmp@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
jne    11b1 <cfgfile_intval+0x81>
mov    $0xa,%edx
cmpb   $0x30,(%rbx)
jne    1179 <cfgfile_intval+0x49>
xor    %eax,%eax
cmpb   $0x78,0x1(%rbx)
sete   %al
lea    (%rbx,%rax,2),%rbx
mov    $0x10,%eax
mov    $0xa,%edx
cmove  %eax,%edx
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1040 <strtol@plt>
imul   %ebp,%eax
mov    %eax,(%r15)
mov    (%rsp),%rax
cmpb   $0x0,(%rax)
jne    119d <cfgfile_intval+0x6d>
mov    $0x1,%eax
cmpb   $0x0,(%rbx)
jne    11b1 <cfgfile_intval+0x81>
lea    0xe5c(%rip),%rdi
mov    %r14,%rsi
call   1050 <write_log_standard@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [42 x i8] c"Option `%s' requires a numeric argument.\0A\00"
define i32 @cfgfile_intval(i8* %0, i8* %1, i8* %2, i32* %3, i32 %4) {
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i8*
store i8* %0, i8** %7
store i8* %1, i8** %8
store i8* %2, i8** %9
store i32* %3, i32** %10
store i32 %4, i32* %11
store i32 10, i32* %12
%14 = load i8*, i8** %7
%15 = load i8*, i8** %9
%16 = call i64 @strcmp(i8* %14, i8* %15)
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %5
store i32 0, i32* %6
br label %54
19: ; preds = %5
%20 = load i8*, i8** %8
%21 = getelementptr inbounds i8, i8* %20, i64 0
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp eq i32 %23, 48
br i1 %24, label %25, label %34
25: ; preds = %19
%26 = load i8*, i8** %8
%27 = getelementptr inbounds i8, i8* %26, i64 1
%28 = load i8, i8* %27
%29 = sext i8 %28 to i32
%30 = icmp eq i32 %29, 120
br i1 %30, label %31, label %34
31: ; preds = %25
%32 = load i8*, i8** %8
%33 = getelementptr inbounds i8, i8* %32, i64 2
store i8* %33, i8** %8
store i32 16, i32* %12
br label %34
34: ; preds = %31, %25, %19
%35 = load i8*, i8** %8
%36 = load i32, i32* %12
%37 = call i32 @strtol(i8* %35, i8** %13, i32 %36)
%38 = load i32, i32* %11
%39 = mul nsw i32 %37, %38
%40 = load i32*, i32** %10
store i32 %39, i32* %40
%41 = load i8*, i8** %13
%42 = load i8, i8* %41
%43 = sext i8 %42 to i32
%44 = icmp ne i32 %43, 0
br i1 %44, label %50, label %45
45: ; preds = %34
%46 = load i8*, i8** %8
%47 = load i8, i8* %46
%48 = sext i8 %47 to i32
%49 = icmp eq i32 %48, 0
br i1 %49, label %50, label %53
50: ; preds = %45, %34
%51 = load i8*, i8** %7
%52 = call i32 @write_log_standard(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* %51)
br label %53
53: ; preds = %50, %45
store i32 1, i32* %6
br label %54
54: ; preds = %53, %18
%55 = load i32, i32* %6
ret i32 %55
}

LLVM IR (-O2):
@.str = [42 x i8] c"Option `%s' requires a numeric argument.\0A\00"
define i32 @cfgfile_intval(i8* %0, i8* %1, i8* %2, i32* nocapture writeonly %3, i32 %4) {
%6 = alloca i8*
%7 = bitcast i8** %6 to i8*
%8 = tail call i64 @strcmp(i8* %0, i8* %2)
%9 = icmp eq i64 %8, 0
br i1 %9, label %10, label %33
10: ; preds = %5
%11 = load i8, i8* %1
%12 = icmp eq i8 %11, 48
br i1 %12, label %13, label %20
13: ; preds = %10
%14 = getelementptr inbounds i8, i8* %1, i64 1
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 120
%17 = select i1 %16, i64 2, i64 0
%18 = getelementptr i8, i8* %1, i64 %17
%19 = select i1 %16, i32 16, i32 10
br label %20
20: ; preds = %13, %10
%21 = phi i8* [ %1, %10 ], [ %18, %13 ]
%22 = phi i32 [ 10, %10 ], [ %19, %13 ]
%23 = call i32 @strtol(i8* %21, i8** %6, i32 %22)
%24 = mul nsw i32 %23, %4
store i32 %24, i32* %3
%25 = load i8*, i8** %6
%26 = load i8, i8* %25
%27 = icmp eq i8 %26, 0
br i1 %27, label %28, label %31
28: ; preds = %20
%29 = load i8, i8* %21
%30 = icmp eq i8 %29, 0
br i1 %30, label %31, label %33
31: ; preds = %28, %20
%32 = tail call i32 @write_log_standard(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str, i64 0, i64 0), i8* %0)
br label %33
33: ; preds = %28, %31, %5
%34 = phi i32 [ 0, %5 ], [ 1, %31 ], [ 1, %28 ]
ret i32 %34
}