#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 parse {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ EOF;
int curparse_push(struct parse *, char *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ logdbg(struct parse *, char *, char *);
int /*<<< orphan*/ parse_advance(struct parse *);
char *parse_value(struct parse *, int /*<<< orphan*/, int /*<<< orphan*/);
int parse_include(struct parse *p) {
  char *v;
  int rc;
  parse_advance(p);
  if (NULL == (v = parse_value(p, EOF, 0)))
    return (0);
  logdbg(p, "new inclusion: %s", v);
  rc = curparse_push(p, v);
  free(v);
  return (rc);
}


x86 assembly (clang, -O0):
<parse_include>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1060 <parse_advance@plt>
mov    -0x10(%rbp),%rdi
mov    0x2e78(%rip),%rax
mov    (%rax),%esi
xor    %edx,%edx
call   1040 <parse_value@plt>
mov    %rax,%rcx
mov    %rcx,-0x18(%rbp)
xor    %eax,%eax
cmp    %rcx,%rax
jne    1197 <parse_include+0x47>
movl   $0x0,-0x4(%rbp)
jmp    11ca <parse_include+0x7a>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rdx
lea    0xe5a(%rip),%rsi
call   1070 <logdbg@plt>
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <curparse_push@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_include>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%r14
call   1060 <parse_advance@plt>
mov    0x2e85(%rip),%rax
mov    (%rax),%esi
mov    %r14,%rdi
xor    %edx,%edx
call   1040 <parse_value@plt>
test   %rax,%rax
je     11a2 <parse_include+0x52>
mov    %rax,%rbx
lea    0xe82(%rip),%rsi
mov    %r14,%rdi
mov    %rax,%rdx
call   1070 <logdbg@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <curparse_push@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %ebp,%eax
jmp    11a4 <parse_include+0x54>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.parse = type { i32 }
@EOF = global i32 0
@.str = [18 x i8] c"new inclusion: %s\00"
define i32 @parse_include(%struct.parse* %0) {
%2 = alloca i32
%3 = alloca %struct.parse*
%4 = alloca i8*
%5 = alloca i32
store %struct.parse* %0, %struct.parse** %3
%6 = load %struct.parse*, %struct.parse** %3
%7 = call i32 @parse_advance(%struct.parse* %6)
%8 = load %struct.parse*, %struct.parse** %3
%9 = load i32, i32* @EOF
%10 = call i8* @parse_value(%struct.parse* %8, i32 %9, i32 0)
store i8* %10, i8** %4
%11 = icmp eq i8* null, %10
br i1 %11, label %12, label %13
12: ; preds = %1
store i32 0, i32* %2
br label %23
13: ; preds = %1
%14 = load %struct.parse*, %struct.parse** %3
%15 = load i8*, i8** %4
%16 = call i32 @logdbg(%struct.parse* %14, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %15)
%17 = load %struct.parse*, %struct.parse** %3
%18 = load i8*, i8** %4
%19 = call i32 @curparse_push(%struct.parse* %17, i8* %18)
store i32 %19, i32* %5
%20 = load i8*, i8** %4
%21 = call i32 @free(i8* %20)
%22 = load i32, i32* %5
store i32 %22, i32* %2
br label %23
23: ; preds = %13, %12
%24 = load i32, i32* %2
ret i32 %24
}

LLVM IR (-O2):
%struct.parse = type { i32 }
@EOF = global i32 0
@.str = [18 x i8] c"new inclusion: %s\00"
define i32 @parse_include(%struct.parse* %0) {
%2 = tail call i32 @parse_advance(%struct.parse* %0)
%3 = load i32, i32* @EOF
%4 = tail call i8* @parse_value(%struct.parse* %0, i32 %3, i32 0)
%5 = icmp eq i8* %4, null
br i1 %5, label %10, label %6
6: ; preds = %1
%7 = tail call i32 @logdbg(%struct.parse* %0, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i8* %4)
%8 = tail call i32 @curparse_push(%struct.parse* %0, i8* %4)
%9 = tail call i32 @free(i8* %4)
br label %10
10: ; preds = %1, %6
%11 = phi i32 [ %8, %6 ], [ 0, %1 ]
ret i32 %11
}