#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_str(char const *);
int /*<<< orphan*/ sscanf(char *, char *, unsigned int *);
int Config_get_int(const char *par_name) {
  unsigned int intval;
  char *strval = Config_get_str(par_name);
  if (!sscanf(strval, "0x%04x", &intval) && !sscanf(strval, "%d", &intval)) {
    return 0;
  }
  return (intval);
}


x86 assembly (clang, -O0):
<Config_get_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1030 <Config_get_str@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
lea    0xebc(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1040 <sscanf@plt>
cmp    $0x0,%eax
jne    117f <Config_get_int+0x5f>
mov    -0x20(%rbp),%rdi
lea    0xea6(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1040 <sscanf@plt>
cmp    $0x0,%eax
jne    117f <Config_get_int+0x5f>
movl   $0x0,-0x4(%rbp)
jmp    1185 <Config_get_int+0x65>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Config_get_int>:
push   %rbx
sub    $0x10,%rsp
call   1030 <Config_get_str@plt>
mov    %rax,%rbx
lea    0xecc(%rip),%rsi
lea    0xc(%rsp),%rdx
mov    %rax,%rdi
call   1040 <sscanf@plt>
test   %eax,%eax
jne    115d <Config_get_int+0x3d>
lea    0xebb(%rip),%rsi
lea    0xc(%rsp),%rdx
mov    %rbx,%rdi
call   1040 <sscanf@plt>
test   %eax,%eax
je     1167 <Config_get_int+0x47>
mov    0xc(%rsp),%eax
add    $0x10,%rsp
pop    %rbx
ret
xor    %eax,%eax
jmp    1161 <Config_get_int+0x41>

LLVM IR (-O0):
@.str = [7 x i8] c"0x%04x\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @Config_get_int(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
%6 = load i8*, i8** %3
%7 = call i8* @Config_get_str(i8* %6)
store i8* %7, i8** %5
%8 = load i8*, i8** %5
%9 = call i32 @sscanf(i8* %8, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %4)
%10 = icmp ne i32 %9, 0
br i1 %10, label %16, label %11
11: ; preds = %1
%12 = load i8*, i8** %5
%13 = call i32 @sscanf(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%14 = icmp ne i32 %13, 0
br i1 %14, label %16, label %15
15: ; preds = %11
store i32 0, i32* %2
br label %18
16: ; preds = %11, %1
%17 = load i32, i32* %4
store i32 %17, i32* %2
br label %18
18: ; preds = %16, %15
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
@.str = [7 x i8] c"0x%04x\00"
@.str.1 = [3 x i8] c"%d\00"
define i32 @Config_get_int(i8* %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = tail call i8* @Config_get_str(i8* %0)
%5 = call i32 @sscanf(i8* %4, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32* %2)
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %10
7: ; preds = %1
%8 = call i32 @sscanf(i8* %4, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%9 = icmp eq i32 %8, 0
br i1 %9, label %12, label %10
10: ; preds = %7, %1
%11 = load i32, i32* %2
br label %12
12: ; preds = %7, %10
%13 = phi i32 [ %11, %10 ], [ 0, %7 ]
ret i32 %13
}