#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*/ CallParamFunc(char *, int);
int /*<<< orphan*/ diagnostics(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ free(char *);
char *getBraceParam();
scalar_t__ strcmp(char *, char *);
void CmdPreambleBeginEnd(int code) {
  char *cParam = getBraceParam();
  if (strcmp(cParam, "document"))
    diagnostics(
        0, "\\begin{%s} found before \\begin{document}.  Giving up.  Sorry",
        cParam);
  CallParamFunc(cParam, 0x4000);
  free(cParam);
}


x86 assembly (clang, -O0):
<CmdPreambleBeginEnd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    $0x0,%al
call   1040 <getBraceParam@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xe8f(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     1192 <CmdPreambleBeginEnd+0x42>
mov    -0x10(%rbp),%rdx
xor    %edi,%edi
lea    0xe7c(%rip),%rsi
call   1050 <diagnostics@plt>
mov    -0x10(%rbp),%rdi
mov    $0x4000,%esi
call   1070 <CallParamFunc@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CmdPreambleBeginEnd>:
push   %rbx
xor    %eax,%eax
call   1040 <getBraceParam@plt>
mov    %rax,%rbx
lea    0xe9e(%rip),%rsi
mov    %rax,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
je     1180 <CmdPreambleBeginEnd+0x30>
lea    0xe93(%rip),%rsi
xor    %edi,%edi
mov    %rbx,%rdx
call   1050 <diagnostics@plt>
mov    %rbx,%rdi
mov    $0x4000,%esi
call   1070 <CallParamFunc@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <free@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"document\00"
@.str.1 = [61 x i8] c"\\begin{%s} found before \\begin{document}. Giving up. Sorry\00"
define void @CmdPreambleBeginEnd(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
store i32 %0, i32* %2
%4 = call i8* (...) @getBraceParam()
store i8* %4, i8** %3
%5 = load i8*, i8** %3
%6 = call i64 @strcmp(i8* %5, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %1
%9 = load i8*, i8** %3
%10 = call i32 @diagnostics(i32 0, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.1, i64 0, i64 0), i8* %9)
br label %11
11: ; preds = %8, %1
%12 = load i8*, i8** %3
%13 = call i32 @CallParamFunc(i8* %12, i32 16384)
%14 = load i8*, i8** %3
%15 = call i32 @free(i8* %14)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"document\00"
@.str.1 = [61 x i8] c"\\begin{%s} found before \\begin{document}. Giving up. Sorry\00"
define void @CmdPreambleBeginEnd(i32 %0) {
%2 = tail call i8* (...) @getBraceParam()
%3 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i64 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 @diagnostics(i32 0, i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str.1, i64 0, i64 0), i8* %2)
br label %7
7: ; preds = %5, %1
%8 = tail call i32 @CallParamFunc(i8* %2, i32 16384)
%9 = tail call i32 @free(i8* %2)
ret void
}