#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 */
unsigned int atoi(char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ stdin;
scalar_t__ timlib_get_line(char *, int /*<<< orphan*/, int);
int main(int argc, char **argv) {
  unsigned count_up_to;
  unsigned count;
  char one_line_yn = 'n';
  char input_buffer[1024];
  if (argc < 2) {
    fprintf(stderr, "Usage: %s count_up_to [one_line_yn]\n", argv[0]);
    return 1;
  }
  count_up_to = atoi(argv[1]);
  if (argc == 3)
    one_line_yn = *argv[2];
  if (!count_up_to) {
    count = 0;
    while (timlib_get_line(input_buffer, stdin, 1024)) {
      printf("%s_%d\n", input_buffer, ++count);
    }
  } else {
    for (count = 1; count <= count_up_to; count++) {
      if (one_line_yn == 'y') {
        if (count != 1)
          printf(",");
        printf("%d", count);
      } else {
        printf("%d\n", count);
      }
    }
  }
  if (one_line_yn == 'y')
    printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movb   $0x6e,-0x19(%rbp)
cmpl   $0x2,-0x8(%rbp)
jge    118f <main+0x4f>
mov    0x2e6a(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe82(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    12ac <main+0x16c>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x3,-0x8(%rbp)
jne    11b6 <main+0x76>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rax
mov    (%rax),%al
mov    %al,-0x19(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    1213 <main+0xd3>
movl   $0x0,-0x18(%rbp)
lea    -0x420(%rbp),%rdi
mov    0x2e13(%rip),%rax
mov    (%rax),%esi
mov    $0x400,%edx
call   1060 <timlib_get_line@plt>
cmp    $0x0,%rax
je     120e <main+0xce>
lea    -0x420(%rbp),%rsi
mov    -0x18(%rbp),%edx
add    $0x1,%edx
mov    %edx,-0x18(%rbp)
lea    0xe23(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11c7 <main+0x87>
jmp    128a <main+0x14a>
movl   $0x1,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
ja     1285 <main+0x145>
movsbl -0x19(%rbp),%eax
cmp    $0x79,%eax
jne    1261 <main+0x121>
cmpl   $0x1,-0x18(%rbp)
je     124b <main+0x10b>
lea    0xde8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%esi
lea    0xdd9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1272 <main+0x132>
mov    -0x18(%rbp),%esi
lea    0xdbd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1277 <main+0x137>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    121a <main+0xda>
jmp    128a <main+0x14a>
movsbl -0x19(%rbp),%eax
cmp    $0x79,%eax
jne    12a5 <main+0x165>
lea    0xd85(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x400,%rsp
mov    %rsi,%r14
cmp    $0x1,%edi
jg     1189 <main+0x39>
mov    0x2e6a(%rip),%rax
mov    (%rax),%edi
mov    (%r14),%rdx
lea    0xe86(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%ebx
jmp    126a <main+0x11a>
mov    %edi,%ebp
mov    0x8(%r14),%rdi
call   1060 <atoi@plt>
mov    %eax,%ebx
mov    $0x6e,%r15d
cmp    $0x3,%ebp
jne    11a9 <main+0x59>
mov    0x10(%r14),%rax
movsbl (%rax),%r15d
test   %ebx,%ebx
je     1200 <main+0xb0>
mov    $0x1,%ebp
lea    0xe6f(%rip),%r14
lea    0xe6c(%rip),%r12
jmp    11e0 <main+0x90>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%ebp
cmp    %ebx,%ebp
ja     1258 <main+0x108>
mov    %r14,%rdi
cmp    $0x79,%r15d
jne    11d0 <main+0x80>
mov    %r12,%rdi
cmp    $0x1,%ebp
je     11d0 <main+0x80>
mov    $0x2c,%edi
call   1030 <putchar@plt>
mov    %r12,%rdi
jmp    11d0 <main+0x80>
mov    0x2de1(%rip),%r12
mov    (%r12),%esi
mov    %rsp,%rdi
mov    $0x400,%edx
call   1070 <timlib_get_line@plt>
test   %rax,%rax
je     1258 <main+0x108>
mov    $0x1,%ebx
lea    0xdfc(%rip),%r14
mov    %rsp,%rbp
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %rbp,%rsi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%r12),%esi
mov    %rbp,%rdi
mov    $0x400,%edx
call   1070 <timlib_get_line@plt>
add    $0x1,%ebx
test   %rax,%rax
jne    1230 <main+0xe0>
xor    %ebx,%ebx
cmp    $0x79,%r15d
jne    126a <main+0x11a>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    %ebx,%eax
add    $0x400,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [37 x i8] c"Usage: %s count_up_to [one_line_yn]\0A\00"
@stdin = global i32 0
@.str.1 = [7 x i8] c"%s_%d\0A\00"
@.str.2 = [2 x i8] c",\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [4 x i8] c"%d\0A\00"
@.str.5 = [2 x i8] c"\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8
%9 = alloca [1024 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8 110, i8* %8
%10 = load i32, i32* %4
%11 = icmp slt i32 %10, 2
br i1 %11, label %12, label %18
12: ; preds = %2
%13 = load i32, i32* @stderr
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 0
%16 = load i8*, i8** %15
%17 = call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %16)
store i32 1, i32* %3
br label %77
18: ; preds = %2
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = call i32 @atoi(i8* %21)
store i32 %22, i32* %6
%23 = load i32, i32* %4
%24 = icmp eq i32 %23, 3
br i1 %24, label %25, label %30
25: ; preds = %18
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 2
%28 = load i8*, i8** %27
%29 = load i8, i8* %28
store i8 %29, i8* %8
br label %30
30: ; preds = %25, %18
%31 = load i32, i32* %6
%32 = icmp ne i32 %31, 0
br i1 %32, label %45, label %33
33: ; preds = %30
store i32 0, i32* %7
br label %34
34: ; preds = %39, %33
%35 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%36 = load i32, i32* @stdin
%37 = call i64 @timlib_get_line(i8* %35, i32 %36, i32 1024)
%38 = icmp ne i64 %37, 0
br i1 %38, label %39, label %44
39: ; preds = %34
%40 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%41 = load i32, i32* %7
%42 = add i32 %41, 1
store i32 %42, i32* %7
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %40, i32 %42)
br label %34
44: ; preds = %34
br label %70
45: ; preds = %30
store i32 1, i32* %7
br label %46
46: ; preds = %66, %45
%47 = load i32, i32* %7
%48 = load i32, i32* %6
%49 = icmp ule i32 %47, %48
br i1 %49, label %50, label %69
50: ; preds = %46
%51 = load i8, i8* %8
%52 = sext i8 %51 to i32
%53 = icmp eq i32 %52, 121
br i1 %53, label %54, label %62
54: ; preds = %50
%55 = load i32, i32* %7
%56 = icmp ne i32 %55, 1
br i1 %56, label %57, label %59
57: ; preds = %54
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %59
59: ; preds = %57, %54
%60 = load i32, i32* %7
%61 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i32 %60)
br label %65
62: ; preds = %50
%63 = load i32, i32* %7
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i32 %63)
br label %65
65: ; preds = %62, %59
br label %66
66: ; preds = %65
%67 = load i32, i32* %7
%68 = add i32 %67, 1
store i32 %68, i32* %7
br label %46
69: ; preds = %46
br label %70
70: ; preds = %69, %44
%71 = load i8, i8* %8
%72 = sext i8 %71 to i32
%73 = icmp eq i32 %72, 121
br i1 %73, label %74, label %76
74: ; preds = %70
%75 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.5, i64 0, i64 0))
br label %76
76: ; preds = %74, %70
store i32 0, i32* %3
br label %77
77: ; preds = %76, %12
%78 = load i32, i32* %3
ret i32 %78
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [37 x i8] c"Usage: %s count_up_to [one_line_yn]\0A\00"
@stdin = global i32 0
@.str.1 = [7 x i8] c"%s_%d\0A\00"
@.str.3 = [3 x i8] c"%d\00"
@.str.4 = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = icmp slt i32 %0, 2
br i1 %5, label %6, label %10
6: ; preds = %2
%7 = load i32, i32* @stderr
%8 = load i8*, i8** %1
%9 = tail call i32 @fprintf(i32 %7, i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0), i8* %8)
br label %51
10: ; preds = %2
%11 = getelementptr inbounds i8*, i8** %1, i64 1
%12 = load i8*, i8** %11
%13 = tail call i32 @atoi(i8* %12)
%14 = icmp eq i32 %0, 3
br i1 %14, label %15, label %20
15: ; preds = %10
%16 = getelementptr inbounds i8*, i8** %1, i64 2
%17 = load i8*, i8** %16
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
br label %20
20: ; preds = %15, %10
%21 = phi i32 [ %19, %15 ], [ 110, %10 ]
%22 = icmp eq i32 %13, 0
br i1 %22, label %25, label %23
23: ; preds = %20
%24 = icmp eq i32 %21, 121
br label %36
25: ; preds = %20
%26 = load i32, i32* @stdin
%27 = call i64 @timlib_get_line(i8* %4, i32 %26, i32 1024)
%28 = icmp eq i64 %27, 0
br i1 %28, label %47, label %29
29: ; preds = %25, %29
%30 = phi i32 [ %31, %29 ], [ 0, %25 ]
%31 = add i32 %30, 1
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i8* %4, i32 %31)
%33 = load i32, i32* @stdin
%34 = call i64 @timlib_get_line(i8* %4, i32 %33, i32 1024)
%35 = icmp eq i64 %34, 0
br i1 %35, label %47, label %29
36: ; preds = %23, %42
%37 = phi i32 [ 1, %23 ], [ %45, %42 ]
br i1 %24, label %38, label %42
38: ; preds = %36
%39 = icmp eq i32 %37, 1
br i1 %39, label %42, label %40
40: ; preds = %38
%41 = tail call i32 @putchar(i32 44)
br label %42
42: ; preds = %36, %38, %40
%43 = phi i8* [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), %40 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), %38 ], [ getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), %36 ]
%44 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %43, i32 %37)
%45 = add i32 %37, 1
%46 = icmp ugt i32 %45, %13
br i1 %46, label %47, label %36
47: ; preds = %42, %29, %25
%48 = icmp eq i32 %21, 121
br i1 %48, label %49, label %51
49: ; preds = %47
%50 = call i32 @putchar(i32 10)
br label %51
51: ; preds = %47, %49, %6
%52 = phi i32 [ 1, %6 ], [ 0, %49 ], [ 0, %47 ]
ret i32 %52
}