#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 */
struct XMLdocfile {
  int dummy;
};

/* Variables and functions */
int XMLdocRenderFile(struct XMLdocfile *);
scalar_t__ strncmp(char *, char *, int);
int XMLdocFileTrap(char *buf, int sze, void *data) {
  struct XMLdocfile *ptr;
  if (strncmp(buf, "&file;", sze) != 0)
    return 0;
  ptr = (struct XMLdocfile *)data;
  if (ptr != NULL)
    return XMLdocRenderFile(ptr);
  return 0;
}


x86 assembly (clang, -O0):
<XMLdocFileTrap>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%edx
lea    0xebf(%rip),%rsi
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     115c <XMLdocFileTrap+0x3c>
movl   $0x0,-0x4(%rbp)
jmp    1187 <XMLdocFileTrap+0x67>
mov    -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1180 <XMLdocFileTrap+0x60>
mov    -0x28(%rbp),%rdi
call   1040 <XMLdocRenderFile@plt>
mov    %eax,-0x4(%rbp)
jmp    1187 <XMLdocFileTrap+0x67>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<XMLdocFileTrap>:
push   %rbx
mov    %rdx,%rbx
mov    %esi,%edx
lea    0xed3(%rip),%rsi
call   1030 <strncmp@plt>
test   %rbx,%rbx
je     1145 <XMLdocFileTrap+0x25>
test   %rax,%rax
jne    1145 <XMLdocFileTrap+0x25>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <XMLdocRenderFile@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.XMLdocfile = type { i32 }
@.str = [7 x i8] c"&file;\00"
define i32 @XMLdocFileTrap(i8* %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca %struct.XMLdocfile*
store i8* %0, i8** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
%9 = load i8*, i8** %5
%10 = load i32, i32* %6
%11 = call i64 @strncmp(i8* %9, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %14
13: ; preds = %3
store i32 0, i32* %4
br label %23
14: ; preds = %3
%15 = load i8*, i8** %7
%16 = bitcast i8* %15 to %struct.XMLdocfile*
store %struct.XMLdocfile* %16, %struct.XMLdocfile** %8
%17 = load %struct.XMLdocfile*, %struct.XMLdocfile** %8
%18 = icmp ne %struct.XMLdocfile* %17, null
br i1 %18, label %19, label %22
19: ; preds = %14
%20 = load %struct.XMLdocfile*, %struct.XMLdocfile** %8
%21 = call i32 @XMLdocRenderFile(%struct.XMLdocfile* %20)
store i32 %21, i32* %4
br label %23
22: ; preds = %14
store i32 0, i32* %4
br label %23
23: ; preds = %22, %19, %13
%24 = load i32, i32* %4
ret i32 %24
}

LLVM IR (-O2):
%struct.XMLdocfile = type { i32 }
@.str = [7 x i8] c"&file;\00"
define i32 @XMLdocFileTrap(i8* %0, i32 %1, i8* %2) {
%4 = tail call i64 @strncmp(i8* %0, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %1)
%5 = icmp ne i64 %4, 0
%6 = icmp eq i8* %2, null
%7 = or i1 %6, %5
br i1 %7, label %11, label %8
8: ; preds = %3
%9 = bitcast i8* %2 to %struct.XMLdocfile*
%10 = tail call i32 @XMLdocRenderFile(%struct.XMLdocfile* %9)
br label %11
11: ; preds = %3, %8
%12 = phi i32 [ %10, %8 ], [ 0, %3 ]
ret i32 %12
}