#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 */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
scalar_t__ get_line(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *, char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
scalar_t__ strcmp(char *, char *);
int main(int argc, char **argv) {
  char input_buffer[4096 + 1];
  int prepend = 0;
  int value = 0;
  int exit_usage = 0;
  if (argc < 3) {
    exit_usage = 1;
  }
  if (argc == 3 && strcmp(argv[2], "prepend") != 0) {
    exit_usage = 1;
  } else
    prepend = 1;
  if (exit_usage) {
    fprintf(stderr, "Usage: %s variable_name [prepend]\n", argv[0]);
    exit(1);
  }
  while (get_line(input_buffer, stdin)) {
    if (prepend) {
      printf("<TD><INPUT TYPE=\"radio\" NAME=\"%s\" VALUE=\"%d\"%s\n", argv[1],
             value++, input_buffer);
    } else {
      printf("%s<TD><INPUT TYPE=\"radio\" NAME=\"%s\" VALUE=\"%d\"\n",
             input_buffer, argv[1], value++);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1030,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x1024(%rbp)
movl   $0x0,-0x1028(%rbp)
movl   $0x0,-0x102c(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    119b <main+0x4b>
movl   $0x1,-0x102c(%rbp)
cmpl   $0x3,-0x8(%rbp)
jne    11d2 <main+0x82>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe4c(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     11d2 <main+0x82>
movl   $0x1,-0x102c(%rbp)
jmp    11dc <main+0x8c>
movl   $0x1,-0x1024(%rbp)
cmpl   $0x0,-0x102c(%rbp)
je     120f <main+0xbf>
mov    0x2de8(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe08(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>
jmp    1214 <main+0xc4>
lea    -0x1020(%rbp),%rdi
mov    0x2dc6(%rip),%rax
mov    (%rax),%esi
call   1030 <get_line@plt>
cmp    $0x0,%rax
je     12a8 <main+0x158>
cmpl   $0x0,-0x1024(%rbp)
je     1274 <main+0x124>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    -0x1028(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x1028(%rbp)
movslq %eax,%rdx
lea    -0x1020(%rbp),%rcx
lea    0xdc1(%rip),%rdi
call   1040 <printf@plt>
jmp    12a3 <main+0x153>
lea    -0x1020(%rbp),%rsi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
mov    -0x1028(%rbp),%eax
mov    %eax,%ecx
add    $0x1,%ecx
mov    %ecx,-0x1028(%rbp)
movslq %eax,%rcx
lea    0xdbd(%rip),%rdi
call   1040 <printf@plt>
jmp    1214 <main+0xc4>
xor    %eax,%eax
add    $0x1030,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x1010,%rsp
mov    %rsi,%r14
cmp    $0x3,%edi
jne    11ea <main+0x9a>
mov    %edi,%ebx
mov    0x10(%r14),%rdi
lea    0xe87(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x3,%ebx
jl     11ec <main+0x9c>
test   %rax,%rax
jne    11ec <main+0x9c>
mov    0x2e59(%rip),%r13
mov    0x0(%r13),%esi
mov    %rsp,%rdi
call   1030 <get_line@plt>
test   %rax,%rax
je     11d7 <main+0x87>
xor    %ebx,%ebx
lea    0xe82(%rip),%r15
mov    %rsp,%r12
nopl   0x0(%rax)
mov    0x8(%r14),%rsi
mov    %r15,%rdi
mov    %rbx,%rdx
mov    %r12,%rcx
call   1040 <printf@plt>
add    $0x1,%rbx
mov    0x0(%r13),%esi
mov    %r12,%rdi
call   1030 <get_line@plt>
test   %rax,%rax
jne    11b0 <main+0x60>
xor    %eax,%eax
add    $0x1010,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret
jge    1188 <main+0x38>
mov    0x2de5(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%rdx
lea    0xe09(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0x1,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@.str = [8 x i8] c"prepend\00"
@stderr = global i32 0
@.str.1 = [35 x i8] c"Usage: %s variable_name [prepend]\0A\00"
@stdin = global i32 0
@.str.2 = [48 x i8] c"<TD><INPUT TYPE=\22radio\22 NAME=\22%s\22 VALUE=\22%d\22%s\0A\00"
@.str.3 = [48 x i8] c"%s<TD><INPUT TYPE=\22radio\22 NAME=\22%s\22 VALUE=\22%d\22\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [4097 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %7
store i32 0, i32* %8
store i32 0, i32* %9
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 3
br i1 %11, label %12, label %13
12: ; preds = %2
store i32 1, i32* %9
br label %13
13: ; preds = %12, %2
%14 = load i32, i32* %4
%15 = icmp eq i32 %14, 3
br i1 %15, label %16, label %23
16: ; preds = %13
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 2
%19 = load i8*, i8** %18
%20 = call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %16
store i32 1, i32* %9
br label %24
23: ; preds = %16, %13
store i32 1, i32* %7
br label %24
24: ; preds = %23, %22
%25 = load i32, i32* %9
%26 = icmp ne i32 %25, 0
br i1 %26, label %27, label %34
27: ; preds = %24
%28 = load i32, i32* @stderr
%29 = load i8**, i8*** %5
%30 = getelementptr inbounds i8*, i8** %29, i64 0
%31 = load i8*, i8** %30
%32 = call i32 @fprintf(i32 %28, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* %31)
%33 = call i32 @exit(i32 1)
unreachable
34: ; preds = %24
br label %35
35: ; preds = %63, %34
%36 = getelementptr inbounds [4097 x i8], [4097 x i8]* %6, i64 0, i64 0
%37 = load i32, i32* @stdin
%38 = call i64 @get_line(i8* %36, i32 %37)
%39 = icmp ne i64 %38, 0
br i1 %39, label %40, label %64
40: ; preds = %35
%41 = load i32, i32* %7
%42 = icmp ne i32 %41, 0
br i1 %42, label %43, label %53
43: ; preds = %40
%44 = load i8**, i8*** %5
%45 = getelementptr inbounds i8*, i8** %44, i64 1
%46 = load i8*, i8** %45
%47 = load i32, i32* %8
%48 = add nsw i32 %47, 1
store i32 %48, i32* %8
%49 = sext i32 %47 to i64
%50 = inttoptr i64 %49 to i8*
%51 = getelementptr inbounds [4097 x i8], [4097 x i8]* %6, i64 0, i64 0
%52 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0), i8* %46, i8* %50, i8* %51)
br label %63
53: ; preds = %40
%54 = getelementptr inbounds [4097 x i8], [4097 x i8]* %6, i64 0, i64 0
%55 = load i8**, i8*** %5
%56 = getelementptr inbounds i8*, i8** %55, i64 1
%57 = load i8*, i8** %56
%58 = load i32, i32* %8
%59 = add nsw i32 %58, 1
store i32 %59, i32* %8
%60 = sext i32 %58 to i64
%61 = inttoptr i64 %60 to i8*
%62 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.3, i64 0, i64 0), i8* %54, i8* %57, i8* %61)
br label %63
63: ; preds = %53, %43
br label %35
64: ; preds = %35
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"prepend\00"
@stderr = global i32 0
@.str.1 = [35 x i8] c"Usage: %s variable_name [prepend]\0A\00"
@stdin = global i32 0
@.str.2 = [48 x i8] c"<TD><INPUT TYPE=\22radio\22 NAME=\22%s\22 VALUE=\22%d\22%s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [4097 x i8]
%4 = getelementptr inbounds [4097 x i8], [4097 x i8]* %3, i64 0, i64 0
%5 = icmp sgt i32 %0, 2
%6 = icmp eq i32 %0, 3
br i1 %6, label %7, label %19
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 2
%9 = load i8*, i8** %8
%10 = tail call i64 @strcmp(i8* %9, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
%11 = icmp eq i64 %10, 0
%12 = and i1 %5, %11
br i1 %12, label %13, label %20
13: ; preds = %19, %7
%14 = load i32, i32* @stdin
%15 = call i64 @get_line(i8* %4, i32 %14)
%16 = icmp eq i64 %15, 0
br i1 %16, label %34, label %17
17: ; preds = %13
%18 = getelementptr inbounds i8*, i8** %1, i64 1
br label %25
19: ; preds = %2
br i1 %5, label %13, label %20
20: ; preds = %7, %19
%21 = load i32, i32* @stderr
%22 = load i8*, i8** %1
%23 = tail call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.1, i64 0, i64 0), i8* %22)
%24 = tail call i32 @exit(i32 1)
unreachable
25: ; preds = %17, %25
%26 = phi i64 [ 0, %17 ], [ %30, %25 ]
%27 = load i8*, i8** %18
%28 = inttoptr i64 %26 to i8*
%29 = call i32 @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.2, i64 0, i64 0), i8* %27, i8* %28, i8* %4)
%30 = add nuw i64 %26, 1
%31 = load i32, i32* @stdin
%32 = call i64 @get_line(i8* %4, i32 %31)
%33 = icmp eq i64 %32, 0
br i1 %33, label %34, label %25
34: ; preds = %25, %13
ret i32 0
}