#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 */
int /*<<< orphan*/ get_property(char const *, char const *, char *,
                                int /*<<< orphan*/ *);
int strtol(char *, int /*<<< orphan*/ *, int);
int tolower(char);
int get_property_int(const char *filename, const char *propname) {
  char buf[32768];
  int value = 0;
  get_property(filename, propname, buf, NULL);
  if (*buf)
    switch (tolower(*buf)) {
    case '0':
    case 'n':
      return 0;
    }
  value = strtol(buf, NULL, 10);
  return value ? value : 1;
}


x86 assembly (clang, -O0):
<get_property_int>:
push   %rbp
mov    %rsp,%rbp
sub    $0x8030,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
movl   $0x0,-0x8024(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    -0x8020(%rbp),%rdx
xor    %eax,%eax
mov    %eax,%ecx
call   1030 <get_property@plt>
cmpb   $0x0,-0x8020(%rbp)
je     11b9 <get_property_int+0x89>
movsbl -0x8020(%rbp),%edi
call   1050 <tolower@plt>
mov    %eax,%ecx
mov    %ecx,-0x8028(%rbp)
sub    $0x30,%eax
je     11a8 <get_property_int+0x78>
jmp    1194 <get_property_int+0x64>
mov    -0x8028(%rbp),%eax
sub    $0x6e,%eax
jne    11b4 <get_property_int+0x84>
jmp    11a8 <get_property_int+0x78>
movl   $0x0,-0x4(%rbp)
jmp    120b <get_property_int+0xdb>
jmp    11b9 <get_property_int+0x89>
lea    -0x8020(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1040 <strtol@plt>
mov    %eax,-0x8024(%rbp)
cmpl   $0x0,-0x8024(%rbp)
je     11f2 <get_property_int+0xc2>
mov    -0x8024(%rbp),%eax
mov    %eax,-0x802c(%rbp)
jmp    1202 <get_property_int+0xd2>
mov    $0x1,%eax
mov    %eax,-0x802c(%rbp)
jmp    1202 <get_property_int+0xd2>
mov    -0x802c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x8030,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_property_int>:
push   %rbx
sub    $0x8000,%rsp
xor    %ebx,%ebx
mov    %rsp,%rdx
xor    %ecx,%ecx
call   1030 <get_property@plt>
mov    (%rsp),%al
test   %al,%al
je     115d <get_property_int+0x2d>
movsbl %al,%edi
call   1050 <tolower@plt>
cmp    $0x30,%eax
je     1176 <get_property_int+0x46>
cmp    $0x6e,%eax
je     1176 <get_property_int+0x46>
mov    %rsp,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1040 <strtol@plt>
test   %eax,%eax
mov    $0x1,%ebx
cmovne %eax,%ebx
mov    %ebx,%eax
add    $0x8000,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @get_property_int(i8* %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca [32768 x i8]
%7 = alloca i32
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32 0, i32* %7
%8 = load i8*, i8** %4
%9 = load i8*, i8** %5
%10 = getelementptr inbounds [32768 x i8], [32768 x i8]* %6, i64 0, i64 0
%11 = call i32 @get_property(i8* %8, i8* %9, i8* %10, i32* null)
%12 = getelementptr inbounds [32768 x i8], [32768 x i8]* %6, i64 0, i64 0
%13 = load i8, i8* %12
%14 = icmp ne i8 %13, 0
br i1 %14, label %15, label %21
15: ; preds = %2
%16 = getelementptr inbounds [32768 x i8], [32768 x i8]* %6, i64 0, i64 0
%17 = load i8, i8* %16
%18 = call i32 @tolower(i8 signext %17)
switch i32 %18, label %20 [
i32 48, label %19
i32 110, label %19
]
19: ; preds = %15, %15
store i32 0, i32* %3
br label %31
20: ; preds = %15
br label %21
21: ; preds = %20, %2
%22 = getelementptr inbounds [32768 x i8], [32768 x i8]* %6, i64 0, i64 0
%23 = call i32 @strtol(i8* %22, i32* null, i32 10)
store i32 %23, i32* %7
%24 = load i32, i32* %7
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %21
%27 = load i32, i32* %7
br label %29
28: ; preds = %21
br label %29
29: ; preds = %28, %26
%30 = phi i32 [ %27, %26 ], [ 1, %28 ]
store i32 %30, i32* %3
br label %31
31: ; preds = %29, %19
%32 = load i32, i32* %3
ret i32 %32
}

LLVM IR (-O2):
define i32 @get_property_int(i8* %0, i8* %1) {
%3 = alloca [32768 x i8]
%4 = getelementptr inbounds [32768 x i8], [32768 x i8]* %3, i64 0, i64 0
%5 = call i32 @get_property(i8* %0, i8* %1, i8* %4, i32* null)
%6 = load i8, i8* %4
%7 = icmp eq i8 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %2
%9 = call i32 @tolower(i8 signext %6)
switch i32 %9, label %10 [
i32 48, label %14
i32 110, label %14
]
10: ; preds = %8, %2
%11 = call i32 @strtol(i8* nocapture %4, i32* null, i32 10)
%12 = icmp eq i32 %11, 0
%13 = select i1 %12, i32 1, i32 %11
br label %14
14: ; preds = %8, %8, %10
%15 = phi i32 [ %13, %10 ], [ 0, %8 ], [ 0, %8 ]
ret i32 %15
}