#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*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
void md_file_begin(FILE *fw, int term) {
  switch (term) {
  case 0:
    break;
  case 1:
    fprintf(fw, "<html>\n");
    fprintf(fw, "<body>\n");
    break;
  case 2:
    fprintf(fw, "\\documentclass{report}\n");
    fprintf(fw, "\\usepackage{graphicx}\n");
    fprintf(fw, "\\voffset = -37 mm\n");
    fprintf(fw, "\\textheight = 264 mm\n");
    fprintf(fw, "\\hoffset = -18 mm\n");
    fprintf(fw, "\\textwidth = 172 mm\n");
    fprintf(fw, "\\footskip = 18 mm\n");
    fprintf(fw, "\\begin{document}\n");
    break;
  }
}


x86 assembly (clang, -O0):
<md_file_begin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
test   %eax,%eax
je     1154 <md_file_begin+0x44>
jmp    1132 <md_file_begin+0x22>
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
je     1159 <md_file_begin+0x49>
jmp    1143 <md_file_begin+0x33>
mov    -0x10(%rbp),%eax
sub    $0x2,%eax
je     117e <md_file_begin+0x6e>
jmp    11fe <md_file_begin+0xee>
jmp    11fe <md_file_begin+0xee>
mov    -0x8(%rbp),%rdi
lea    0xe9c(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe94(%rip),%rsi
call   1030 <fprintf@plt>
jmp    11fe <md_file_begin+0xee>
mov    -0x8(%rbp),%rdi
lea    0xe87(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe8f(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe96(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe99(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xe9f(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xea2(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xea7(%rip),%rsi
call   1030 <fprintf@plt>
mov    -0x8(%rbp),%rdi
lea    0xeaa(%rip),%rsi
call   1030 <fprintf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<md_file_begin>:
push   %rbx
mov    %rdi,%rbx
cmp    $0x2,%esi
je     114c <md_file_begin+0x3c>
cmp    $0x1,%esi
jne    1215 <md_file_begin+0x105>
lea    0xed7(%rip),%rdi
mov    $0x7,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fwrite@plt>
lea    0xec6(%rip),%rdi
mov    $0x7,%esi
jmp    1207 <md_file_begin+0xf7>
lea    0xebd(%rip),%rdi
mov    $0x17,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fwrite@plt>
lea    0xebc(%rip),%rdi
mov    $0x16,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fwrite@plt>
lea    0xeba(%rip),%rdi
mov    $0x12,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fwrite@plt>
lea    0xeb4(%rip),%rdi
mov    $0x15,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fwrite@plt>
lea    0xeb1(%rip),%rdi
mov    $0x12,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fwrite@plt>
lea    0xeab(%rip),%rdi
mov    $0x14,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fwrite@plt>
lea    0xea7(%rip),%rdi
mov    $0x12,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1030 <fwrite@plt>
lea    0xea1(%rip),%rdi
mov    $0x11,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
pop    %rbx
jmp    1030 <fwrite@plt>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"<html>\0A\00"
@.str.1 = [8 x i8] c"<body>\0A\00"
@.str.2 = [24 x i8] c"\\documentclass{report}\0A\00"
@.str.3 = [23 x i8] c"\\usepackage{graphicx}\0A\00"
@.str.4 = [19 x i8] c"\\voffset = -37 mm\0A\00"
@.str.5 = [22 x i8] c"\\textheight = 264 mm\0A\00"
@.str.6 = [19 x i8] c"\\hoffset = -18 mm\0A\00"
@.str.7 = [21 x i8] c"\\textwidth = 172 mm\0A\00"
@.str.8 = [19 x i8] c"\\footskip = 18 mm\0A\00"
@.str.9 = [18 x i8] c"\\begin{document}\0A\00"
define void @md_file_begin(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
switch i32 %5, label %29 [
i32 0, label %6
i32 1, label %7
i32 2, label %12
]
6: ; preds = %2
br label %29
7: ; preds = %2
%8 = load i32*, i32** %3
%9 = call i32 @fprintf(i32* %8, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%10 = load i32*, i32** %3
%11 = call i32 @fprintf(i32* %10, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0))
br label %29
12: ; preds = %2
%13 = load i32*, i32** %3
%14 = call i32 @fprintf(i32* %13, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%15 = load i32*, i32** %3
%16 = call i32 @fprintf(i32* %15, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%17 = load i32*, i32** %3
%18 = call i32 @fprintf(i32* %17, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
%19 = load i32*, i32** %3
%20 = call i32 @fprintf(i32* %19, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0))
%21 = load i32*, i32** %3
%22 = call i32 @fprintf(i32* %21, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0))
%23 = load i32*, i32** %3
%24 = call i32 @fprintf(i32* %23, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0))
%25 = load i32*, i32** %3
%26 = call i32 @fprintf(i32* %25, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0))
%27 = load i32*, i32** %3
%28 = call i32 @fprintf(i32* %27, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0))
br label %29
29: ; preds = %2, %12, %7, %6
ret void
}

LLVM IR (-O2):
@.str = [8 x i8] c"<html>\0A\00"
@.str.1 = [8 x i8] c"<body>\0A\00"
@.str.2 = [24 x i8] c"\\documentclass{report}\0A\00"
@.str.3 = [23 x i8] c"\\usepackage{graphicx}\0A\00"
@.str.4 = [19 x i8] c"\\voffset = -37 mm\0A\00"
@.str.5 = [22 x i8] c"\\textheight = 264 mm\0A\00"
@.str.6 = [19 x i8] c"\\hoffset = -18 mm\0A\00"
@.str.7 = [21 x i8] c"\\textwidth = 172 mm\0A\00"
@.str.8 = [19 x i8] c"\\footskip = 18 mm\0A\00"
@.str.9 = [18 x i8] c"\\begin{document}\0A\00"
define void @md_file_begin(i32* nocapture %0, i32 %1) {
switch i32 %1, label %15 [
i32 2, label %6
i32 1, label %3
]
3: ; preds = %2
%4 = tail call i64 @fwrite(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i64 7, i64 1, i32* %0)
%5 = tail call i64 @fwrite(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i64 7, i64 1, i32* %0)
br label %15
6: ; preds = %2
%7 = tail call i64 @fwrite(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i64 23, i64 1, i32* %0)
%8 = tail call i64 @fwrite(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0), i64 22, i64 1, i32* %0)
%9 = tail call i64 @fwrite(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i64 18, i64 1, i32* %0)
%10 = tail call i64 @fwrite(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.5, i64 0, i64 0), i64 21, i64 1, i32* %0)
%11 = tail call i64 @fwrite(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i64 18, i64 1, i32* %0)
%12 = tail call i64 @fwrite(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.7, i64 0, i64 0), i64 20, i64 1, i32* %0)
%13 = tail call i64 @fwrite(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.8, i64 0, i64 0), i64 18, i64 1, i32* %0)
%14 = tail call i64 @fwrite(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.9, i64 0, i64 0), i64 17, i64 1, i32* %0)
br label %15
15: ; preds = %2, %6, %3
ret void
}