#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 */
typedef int /*<<< orphan*/ buffer;

/* Variables and functions */
scalar_t__ parse_uint(unsigned int *, char *);
int /*<<< orphan*/ read_config_value(char const *, char const *, char *,
                                     int /*<<< orphan*/ *, int, char *);
bool read_config_uint(const char *conf, const char *value_name,
                      unsigned int *dst, unsigned int default_value) {
  char buffer[12];
  read_config_value(conf, value_name, buffer, NULL, sizeof(buffer), "#");
  if (buffer[0] == '#') {
    *dst = default_value;
    return false;
  }
  if (parse_uint(dst, buffer)) {
    return true;
  } else {
    *dst = default_value;
    return false;
  }
}


x86 assembly (clang, -O0):
<read_config_uint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    -0x30(%rbp),%rdx
xor    %eax,%eax
mov    %eax,%ecx
mov    $0xc,%r8d
lea    0xeac(%rip),%r9
call   1030 <read_config_value@plt>
movsbl -0x30(%rbp),%eax
cmp    $0x23,%eax
jne    117b <read_config_uint+0x5b>
mov    -0x24(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
jmp    11ae <read_config_uint+0x8e>
mov    -0x20(%rbp),%rdi
lea    -0x30(%rbp),%rsi
call   1040 <parse_uint@plt>
cmp    $0x0,%rax
je     119e <read_config_uint+0x7e>
movl   $0x1,-0x4(%rbp)
jmp    11ae <read_config_uint+0x8e>
mov    -0x24(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_config_uint>:
push   %rbp
push   %rbx
sub    $0x18,%rsp
mov    %ecx,%ebp
mov    %rdx,%rbx
lea    0xece(%rip),%r9
lea    0xc(%rsp),%rdx
xor    %ecx,%ecx
mov    $0xc,%r8d
call   1030 <read_config_value@plt>
cmpb   $0x23,0xc(%rsp)
je     1165 <read_config_uint+0x45>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <parse_uint@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
jne    1169 <read_config_uint+0x49>
mov    %ebp,(%rbx)
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"#\00"
define i32 @read_config_uint(i8* %0, i8* %1, i32* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca [12 x i8]
store i8* %0, i8** %6
store i8* %1, i8** %7
store i32* %2, i32** %8
store i32 %3, i32* %9
%11 = load i8*, i8** %6
%12 = load i8*, i8** %7
%13 = getelementptr inbounds [12 x i8], [12 x i8]* %10, i64 0, i64 0
%14 = call i32 @read_config_value(i8* %11, i8* %12, i8* %13, i32* null, i32 12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%15 = getelementptr inbounds [12 x i8], [12 x i8]* %10, i64 0, i64 0
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 35
br i1 %18, label %19, label %22
19: ; preds = %4
%20 = load i32, i32* %9
%21 = load i32*, i32** %8
store i32 %20, i32* %21
store i32 0, i32* %5
br label %31
22: ; preds = %4
%23 = load i32*, i32** %8
%24 = getelementptr inbounds [12 x i8], [12 x i8]* %10, i64 0, i64 0
%25 = call i64 @parse_uint(i32* %23, i8* %24)
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %22
store i32 1, i32* %5
br label %31
28: ; preds = %22
%29 = load i32, i32* %9
%30 = load i32*, i32** %8
store i32 %29, i32* %30
store i32 0, i32* %5
br label %31
31: ; preds = %28, %27, %19
%32 = load i32, i32* %5
ret i32 %32
}

LLVM IR (-O2):
@.str = [2 x i8] c"#\00"
define i32 @read_config_uint(i8* %0, i8* %1, i32* %2, i32 %3) {
%5 = alloca [12 x i8]
%6 = getelementptr inbounds [12 x i8], [12 x i8]* %5, i64 0, i64 0
%7 = call i32 @read_config_value(i8* %0, i8* %1, i8* %6, i32* null, i32 12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = load i8, i8* %6
%9 = icmp eq i8 %8, 35
br i1 %9, label %13, label %10
10: ; preds = %4
%11 = call i64 @parse_uint(i32* %2, i8* %6)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %10, %4
store i32 %3, i32* %2
br label %14
14: ; preds = %13, %10
%15 = phi i32 [ 1, %10 ], [ 0, %13 ]
ret i32 %15
}