#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 *);
int html_horzrule(char *align, int noshade, int size, int width, int percent) {
  int l = html_string("%s", "<HR") + html_string(" ALIGN=\"%s\"", align);
  if (noshade)
    l += html_string("%s", " NOSHADE");
  if (size)
    l += html_int(" SIZE=\"%d\" ", size);
  if (width) {
    l += html_int((percent ? " WIDTH=\"%d\"" : " WIDTH=\"%d%%\""), size);
  }
  l += html_string("%s\n", ">");
  return l;
}


x86 assembly (clang, -O0):
<html_horzrule>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
lea    0xec0(%rip),%rdi
lea    0xebc(%rip),%rsi
call   1030 <html_string@plt>
mov    %eax,-0x20(%rbp)
mov    -0x8(%rbp),%rsi
lea    0xead(%rip),%rdi
call   1030 <html_string@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     118c <html_horzrule+0x6c>
lea    0xe86(%rip),%rdi
lea    0xe92(%rip),%rsi
call   1030 <html_string@plt>
add    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x10(%rbp)
je     11b2 <html_horzrule+0x92>
mov    -0x10(%rbp),%esi
lea    0xe7c(%rip),%rdi
call   1040 <html_int@plt>
mov    %rax,%rcx
movslq -0x1c(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     11e9 <html_horzrule+0xc9>
mov    -0x18(%rbp),%ecx
lea    0xe6e(%rip),%rdi
lea    0xe5b(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdi
mov    -0x10(%rbp),%esi
call   1040 <html_int@plt>
mov    %rax,%rcx
movslq -0x1c(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x1c(%rbp)
lea    0xe52(%rip),%rdi
lea    0xe4f(%rip),%rsi
call   1030 <html_string@plt>
add    -0x1c(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<html_horzrule>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8d,%r14d
mov    %ecx,%r15d
mov    %edx,%r12d
mov    %esi,%r13d
mov    %rdi,%rbx
lea    0xebf(%rip),%rdi
lea    0xebb(%rip),%rsi
call   1030 <html_string@plt>
mov    %eax,%ebp
lea    0xeb1(%rip),%rdi
mov    %rbx,%rsi
call   1030 <html_string@plt>
mov    %eax,%ebx
add    %ebp,%ebx
test   %r13d,%r13d
je     117c <html_horzrule+0x5c>
lea    0xe92(%rip),%rdi
lea    0xe9e(%rip),%rsi
call   1030 <html_string@plt>
add    %eax,%ebx
test   %r12d,%r12d
je     1192 <html_horzrule+0x72>
lea    0xe94(%rip),%rdi
mov    %r12d,%esi
call   1040 <html_int@plt>
add    %eax,%ebx
test   %r15d,%r15d
je     11b6 <html_horzrule+0x96>
test   %r14d,%r14d
lea    0xe93(%rip),%rax
lea    0xe80(%rip),%rdi
cmove  %rax,%rdi
mov    %r12d,%esi
call   1040 <html_int@plt>
add    %eax,%ebx
lea    0xe85(%rip),%rdi
lea    0xe82(%rip),%rsi
call   1030 <html_string@plt>
add    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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