#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*/);
char *next_alpha(char *);
int /*<<< orphan*/ printf(char *, char *, char *);
int /*<<< orphan*/ stdin;
int main(void) {
  char buffer[4096];
  char *alpha = "A";
  while (get_line(buffer, stdin)) {
    printf("%2.2s) %s\n", alpha, buffer);
    alpha = next_alpha(alpha);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1020,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeb7(%rip),%rax
mov    %rax,-0x1018(%rbp)
lea    -0x1010(%rbp),%rdi
mov    0x2e8a(%rip),%rax
mov    (%rax),%esi
call   1040 <get_line@plt>
cmp    $0x0,%rax
je     11a1 <main+0x71>
mov    -0x1018(%rbp),%rsi
lea    -0x1010(%rbp),%rdx
lea    0xe7e(%rip),%rdi
call   1050 <printf@plt>
mov    -0x1018(%rbp),%rdi
call   1030 <next_alpha@plt>
mov    %rax,-0x1018(%rbp)
jmp    1150 <main+0x20>
xor    %eax,%eax
add    $0x1020,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x1008,%rsp
mov    0x2ea3(%rip),%r12
mov    (%r12),%esi
mov    %rsp,%rdi
call   1040 <get_line@plt>
test   %rax,%rax
je     119a <main+0x6a>
lea    0xea3(%rip),%rbx
lea    0xe9e(%rip),%r14
mov    %rsp,%r15
nopw   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1030 <next_alpha@plt>
mov    %rax,%rbx
mov    (%r12),%esi
mov    %r15,%rdi
call   1040 <get_line@plt>
test   %rax,%rax
jne    1170 <main+0x40>
xor    %eax,%eax
add    $0x1008,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c"A\00"
@stdin = global i32 0
@.str.1 = [11 x i8] c"%2.2s) %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4096 x i8]
%3 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %3
br label %4
4: ; preds = %9, %0
%5 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 0
%6 = load i32, i32* @stdin
%7 = call i64 @get_line(i8* %5, i32 %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %15
9: ; preds = %4
%10 = load i8*, i8** %3
%11 = getelementptr inbounds [4096 x i8], [4096 x i8]* %2, i64 0, i64 0
%12 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %10, i8* %11)
%13 = load i8*, i8** %3
%14 = call i8* @next_alpha(i8* %13)
store i8* %14, i8** %3
br label %4
15: ; preds = %4
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"A\00"
@stdin = global i32 0
@.str.1 = [11 x i8] c"%2.2s) %s\0A\00"
define i32 @main() {
%1 = alloca [4096 x i8]
%2 = getelementptr inbounds [4096 x i8], [4096 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @stdin
%4 = call i64 @get_line(i8* %2, i32 %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %13, label %6
6: ; preds = %0, %6
%7 = phi i8* [ %9, %6 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), %0 ]
%8 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0), i8* %7, i8* %2)
%9 = call i8* @next_alpha(i8* %7)
%10 = load i32, i32* @stdin
%11 = call i64 @get_line(i8* %2, i32 %10)
%12 = icmp eq i64 %11, 0
br i1 %12, label %13, label %6
13: ; preds = %6, %0
ret i32 0
}