#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 */
long atol(char *);
int /*<<< orphan*/ parse_xml_attribute_text(char *, int, char *, char *);
int parse_xml_attribute_number(char *target, char *input, long *output) {
  char buffer[11];
  if (!target || !input || !output)
    return 0;
  if (!parse_xml_attribute_text(buffer, sizeof(buffer), target, input)) {
    return 0;
  }
  *output = atol(buffer);
  return 1;
}


x86 assembly (clang, -O0):
<parse_xml_attribute_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1155 <parse_xml_attribute_number+0x35>
cmpq   $0x0,-0x18(%rbp)
je     1155 <parse_xml_attribute_number+0x35>
cmpq   $0x0,-0x20(%rbp)
jne    1161 <parse_xml_attribute_number+0x41>
movl   $0x0,-0x4(%rbp)
jmp    11a6 <parse_xml_attribute_number+0x86>
lea    -0x2b(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
mov    $0xb,%esi
call   1030 <parse_xml_attribute_text@plt>
cmp    $0x0,%eax
jne    118c <parse_xml_attribute_number+0x6c>
movl   $0x0,-0x4(%rbp)
jmp    11a6 <parse_xml_attribute_number+0x86>
lea    -0x2b(%rbp),%rdi
call   1040 <atol@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_xml_attribute_number>:
push   %r14
push   %rbx
sub    $0x18,%rsp
xor    %ebx,%ebx
test   %rdi,%rdi
je     1166 <parse_xml_attribute_number+0x46>
mov    %rsi,%rcx
test   %rsi,%rsi
je     1166 <parse_xml_attribute_number+0x46>
mov    %rdx,%r14
test   %rdx,%rdx
je     1166 <parse_xml_attribute_number+0x46>
mov    %rdi,%rdx
lea    0xd(%rsp),%rdi
mov    $0xb,%esi
call   1030 <parse_xml_attribute_text@plt>
test   %eax,%eax
je     1166 <parse_xml_attribute_number+0x46>
lea    0xd(%rsp),%rdi
call   1040 <atol@plt>
mov    %rax,(%r14)
mov    $0x1,%ebx
mov    %ebx,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define i32 @parse_xml_attribute_number(i8* %0, i8* %1, i64* writeonly %2) {
%4 = alloca [11 x i8]
%5 = getelementptr inbounds [11 x i8], [11 x i8]* %4, i64 0, i64 0
%6 = icmp ne i8* %0, null
%7 = icmp ne i8* %1, null
%8 = and i1 %6, %7
%9 = icmp ne i64* %2, null
%10 = and i1 %8, %9
br i1 %10, label %11, label %16
11: ; preds = %3
%12 = call i32 @parse_xml_attribute_text(i8* %5, i32 11, i8* %0, i8* %1)
%13 = icmp eq i32 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %11
%15 = call i64 @atol(i8* %5)
store i64 %15, i64* %2
br label %16
16: ; preds = %11, %3, %14
%17 = phi i32 [ 1, %14 ], [ 0, %3 ], [ 0, %11 ]
ret i32 %17
}