#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 */
scalar_t__ html_int(char *, int);
int html_string(char *, char *);
scalar_t__ html_tablealign(int);
int html_tablecontents(char *content, int align, int colspan, int rowspan,
                       int nowrap, char *text) {
  int l = html_string("<%s", content);
  l += html_tablealign(align);
  if (colspan)
    l += html_int(" COLSPAN=\"%d\"", colspan);
  if (rowspan)
    l += html_int(" ROWSPAN=\"%d\"", rowspan);
  if (nowrap)
    l += html_string(" %s", "NOWRAP");
  l += html_string(">%s", text);
  l += html_string("</%s>\n", content);
  return l;
}


x86 assembly (clang, -O0):
<html_tablecontents>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xea8(%rip),%rdi
call   1030 <html_string@plt>
mov    %eax,-0x24(%rbp)
mov    -0xc(%rbp),%edi
call   1050 <html_tablealign@plt>
mov    %rax,%rcx
movslq -0x24(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     119b <html_tablecontents+0x6b>
mov    -0x10(%rbp),%esi
lea    0xe7b(%rip),%rdi
call   1040 <html_int@plt>
mov    %rax,%rcx
movslq -0x24(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     11c1 <html_tablecontents+0x91>
mov    -0x14(%rbp),%esi
lea    0xe63(%rip),%rdi
call   1040 <html_int@plt>
mov    %rax,%rcx
movslq -0x24(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x24(%rbp)
cmpl   $0x0,-0x18(%rbp)
je     11e4 <html_tablecontents+0xb4>
lea    0xe4e(%rip),%rdi
lea    0xe4b(%rip),%rsi
call   1030 <html_string@plt>
add    -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%rsi
lea    0xe3c(%rip),%rdi
call   1030 <html_string@plt>
add    -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xe2a(%rip),%rdi
call   1030 <html_string@plt>
add    -0x24(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<html_tablecontents>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,(%rsp)
mov    %r8d,%r12d
mov    %ecx,%r13d
mov    %edx,%ebp
mov    %esi,%ebx
mov    %rdi,%r15
lea    0xead(%rip),%rdi
mov    %r15,%rsi
call   1030 <html_string@plt>
mov    %eax,%r14d
mov    %ebx,%edi
call   1050 <html_tablealign@plt>
mov    %rax,%rbx
add    %r14d,%ebx
test   %ebp,%ebp
je     117f <html_tablecontents+0x4f>
lea    0xe8e(%rip),%rdi
mov    %ebp,%esi
call   1040 <html_int@plt>
add    %eax,%ebx
test   %r13d,%r13d
je     1195 <html_tablecontents+0x65>
lea    0xe87(%rip),%rdi
mov    %r13d,%esi
call   1040 <html_int@plt>
add    %eax,%ebx
test   %r12d,%r12d
je     11b1 <html_tablecontents+0x81>
lea    0xe7f(%rip),%rdi
lea    0xe7c(%rip),%rsi
call   1030 <html_string@plt>
add    %ebx,%eax
mov    %eax,%ebx
lea    0xe73(%rip),%rdi
mov    (%rsp),%rsi
call   1030 <html_string@plt>
mov    %eax,%ebp
add    %ebx,%ebp
lea    0xe63(%rip),%rdi
mov    %r15,%rsi
call   1030 <html_string@plt>
add    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"<%s\00"
@.str.1 = [14 x i8] c" COLSPAN=\22%d\22\00"
@.str.2 = [14 x i8] c" ROWSPAN=\22%d\22\00"
@.str.3 = [4 x i8] c" %s\00"
@.str.4 = [7 x i8] c"NOWRAP\00"
@.str.5 = [4 x i8] c">%s\00"
@.str.6 = [7 x i8] c"</%s>\0A\00"
define i32 @html_tablecontents(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4, i8* %5) {
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i32
store i8* %0, i8** %7
store i32 %1, i32* %8
store i32 %2, i32* %9
store i32 %3, i32* %10
store i32 %4, i32* %11
store i8* %5, i8** %12
%14 = load i8*, i8** %7
%15 = call i32 @html_string(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %14)
store i32 %15, i32* %13
%16 = load i32, i32* %8
%17 = call i64 @html_tablealign(i32 %16)
%18 = load i32, i32* %13
%19 = sext i32 %18 to i64
%20 = add nsw i64 %19, %17
%21 = trunc i64 %20 to i32
store i32 %21, i32* %13
%22 = load i32, i32* %9
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %31
24: ; preds = %6
%25 = load i32, i32* %9
%26 = call i64 @html_int(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %25)
%27 = load i32, i32* %13
%28 = sext i32 %27 to i64
%29 = add nsw i64 %28, %26
%30 = trunc i64 %29 to i32
store i32 %30, i32* %13
br label %31
31: ; preds = %24, %6
%32 = load i32, i32* %10
%33 = icmp ne i32 %32, 0
br i1 %33, label %34, label %41
34: ; preds = %31
%35 = load i32, i32* %10
%36 = call i64 @html_int(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %35)
%37 = load i32, i32* %13
%38 = sext i32 %37 to i64
%39 = add nsw i64 %38, %36
%40 = trunc i64 %39 to i32
store i32 %40, i32* %13
br label %41
41: ; preds = %34, %31
%42 = load i32, i32* %11
%43 = icmp ne i32 %42, 0
br i1 %43, label %44, label %48
44: ; preds = %41
%45 = call i32 @html_string(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%46 = load i32, i32* %13
%47 = add nsw i32 %46, %45
store i32 %47, i32* %13
br label %48
48: ; preds = %44, %41
%49 = load i8*, i8** %12
%50 = call i32 @html_string(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %49)
%51 = load i32, i32* %13
%52 = add nsw i32 %51, %50
store i32 %52, i32* %13
%53 = load i8*, i8** %7
%54 = call i32 @html_string(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* %53)
%55 = load i32, i32* %13
%56 = add nsw i32 %55, %54
store i32 %56, i32* %13
%57 = load i32, i32* %13
ret i32 %57
}

LLVM IR (-O2):
@.str = [4 x i8] c"<%s\00"
@.str.1 = [14 x i8] c" COLSPAN=\22%d\22\00"
@.str.2 = [14 x i8] c" ROWSPAN=\22%d\22\00"
@.str.3 = [4 x i8] c" %s\00"
@.str.4 = [7 x i8] c"NOWRAP\00"
@.str.5 = [4 x i8] c">%s\00"
@.str.6 = [7 x i8] c"</%s>\0A\00"
define i32 @html_tablecontents(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4, i8* %5) {
%7 = tail call i32 @html_string(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %0)
%8 = tail call i64 @html_tablealign(i32 %1)
%9 = trunc i64 %8 to i32
%10 = add i32 %7, %9
%11 = icmp eq i32 %2, 0
br i1 %11, label %16, label %12
12: ; preds = %6
%13 = tail call i64 @html_int(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %2)
%14 = trunc i64 %13 to i32
%15 = add i32 %10, %14
br label %16
16: ; preds = %12, %6
%17 = phi i32 [ %15, %12 ], [ %10, %6 ]
%18 = icmp eq i32 %3, 0
br i1 %18, label %23, label %19
19: ; preds = %16
%20 = tail call i64 @html_int(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %3)
%21 = trunc i64 %20 to i32
%22 = add i32 %17, %21
br label %23
23: ; preds = %19, %16
%24 = phi i32 [ %22, %19 ], [ %17, %16 ]
%25 = icmp eq i32 %4, 0
br i1 %25, label %29, label %26
26: ; preds = %23
%27 = tail call i32 @html_string(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%28 = add nsw i32 %27, %24
br label %29
29: ; preds = %26, %23
%30 = phi i32 [ %28, %26 ], [ %24, %23 ]
%31 = tail call i32 @html_string(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.5, i64 0, i64 0), i8* %5)
%32 = add nsw i32 %31, %30
%33 = tail call i32 @html_string(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.6, i64 0, i64 0), i8* %0)
%34 = add nsw i32 %32, %33
ret i32 %34
}