#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__ get_line(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ puts(char *);
int /*<<< orphan*/ stdin;
int main(int argc, char **argv) {
  char buffer[4096];
  char *style_sheet = {0};
  if (argc == 2)
    style_sheet = argv[1];
  printf("<html>\n");
  if (style_sheet) {
    printf("<link rel=stylesheet type=text/css href=%s>\n", style_sheet);
  }
  while (get_line(buffer, stdin))
    puts(buffer);
  printf("</html>\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1020,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x1018(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    116d <main+0x3d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x1018(%rbp)
lea    0xe8c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
cmpq   $0x0,-0x1018(%rbp)
je     119e <main+0x6e>
mov    -0x1018(%rbp),%rsi
lea    0xe71(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    11a3 <main+0x73>
lea    -0x1010(%rbp),%rdi
mov    0x2e37(%rip),%rax
mov    (%rax),%esi
call   1040 <get_line@plt>
cmp    $0x0,%rax
je     11d3 <main+0xa3>
lea    -0x1010(%rbp),%rdi
call   1030 <puts@plt>
jmp    11a3 <main+0x73>
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x1020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x1008,%rsp
cmp    $0x2,%edi
jne    1167 <main+0x37>
mov    0x8(%rsi),%rbx
lea    0xee3(%rip),%rdi
call   1030 <puts@plt>
test   %rbx,%rbx
je     1173 <main+0x43>
lea    0xea5(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1173 <main+0x43>
lea    0xebf(%rip),%rdi
call   1030 <puts@plt>
mov    0x2e6e(%rip),%r14
mov    (%r14),%esi
mov    %rsp,%rdi
call   1040 <get_line@plt>
test   %rax,%rax
je     11a8 <main+0x78>
mov    %rsp,%rbx
nopl   (%rax)
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    (%r14),%esi
mov    %rbx,%rdi
call   1040 <get_line@plt>
test   %rax,%rax
jne    1190 <main+0x60>
lea    0xe85(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x1008,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [8 x i8] c"<html>\0A\00"
@.str.1 = [45 x i8] c"<link rel=stylesheet type=text/css href=%s>\0A\00"
@stdin = global i32 0
@.str.2 = [9 x i8] c"</html>\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [4096 x i8]
%7 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %7
%8 = load i32, i32* %4
%9 = icmp eq i32 %8, 2
br i1 %9, label %10, label %14
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
store i8* %13, i8** %7
br label %14
14: ; preds = %10, %2
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%16 = load i8*, i8** %7
%17 = icmp ne i8* %16, null
br i1 %17, label %18, label %21
18: ; preds = %14
%19 = load i8*, i8** %7
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i8* %19)
br label %21
21: ; preds = %18, %14
br label %22
22: ; preds = %27, %21
%23 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%24 = load i32, i32* @stdin
%25 = call i64 @get_line(i8* %23, i32 %24)
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %30
27: ; preds = %22
%28 = getelementptr inbounds [4096 x i8], [4096 x i8]* %6, i64 0, i64 0
%29 = call i32 @puts(i8* %28)
br label %22
30: ; preds = %22
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [45 x i8] c"<link rel=stylesheet type=text/css href=%s>\0A\00"
@stdin = global i32 0
@str = [7 x i8] c"<html>\00"
@str.3 = [8 x i8] c"</html>\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [4096 x i8]
%4 = getelementptr inbounds [4096 x i8], [4096 x i8]* %3, i64 0, i64 0
%5 = icmp eq i32 %0, 2
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
br label %15
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%12 = icmp eq i8* %10, null
br i1 %12, label %15, label %13
13: ; preds = %8
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @.str.1, i64 0, i64 0), i8* %10)
br label %15
15: ; preds = %6, %13, %8
%16 = load i32, i32* @stdin
%17 = call i64 @get_line(i8* %4, i32 %16)
%18 = icmp eq i64 %17, 0
br i1 %18, label %24, label %19
19: ; preds = %15, %19
%20 = call i32 @puts(i8* %4)
%21 = load i32, i32* @stdin
%22 = call i64 @get_line(i8* %4, i32 %21)
%23 = icmp eq i64 %22, 0
br i1 %23, label %24, label %19
24: ; preds = %19, %15
%25 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.3, i64 0, i64 0))
ret i32 0
}