#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*/ OutStringFromChar(char, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void WriteOutputData(char *output, int cch, FILE *outfile, int baselevel) {
  char out[50];
  char *align;
  if (baselevel)
    align = "right";
  else
    align = "left";
  fprintf(outfile, "<table align = \"%s\">\n<tr>", align);
  for (int i = 0; i < cch; i++) {
    OutStringFromChar(output[i], out);
    fprintf(outfile, "<td>%s</td>", out);
  }
  fprintf(outfile, "\n</table><br><br>\n");
}


x86 assembly (clang, -O0):
<WriteOutputData>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
je     1150 <WriteOutputData+0x30>
lea    0xeb9(%rip),%rax
mov    %rax,-0x58(%rbp)
jmp    115b <WriteOutputData+0x3b>
lea    0xeaf(%rip),%rax
mov    %rax,-0x58(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x58(%rbp),%rdx
lea    0xea1(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
movl   $0x0,-0x5c(%rbp)
mov    -0x5c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11bf <WriteOutputData+0x9f>
mov    -0x8(%rbp),%rax
movslq -0x5c(%rbp),%rcx
mov    (%rax,%rcx,1),%al
lea    -0x50(%rbp),%rsi
movsbl %al,%edi
call   1040 <OutStringFromChar@plt>
mov    -0x18(%rbp),%rdi
lea    -0x50(%rbp),%rdx
lea    0xe7b(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
mov    -0x5c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x5c(%rbp)
jmp    1178 <WriteOutputData+0x58>
mov    -0x18(%rbp),%rdi
lea    0xe67(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<WriteOutputData>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x38,%rsp
mov    %rdx,%r14
mov    %esi,%ebx
mov    %rdi,%r15
test   %ecx,%ecx
lea    0xeb7(%rip),%rax
lea    0xeaa(%rip),%rdx
cmove  %rax,%rdx
lea    0xeaa(%rip),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1030 <fprintf@plt>
test   %ebx,%ebx
jle    11a6 <WriteOutputData+0x76>
mov    %ebx,%r13d
mov    %rsp,%rbx
lea    0xea9(%rip),%r12
xor    %ebp,%ebp
xchg   %ax,%ax
movsbl (%r15,%rbp,1),%edi
mov    %rbx,%rsi
call   1040 <OutStringFromChar@plt>
mov    %r14,%rdi
mov    %r12,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <fprintf@plt>
add    $0x1,%rbp
cmp    %rbp,%r13
jne    1180 <WriteOutputData+0x50>
lea    0xe84(%rip),%rdi
mov    $0x12,%esi
mov    $0x1,%edx
mov    %r14,%rcx
call   1050 <fwrite@plt>
add    $0x38,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"right\00"
@.str.1 = [5 x i8] c"left\00"
@.str.2 = [26 x i8] c"<table align = \22%s\22>\0A<tr>\00"
@.str.3 = [12 x i8] c"<td>%s</td>\00"
@.str.4 = [19 x i8] c"\0A</table><br><br>\0A\00"
define void @WriteOutputData(i8* %0, i32 %1, i32* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32
%9 = alloca [50 x i8]
%10 = alloca i8*
%11 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i32* %2, i32** %7
store i32 %3, i32* %8
%12 = load i32, i32* %8
%13 = icmp ne i32 %12, 0
br i1 %13, label %14, label %15
14: ; preds = %4
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8** %10
br label %16
15: ; preds = %4
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8** %10
br label %16
16: ; preds = %15, %14
%17 = load i32*, i32** %7
%18 = load i8*, i8** %10
%19 = call i32 (i32*, i8*, ...) @fprintf(i32* %17, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i8* %18)
store i32 0, i32* %11
br label %20
20: ; preds = %35, %16
%21 = load i32, i32* %11
%22 = load i32, i32* %6
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %38
24: ; preds = %20
%25 = load i8*, i8** %5
%26 = load i32, i32* %11
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %25, i64 %27
%29 = load i8, i8* %28
%30 = getelementptr inbounds [50 x i8], [50 x i8]* %9, i64 0, i64 0
%31 = call i32 @OutStringFromChar(i8 signext %29, i8* %30)
%32 = load i32*, i32** %7
%33 = getelementptr inbounds [50 x i8], [50 x i8]* %9, i64 0, i64 0
%34 = call i32 (i32*, i8*, ...) @fprintf(i32* %32, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* %33)
br label %35
35: ; preds = %24
%36 = load i32, i32* %11
%37 = add nsw i32 %36, 1
store i32 %37, i32* %11
br label %20
38: ; preds = %20
%39 = load i32*, i32** %7
%40 = call i32 (i32*, i8*, ...) @fprintf(i32* %39, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"right\00"
@.str.1 = [5 x i8] c"left\00"
@.str.2 = [26 x i8] c"<table align = \22%s\22>\0A<tr>\00"
@.str.3 = [12 x i8] c"<td>%s</td>\00"
@.str.4 = [19 x i8] c"\0A</table><br><br>\0A\00"
define void @WriteOutputData(i8* nocapture %0, i32 %1, i32* nocapture %2, i32 %3) {
%5 = alloca [50 x i8]
%6 = getelementptr inbounds [50 x i8], [50 x i8]* %5, i64 0, i64 0
%7 = icmp eq i32 %3, 0
%8 = select i1 %7, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
%9 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %2, i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i8* %8)
%10 = icmp sgt i32 %1, 0
br i1 %10, label %11, label %13
11: ; preds = %4
%12 = zext i32 %1 to i64
br label %15
13: ; preds = %15, %4
%14 = call i64 @fwrite(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.4, i64 0, i64 0), i64 18, i64 1, i32* %2)
ret void
15: ; preds = %11, %15
%16 = phi i64 [ 0, %11 ], [ %21, %15 ]
%17 = getelementptr inbounds i8, i8* %0, i64 %16
%18 = load i8, i8* %17
%19 = call i32 @OutStringFromChar(i8 signext %18, i8* %6)
%20 = call i32 (i32*, i8*, ...) @fprintf(i32* %2, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0), i8* %6)
%21 = add nuw nsw i64 %16, 1
%22 = icmp eq i64 %21, %12
br i1 %22, label %13, label %15
}