#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*/ buf;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
scalar_t__ fgets(char *, int, int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char const *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char const *, ...);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ html_puts(char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ ssi_error(char *, char const *, int /*<<< orphan*/ *);
char *xstrtok(char *, char *, char **);
void table_print_csv(const char *path, const char *opts, FILE *out, int variant,
                     const char *width) {
  FILE *in;
  char buf[16384], *cp, *tokp;
  int line = 0;
  int col = 0;
  in = fopen(path, "r");
  if (!in) {
    ssi_error("table_print_csv:fopen", path, out);
    return;
  }
  fprintf(out, "<table %s>\n", opts ? opts : "");
  while (fgets(buf, sizeof(buf), in)) {
    ++line;
    col = 0;
    if (variant == 0 && line == 1)
      fputs("<tr bgcolor=\"#C0C0C0\">\n", out);
    else
      fputs("<tr>\n", out);
    cp = xstrtok(buf, ";\n", &tokp);
    while (cp) {
      ++col;
      if (variant == 0 && line == 1) {
        fprintf(out, "<th nowrap class=\"header\" align=left %s%s>",
                width ? "width=" : "", width ? width : "");
        html_puts(cp, out);
        fputs("</th>\n", out);
      } else if (variant == 1 && col == 1) {
        fprintf(out, "<th nowrap align=right %s%s>", width ? "width=" : "",
                width ? width : "");
        html_puts(cp, out);
        fputs(":</td>\n", out);
      } else {
        fprintf(out, "<td nowrap align=left %s%s>",
                (width && variant != 1) ? "width=" : "",
                (width && variant != 1) ? width : "");
        html_puts(cp, out);
        fputs("</td>\n", out);
      }
      cp = xstrtok(NULL, ";\n", &tokp);
    }
    fputs("</tr>\n", out);
  }
  fputs("</table>\n", out);
  fclose(in);
}


x86 assembly (clang, -O0):
<table_print_csv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40b0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8,-0x28(%rbp)
movl   $0x0,-0x4044(%rbp)
movl   $0x0,-0x4048(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xe43(%rip),%rsi
call   1090 <fopen@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
jne    11ea <table_print_csv+0x6a>
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xe22(%rip),%rdi
call   1050 <ssi_error@plt>
jmp    1581 <table_print_csv+0x401>
mov    -0x18(%rbp),%rax
mov    %rax,-0x4050(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1210 <table_print_csv+0x90>
mov    -0x10(%rbp),%rax
mov    %rax,-0x4058(%rbp)
jmp    1223 <table_print_csv+0xa3>
lea    0xe2d(%rip),%rax
mov    %rax,-0x4058(%rbp)
jmp    1223 <table_print_csv+0xa3>
mov    -0x4050(%rbp),%rdi
mov    -0x4058(%rbp),%rdx
lea    0xde0(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
lea    -0x4030(%rbp),%rdi
mov    -0x30(%rbp),%rdx
mov    $0x4000,%esi
call   1070 <fgets@plt>
cmp    $0x0,%rax
je     1568 <table_print_csv+0x3e8>
mov    -0x4044(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4044(%rbp)
movl   $0x0,-0x4048(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    12a3 <table_print_csv+0x123>
cmpl   $0x1,-0x4044(%rbp)
jne    12a3 <table_print_csv+0x123>
mov    -0x18(%rbp),%rsi
lea    0xd8b(%rip),%rdi
call   1060 <fputs@plt>
jmp    12b3 <table_print_csv+0x133>
mov    -0x18(%rbp),%rsi
lea    0xd8e(%rip),%rdi
call   1060 <fputs@plt>
lea    -0x4030(%rbp),%rdi
lea    0xd81(%rip),%rsi
lea    -0x4040(%rbp),%rdx
call   1030 <xstrtok@plt>
mov    %rax,-0x4038(%rbp)
cmpq   $0x0,-0x4038(%rbp)
je     1553 <table_print_csv+0x3d3>
mov    -0x4048(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4048(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jne    13aa <table_print_csv+0x22a>
cmpl   $0x1,-0x4044(%rbp)
jne    13aa <table_print_csv+0x22a>
mov    -0x18(%rbp),%rax
mov    %rax,-0x4068(%rbp)
mov    -0x28(%rbp),%rdx
lea    0xd26(%rip),%rax
lea    0xd4b(%rip),%rcx
cmp    $0x0,%rdx
cmovne %rcx,%rax
mov    %rax,-0x4060(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     134f <table_print_csv+0x1cf>
mov    -0x28(%rbp),%rax
mov    %rax,-0x4070(%rbp)
jmp    1362 <table_print_csv+0x1e2>
lea    0xcee(%rip),%rax
mov    %rax,-0x4070(%rbp)
jmp    1362 <table_print_csv+0x1e2>
mov    -0x4060(%rbp),%rdx
mov    -0x4068(%rbp),%rdi
mov    -0x4070(%rbp),%rcx
lea    0xcc7(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x4038(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   10a0 <html_puts@plt>
mov    -0x18(%rbp),%rsi
lea    0xcd7(%rip),%rdi
call   1060 <fputs@plt>
jmp    1530 <table_print_csv+0x3b0>
cmpl   $0x1,-0x1c(%rbp)
jne    1463 <table_print_csv+0x2e3>
cmpl   $0x1,-0x4048(%rbp)
jne    1463 <table_print_csv+0x2e3>
mov    -0x18(%rbp),%rax
mov    %rax,-0x4080(%rbp)
mov    -0x28(%rbp),%rdx
lea    0xc6d(%rip),%rax
lea    0xc92(%rip),%rcx
cmp    $0x0,%rdx
cmovne %rcx,%rax
mov    %rax,-0x4078(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     1408 <table_print_csv+0x288>
mov    -0x28(%rbp),%rax
mov    %rax,-0x4088(%rbp)
jmp    141b <table_print_csv+0x29b>
lea    0xc35(%rip),%rax
mov    %rax,-0x4088(%rbp)
jmp    141b <table_print_csv+0x29b>
mov    -0x4078(%rbp),%rdx
mov    -0x4080(%rbp),%rdi
mov    -0x4088(%rbp),%rcx
lea    0xc47(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x4038(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   10a0 <html_puts@plt>
mov    -0x18(%rbp),%rsi
lea    0xc42(%rip),%rdi
call   1060 <fputs@plt>
jmp    152b <table_print_csv+0x3ab>
mov    -0x18(%rbp),%rax
mov    %rax,-0x4098(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x28(%rbp)
mov    %al,-0x4089(%rbp)
je     148e <table_print_csv+0x30e>
cmpl   $0x1,-0x1c(%rbp)
setne  %al
mov    %al,-0x4089(%rbp)
mov    -0x4089(%rbp),%dl
lea    0xba9(%rip),%rax
lea    0xbce(%rip),%rcx
test   $0x1,%dl
cmovne %rcx,%rax
mov    %rax,-0x40a0(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     14d5 <table_print_csv+0x355>
cmpl   $0x1,-0x1c(%rbp)
je     14d5 <table_print_csv+0x355>
mov    -0x28(%rbp),%rax
mov    %rax,-0x40a8(%rbp)
jmp    14e8 <table_print_csv+0x368>
lea    0xb68(%rip),%rax
mov    %rax,-0x40a8(%rbp)
jmp    14e8 <table_print_csv+0x368>
mov    -0x40a0(%rbp),%rdx
mov    -0x4098(%rbp),%rdi
mov    -0x40a8(%rbp),%rcx
lea    0xb9f(%rip),%rsi
mov    $0x0,%al
call   1080 <fprintf@plt>
mov    -0x4038(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   10a0 <html_puts@plt>
mov    -0x18(%rbp),%rsi
lea    0xb76(%rip),%rdi
call   1060 <fputs@plt>
jmp    1530 <table_print_csv+0x3b0>
xor    %eax,%eax
mov    %eax,%edi
lea    0xb07(%rip),%rsi
lea    -0x4040(%rbp),%rdx
call   1030 <xstrtok@plt>
mov    %rax,-0x4038(%rbp)
jmp    12d4 <table_print_csv+0x154>
mov    -0x18(%rbp),%rsi
lea    0xb61(%rip),%rdi
call   1060 <fputs@plt>
jmp    123f <table_print_csv+0xbf>
mov    -0x18(%rbp),%rsi
lea    0xb53(%rip),%rdi
call   1060 <fputs@plt>
mov    -0x30(%rbp),%rdi
call   1040 <fclose@plt>
add    $0x40b0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<table_print_csv>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x4038,%rsp
mov    %r8,%r15
mov    %ecx,(%rsp)
mov    %rdx,%rbx
mov    %rsi,%rbp
mov    %rdi,%r14
lea    0xe59(%rip),%rsi
call   1080 <fopen@plt>
test   %rax,%rax
je     141f <table_print_csv+0x29f>
mov    %rax,%r12
test   %rbp,%rbp
lea    0xe82(%rip),%r14
cmove  %r14,%rbp
lea    0xe4b(%rip),%rsi
mov    %rbx,%rdi
mov    %rbp,%rdx
xor    %eax,%eax
call   1070 <fprintf@plt>
lea    0x30(%rsp),%rdi
mov    $0x4000,%esi
mov    %r12,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     13ec <table_print_csv+0x26c>
cmpl   $0x1,(%rsp)
setne  %al
mov    %r15,%rdx
test   %r15,%r15
lea    0xe67(%rip),%rsi
mov    %rsi,%rcx
cmove  %r14,%rcx
mov    %rcx,0x8(%rsp)
cmove  %r14,%r15
setne  %cl
test   %cl,%al
cmove  %r14,%rsi
mov    %rsi,0x18(%rsp)
cmove  %r14,%rdx
mov    %rdx,0x20(%rsp)
lea    0x30(%rsp),%rbp
xor    %r14d,%r14d
mov    %r12,0x10(%rsp)
jmp    1285 <table_print_csv+0x105>
nop
mov    0x4(%rsp),%r14d
add    $0x1,%r14d
mov    $0x6,%esi
mov    $0x1,%edx
lea    0xe65(%rip),%rdi
mov    %rbx,%rcx
call   1090 <fwrite@plt>
lea    0x30(%rsp),%rbp
mov    %rbp,%rdi
mov    $0x4000,%esi
mov    0x10(%rsp),%r12
mov    %r12,%rdx
call   1060 <fgets@plt>
test   %rax,%rax
je     13ec <table_print_csv+0x26c>
mov    (%rsp),%eax
mov    %r14d,0x4(%rsp)
or     %r14d,%eax
sete   %r14b
jne    12b0 <table_print_csv+0x130>
mov    $0x17,%esi
mov    $0x1,%edx
lea    0xd7d(%rip),%rdi
jmp    12c1 <table_print_csv+0x141>
nopl   0x0(%rax)
mov    $0x5,%esi
mov    $0x1,%edx
lea    0xd7b(%rip),%rdi
mov    %rbx,%rcx
call   1090 <fwrite@plt>
mov    %rbp,%rdi
lea    0xd6f(%rip),%rsi
lea    0x28(%rsp),%rdx
call   1030 <xstrtok@plt>
test   %rax,%rax
mov    0x8(%rsp),%rbp
je     1240 <table_print_csv+0xc0>
mov    %rax,%r13
xor    %r12d,%r12d
jmp    135e <table_print_csv+0x1de>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbx,%rdi
lea    0xd3b(%rip),%rsi
mov    %rbp,%rdx
mov    %r15,%rcx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   10a0 <html_puts@plt>
mov    $0x6,%esi
mov    $0x1,%edx
lea    0xd44(%rip),%rdi
mov    %rbx,%rcx
call   1090 <fwrite@plt>
xor    %edi,%edi
lea    0xcfe(%rip),%rsi
lea    0x28(%rsp),%rdx
call   1030 <xstrtok@plt>
mov    %rax,%r13
add    $0xffffffff,%r12d
test   %rax,%rax
je     1240 <table_print_csv+0xc0>
test   %r14b,%r14b
jne    1300 <table_print_csv+0x180>
cmpl   $0x1,(%rsp)
jne    13b0 <table_print_csv+0x230>
test   %r12d,%r12d
jne    13b0 <table_print_csv+0x230>
mov    %rbx,%rdi
lea    0xd06(%rip),%rsi
mov    %rbp,%rdx
mov    %r15,%rcx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   10a0 <html_puts@plt>
mov    $0x7,%esi
mov    $0x1,%edx
lea    0xcfa(%rip),%rdi
jmp    1333 <table_print_csv+0x1b3>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %rbx,%rdi
lea    0xce9(%rip),%rsi
mov    0x18(%rsp),%rdx
mov    0x20(%rsp),%rcx
xor    %eax,%eax
call   1070 <fprintf@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   10a0 <html_puts@plt>
mov    $0x6,%esi
mov    $0x1,%edx
lea    0xcb5(%rip),%rdi
jmp    1333 <table_print_csv+0x1b3>
lea    0xcd3(%rip),%rdi
mov    $0x9,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1090 <fwrite@plt>
mov    %r12,%rdi
call   1040 <fclose@plt>
add    $0x4038,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xbdc(%rip),%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
add    $0x4038,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <ssi_error@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"r\00"
@.str.1 = [22 x i8] c"table_print_csv:fopen\00"
@.str.2 = [12 x i8] c"<table %s>\0A\00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [24 x i8] c"<tr bgcolor=\22#C0C0C0\22>\0A\00"
@.str.5 = [6 x i8] c"<tr>\0A\00"
@.str.6 = [3 x i8] c";\0A\00"
@.str.7 = [43 x i8] c"<th nowrap class=\22header\22 align=left %s%s>\00"
@.str.8 = [7 x i8] c"width=\00"
@.str.9 = [7 x i8] c"</th>\0A\00"
@.str.10 = [29 x i8] c"<th nowrap align=right %s%s>\00"
@.str.11 = [8 x i8] c":</td>\0A\00"
@.str.12 = [28 x i8] c"<td nowrap align=left %s%s>\00"
@.str.13 = [7 x i8] c"</td>\0A\00"
@.str.14 = [7 x i8] c"</tr>\0A\00"
@.str.15 = [10 x i8] c"</table>\0A\00"
define void @table_print_csv(i8* %0, i8* %1, i32* %2, i32 %3, i8* %4) {
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i8*
%11 = alloca i32*
%12 = alloca [16384 x i8]
%13 = alloca i8*
%14 = alloca i8*
%15 = alloca i32
%16 = alloca i32
store i8* %0, i8** %6
store i8* %1, i8** %7
store i32* %2, i32** %8
store i32 %3, i32* %9
store i8* %4, i8** %10
store i32 0, i32* %15
store i32 0, i32* %16
%17 = load i8*, i8** %6
%18 = call i32* @fopen(i8* %17, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
store i32* %18, i32** %11
%19 = load i32*, i32** %11
%20 = icmp ne i32* %19, null
br i1 %20, label %25, label %21
21: ; preds = %5
%22 = load i8*, i8** %6
%23 = load i32*, i32** %8
%24 = call i32 @ssi_error(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %22, i32* %23)
br label %150
25: ; preds = %5
%26 = load i32*, i32** %8
%27 = load i8*, i8** %7
%28 = icmp ne i8* %27, null
br i1 %28, label %29, label %31
29: ; preds = %25
%30 = load i8*, i8** %7
br label %32
31: ; preds = %25
br label %32
32: ; preds = %31, %29
%33 = phi i8* [ %30, %29 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0), %31 ]
%34 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %26, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %33)
br label %35
35: ; preds = %142, %32
%36 = getelementptr inbounds [16384 x i8], [16384 x i8]* %12, i64 0, i64 0
%37 = load i32*, i32** %11
%38 = call i64 @fgets(i8* %36, i32 16384, i32* %37)
%39 = icmp ne i64 %38, 0
br i1 %39, label %40, label %145
40: ; preds = %35
%41 = load i32, i32* %15
%42 = add nsw i32 %41, 1
store i32 %42, i32* %15
store i32 0, i32* %16
%43 = load i32, i32* %9
%44 = icmp eq i32 %43, 0
br i1 %44, label %45, label %51
45: ; preds = %40
%46 = load i32, i32* %15
%47 = icmp eq i32 %46, 1
br i1 %47, label %48, label %51
48: ; preds = %45
%49 = load i32*, i32** %8
%50 = call i32 @fputs(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i32* %49)
br label %54
51: ; preds = %45, %40
%52 = load i32*, i32** %8
%53 = call i32 @fputs(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i32* %52)
br label %54
54: ; preds = %51, %48
%55 = getelementptr inbounds [16384 x i8], [16384 x i8]* %12, i64 0, i64 0
%56 = call i8* @xstrtok(i8* %55, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8** %14)
store i8* %56, i8** %13
br label %57
57: ; preds = %140, %54
%58 = load i8*, i8** %13
%59 = icmp ne i8* %58, null
br i1 %59, label %60, label %142
60: ; preds = %57
%61 = load i32, i32* %16
%62 = add nsw i32 %61, 1
store i32 %62, i32* %16
%63 = load i32, i32* %9
%64 = icmp eq i32 %63, 0
br i1 %64, label %65, label %87
65: ; preds = %60
%66 = load i32, i32* %15
%67 = icmp eq i32 %66, 1
br i1 %67, label %68, label %87
68: ; preds = %65
%69 = load i32*, i32** %8
%70 = load i8*, i8** %10
%71 = icmp ne i8* %70, null
%72 = zext i1 %71 to i64
%73 = select i1 %71, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0)
%74 = load i8*, i8** %10
%75 = icmp ne i8* %74, null
br i1 %75, label %76, label %78
76: ; preds = %68
%77 = load i8*, i8** %10
br label %79
78: ; preds = %68
br label %79
79: ; preds = %78, %76
%80 = phi i8* [ %77, %76 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0), %78 ]
%81 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %69, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.7, i64 0, i64 0), i8* %73, i8* %80)
%82 = load i8*, i8** %13
%83 = load i32*, i32** %8
%84 = call i32 @html_puts(i8* %82, i32* %83)
%85 = load i32*, i32** %8
%86 = call i32 @fputs(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i32* %85)
br label %140
87: ; preds = %65, %60
%88 = load i32, i32* %9
%89 = icmp eq i32 %88, 1
br i1 %89, label %90, label %112
90: ; preds = %87
%91 = load i32, i32* %16
%92 = icmp eq i32 %91, 1
br i1 %92, label %93, label %112
93: ; preds = %90
%94 = load i32*, i32** %8
%95 = load i8*, i8** %10
%96 = icmp ne i8* %95, null
%97 = zext i1 %96 to i64
%98 = select i1 %96, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0)
%99 = load i8*, i8** %10
%100 = icmp ne i8* %99, null
br i1 %100, label %101, label %103
101: ; preds = %93
%102 = load i8*, i8** %10
br label %104
103: ; preds = %93
br label %104
104: ; preds = %103, %101
%105 = phi i8* [ %102, %101 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0), %103 ]
%106 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %94, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.10, i64 0, i64 0), i8* %98, i8* %105)
%107 = load i8*, i8** %13
%108 = load i32*, i32** %8
%109 = call i32 @html_puts(i8* %107, i32* %108)
%110 = load i32*, i32** %8
%111 = call i32 @fputs(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i64 0, i64 0), i32* %110)
br label %139
112: ; preds = %90, %87
%113 = load i32*, i32** %8
%114 = load i8*, i8** %10
%115 = icmp ne i8* %114, null
br i1 %115, label %116, label %119
116: ; preds = %112
%117 = load i32, i32* %9
%118 = icmp ne i32 %117, 1
br label %119
119: ; preds = %116, %112
%120 = phi i1 [ false, %112 ], [ %118, %116 ]
%121 = zext i1 %120 to i64
%122 = select i1 %120, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0)
%123 = load i8*, i8** %10
%124 = icmp ne i8* %123, null
br i1 %124, label %125, label %130
125: ; preds = %119
%126 = load i32, i32* %9
%127 = icmp ne i32 %126, 1
br i1 %127, label %128, label %130
128: ; preds = %125
%129 = load i8*, i8** %10
br label %131
130: ; preds = %125, %119
br label %131
131: ; preds = %130, %128
%132 = phi i8* [ %129, %128 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0), %130 ]
%133 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %113, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.12, i64 0, i64 0), i8* %122, i8* %132)
%134 = load i8*, i8** %13
%135 = load i32*, i32** %8
%136 = call i32 @html_puts(i8* %134, i32* %135)
%137 = load i32*, i32** %8
%138 = call i32 @fputs(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.13, i64 0, i64 0), i32* %137)
br label %139
139: ; preds = %131, %104
br label %140
140: ; preds = %139, %79
%141 = call i8* @xstrtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8** %14)
store i8* %141, i8** %13
br label %57
142: ; preds = %57
%143 = load i32*, i32** %8
%144 = call i32 @fputs(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0), i32* %143)
br label %35
145: ; preds = %35
%146 = load i32*, i32** %8
%147 = call i32 @fputs(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.15, i64 0, i64 0), i32* %146)
%148 = load i32*, i32** %11
%149 = call i32 @fclose(i32* %148)
br label %150
150: ; preds = %145, %21
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"r\00"
@.str.1 = [22 x i8] c"table_print_csv:fopen\00"
@.str.2 = [12 x i8] c"<table %s>\0A\00"
@.str.3 = [1 x i8] zeroinitializer
@.str.4 = [24 x i8] c"<tr bgcolor=\22#C0C0C0\22>\0A\00"
@.str.5 = [6 x i8] c"<tr>\0A\00"
@.str.6 = [3 x i8] c";\0A\00"
@.str.7 = [43 x i8] c"<th nowrap class=\22header\22 align=left %s%s>\00"
@.str.8 = [7 x i8] c"width=\00"
@.str.9 = [7 x i8] c"</th>\0A\00"
@.str.10 = [29 x i8] c"<th nowrap align=right %s%s>\00"
@.str.11 = [8 x i8] c":</td>\0A\00"
@.str.12 = [28 x i8] c"<td nowrap align=left %s%s>\00"
@.str.13 = [7 x i8] c"</td>\0A\00"
@.str.14 = [7 x i8] c"</tr>\0A\00"
@.str.15 = [10 x i8] c"</table>\0A\00"
define void @table_print_csv(i8* %0, i8* %1, i32* %2, i32 %3, i8* %4) {
%6 = alloca [16384 x i8]
%7 = alloca i8*
%8 = getelementptr inbounds [16384 x i8], [16384 x i8]* %6, i64 0, i64 0
%9 = bitcast i8** %7 to i8*
%10 = tail call i32* @fopen(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i32* %10, null
br i1 %11, label %12, label %14
12: ; preds = %5
%13 = tail call i32 @ssi_error(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.1, i64 0, i64 0), i8* %0, i32* %2)
br label %72
14: ; preds = %5
%15 = icmp eq i8* %1, null
%16 = select i1 %15, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0), i8* %1
%17 = tail call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %2, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i8* %16)
%18 = call i64 @fgets(i8* %8, i32 16384, i32* %10)
%19 = icmp eq i64 %18, 0
br i1 %19, label %69, label %20
20: ; preds = %14
%21 = icmp eq i32 %3, 0
%22 = icmp eq i32 %3, 1
%23 = icmp ne i8* %4, null
%24 = icmp ne i32 %3, 1
%25 = and i1 %24, %23
%26 = select i1 %25, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0)
%27 = select i1 %25, i8* %4, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0)
%28 = icmp eq i8* %4, null
%29 = select i1 %28, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.8, i64 0, i64 0)
%30 = select i1 %28, i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str.3, i64 0, i64 0), i8* %4
br label %31
31: ; preds = %20, %65
%32 = phi i32 [ 0, %20 ], [ %33, %65 ]
%33 = add nuw nsw i32 %32, 1
%34 = icmp eq i32 %32, 0
%35 = select i1 %21, i1 %34, i1 false
br i1 %35, label %36, label %38
36: ; preds = %31
%37 = call i64 @fwrite(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.4, i64 0, i64 0), i64 23, i64 1, i32* %2)
br label %40
38: ; preds = %31
%39 = call i64 @fwrite(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.5, i64 0, i64 0), i64 5, i64 1, i32* %2)
br label %40
40: ; preds = %38, %36
%41 = call i8* @xstrtok(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8** %7)
%42 = icmp eq i8* %41, null
br i1 %42, label %65, label %43
43: ; preds = %40, %62
%44 = phi i32 [ %46, %62 ], [ 0, %40 ]
%45 = phi i8* [ %63, %62 ], [ %41, %40 ]
%46 = add nuw nsw i32 %44, 1
br i1 %35, label %47, label %51
47: ; preds = %43
%48 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %2, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.7, i64 0, i64 0), i8* %29, i8* %30)
%49 = call i32 @html_puts(i8* %45, i32* %2)
%50 = call i64 @fwrite(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0), i64 6, i64 1, i32* %2)
br label %62
51: ; preds = %43
%52 = icmp eq i32 %44, 0
%53 = select i1 %22, i1 %52, i1 false
br i1 %53, label %54, label %58
54: ; preds = %51
%55 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %2, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.10, i64 0, i64 0), i8* %29, i8* %30)
%56 = call i32 @html_puts(i8* %45, i32* %2)
%57 = call i64 @fwrite(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.11, i64 0, i64 0), i64 7, i64 1, i32* %2)
br label %62
58: ; preds = %51
%59 = call i32 (i32*, i8*, i8*, ...) @fprintf(i32* %2, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.12, i64 0, i64 0), i8* %26, i8* %27)
%60 = call i32 @html_puts(i8* %45, i32* %2)
%61 = call i64 @fwrite(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.13, i64 0, i64 0), i64 6, i64 1, i32* %2)
br label %62
62: ; preds = %54, %58, %47
%63 = call i8* @xstrtok(i8* null, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i8** %7)
%64 = icmp eq i8* %63, null
br i1 %64, label %65, label %43
65: ; preds = %62, %40
%66 = call i64 @fwrite(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0), i64 6, i64 1, i32* %2)
%67 = call i64 @fgets(i8* %8, i32 16384, i32* %10)
%68 = icmp eq i64 %67, 0
br i1 %68, label %69, label %31
69: ; preds = %65, %14
%70 = call i64 @fwrite(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.15, i64 0, i64 0), i64 9, i64 1, i32* %2)
%71 = call i32 @fclose(i32* %10)
br label %72
72: ; preds = %69, %12
ret void
}