#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*/ itex2MML_free_string(char *);
int /*<<< orphan*/ itex2MML_restart();
int /*<<< orphan*/ itex2MML_setup(char const *, size_t);
int itex2MML_yyparse(char **);
char *itex2MML_parse(const char *buffer, size_t length) {
  char *mathml = 0;
  int result;
  itex2MML_setup(buffer, length);
  itex2MML_restart();
  result = itex2MML_yyparse(&mathml);
  if (result && mathml) {
    itex2MML_free_string(mathml);
    mathml = 0;
  }
  return mathml;
}


x86 assembly (clang, -O0):
<itex2MML_parse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <itex2MML_setup@plt>
mov    $0x0,%al
call   1050 <itex2MML_restart@plt>
lea    -0x18(%rbp),%rdi
call   1060 <itex2MML_yyparse@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     119e <itex2MML_parse+0x5e>
cmpq   $0x0,-0x18(%rbp)
je     119e <itex2MML_parse+0x5e>
mov    -0x18(%rbp),%rdi
call   1040 <itex2MML_free_string@plt>
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<itex2MML_parse>:
push   %rax
movq   $0x0,(%rsp)
call   1030 <itex2MML_setup@plt>
xor    %eax,%eax
call   1050 <itex2MML_restart@plt>
mov    %rsp,%rdi
call   1060 <itex2MML_yyparse@plt>
mov    %eax,%ecx
mov    (%rsp),%rax
test   %ecx,%ecx
je     1176 <itex2MML_parse+0x36>
test   %rax,%rax
je     1176 <itex2MML_parse+0x36>
mov    %rax,%rdi
call   1040 <itex2MML_free_string@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i8* @itex2MML_parse(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i8*
%6 = alloca i32
store i8* %0, i8** %3
store i64 %1, i64* %4
store i8* null, i8** %5
%7 = load i8*, i8** %3
%8 = load i64, i64* %4
%9 = call i32 @itex2MML_setup(i8* %7, i64 %8)
%10 = call i32 (...) @itex2MML_restart()
%11 = call i32 @itex2MML_yyparse(i8** %5)
store i32 %11, i32* %6
%12 = load i32, i32* %6
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %20
14: ; preds = %2
%15 = load i8*, i8** %5
%16 = icmp ne i8* %15, null
br i1 %16, label %17, label %20
17: ; preds = %14
%18 = load i8*, i8** %5
%19 = call i32 @itex2MML_free_string(i8* %18)
store i8* null, i8** %5
br label %20
20: ; preds = %17, %14, %2
%21 = load i8*, i8** %5
ret i8* %21
}

LLVM IR (-O2):
define i8* @itex2MML_parse(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = bitcast i8** %3 to i8*
store i8* null, i8** %3
%5 = tail call i32 @itex2MML_setup(i8* %0, i64 %1)
%6 = tail call i32 (...) @itex2MML_restart()
%7 = call i32 @itex2MML_yyparse(i8** %3)
%8 = icmp ne i32 %7, 0
%9 = load i8*, i8** %3
%10 = icmp ne i8* %9, null
%11 = select i1 %8, i1 %10, i1 false
br i1 %11, label %12, label %14
12: ; preds = %2
%13 = call i32 @itex2MML_free_string(i8* %9)
br label %14
14: ; preds = %12, %2
%15 = phi i8* [ null, %12 ], [ %9, %2 ]
ret i8* %15
}