#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 */
typedef int /*<<< orphan*/ ibuf;

/* Variables and functions */
scalar_t__ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ putchar(char);
int /*<<< orphan*/ stdin;
main() {
  char ibuf[120], *p;
  int col, line = 0;
  while (fgets(ibuf, sizeof(ibuf), stdin)) {
    if (++line < 10)
      printf(" ");
    printf("@i{%d}  ", line);
    for (col = 0, p = ibuf; *p; p++, col++) {
      if (*p == '{' || *p == '}' || *p == '@')
        putchar('@');
      else if (*p == '\t') {
        *p = ' ';
        while (++col % 8)
          putchar(' ');
      }
      putchar(*p);
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x90(%rbp)
lea    -0x80(%rbp),%rdi
mov    0x2e91(%rip),%rax
mov    (%rax),%edx
mov    $0x78,%esi
call   1050 <fgets@plt>
cmp    $0x0,%rax
je     12a4 <main+0x174>
mov    -0x90(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x90(%rbp)
cmp    $0xa,%eax
jge    1193 <main+0x63>
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x90(%rbp),%esi
lea    0xe60(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x8c(%rbp)
lea    -0x80(%rbp),%rax
mov    %rax,-0x88(%rbp)
mov    -0x88(%rbp),%rax
cmpb   $0x0,(%rax)
je     129f <main+0x16f>
mov    -0x88(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x7b,%eax
je     1205 <main+0xd5>
mov    -0x88(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x7d,%eax
je     1205 <main+0xd5>
mov    -0x88(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x40,%eax
jne    1214 <main+0xe4>
mov    $0x40,%edi
call   1030 <putchar@plt>
jmp    126a <main+0x13a>
mov    -0x88(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x9,%eax
jne    1265 <main+0x135>
mov    -0x88(%rbp),%rax
movb   $0x20,(%rax)
mov    -0x8c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8c(%rbp)
mov    $0x8,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
je     1260 <main+0x130>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    1231 <main+0x101>
jmp    1265 <main+0x135>
jmp    126a <main+0x13a>
mov    -0x88(%rbp),%rax
movsbl (%rax),%edi
call   1030 <putchar@plt>
mov    -0x88(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x88(%rbp)
mov    -0x8c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8c(%rbp)
jmp    11bc <main+0x8c>
jmp    114c <main+0x1c>
mov    -0x4(%rbp),%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x78,%rsp
mov    0x2ea3(%rip),%rax
mov    (%rax),%edx
mov    %rsp,%r15
mov    %r15,%rdi
mov    $0x78,%esi
call   1050 <fgets@plt>
test   %rax,%rax
je     1235 <main+0x105>
xor    %r13d,%r13d
lea    0xe96(%rip),%r14
movabs $0x2800000000000001,%rbx
jmp    119f <main+0x6f>
cs nopw 0x0(%rax,%rax,1)
mov    0x2e61(%rip),%rax
mov    (%rax),%edx
mov    %r15,%rdi
mov    $0x78,%esi
call   1050 <fgets@plt>
test   %rax,%rax
je     1235 <main+0x105>
mov    %r13d,%eax
lea    0x1(%rax),%r13d
cmp    $0x8,%eax
ja     11b5 <main+0x85>
mov    $0x20,%edi
call   1030 <putchar@plt>
xor    %ebp,%ebp
mov    %r14,%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%r12
jmp    11f1 <main+0xc1>
nopl   0x0(%rax)
cmp    $0x9,%al
je     1212 <main+0xe2>
test   %al,%al
je     1180 <main+0x50>
nopl   0x0(%rax,%rax,1)
movsbl (%r12),%edi
call   1030 <putchar@plt>
add    $0x1,%r12
add    $0x1,%ebp
mov    (%r12),%al
lea    -0x40(%rax),%ecx
cmp    $0x3d,%cl
ja     11d0 <main+0xa0>
movzbl %cl,%ecx
bt     %rcx,%rbx
jae    11d0 <main+0xa0>
mov    $0x40,%edi
call   1030 <putchar@plt>
jmp    11e0 <main+0xb0>
movb   $0x20,(%r12)
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebp
test   $0x7,%bpl
je     11e0 <main+0xb0>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    1220 <main+0xf0>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32 0
@.str = [2 x i8] c" \00"
@.str.1 = [9 x i8] c"@i{%d} \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [120 x i8]
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %5
br label %6
6: ; preds = %67, %0
%7 = getelementptr inbounds [120 x i8], [120 x i8]* %2, i64 0, i64 0
%8 = load i32, i32* @stdin
%9 = call i64 @fgets(i8* %7, i32 120, i32 %8)
%10 = icmp ne i64 %9, 0
br i1 %10, label %11, label %68
11: ; preds = %6
%12 = load i32, i32* %5
%13 = add nsw i32 %12, 1
store i32 %13, i32* %5
%14 = icmp slt i32 %13, 10
br i1 %14, label %15, label %17
15: ; preds = %11
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %17
17: ; preds = %15, %11
%18 = load i32, i32* %5
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %18)
store i32 0, i32* %4
%20 = getelementptr inbounds [120 x i8], [120 x i8]* %2, i64 0, i64 0
store i8* %20, i8** %3
br label %21
21: ; preds = %62, %17
%22 = load i8*, i8** %3
%23 = load i8, i8* %22
%24 = icmp ne i8 %23, 0
br i1 %24, label %25, label %67
25: ; preds = %21
%26 = load i8*, i8** %3
%27 = load i8, i8* %26
%28 = sext i8 %27 to i32
%29 = icmp eq i32 %28, 123
br i1 %29, label %40, label %30
30: ; preds = %25
%31 = load i8*, i8** %3
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = icmp eq i32 %33, 125
br i1 %34, label %40, label %35
35: ; preds = %30
%36 = load i8*, i8** %3
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = icmp eq i32 %38, 64
br i1 %39, label %40, label %42
40: ; preds = %35, %30, %25
%41 = call i32 @putchar(i8 signext 64)
br label %58
42: ; preds = %35
%43 = load i8*, i8** %3
%44 = load i8, i8* %43
%45 = sext i8 %44 to i32
%46 = icmp eq i32 %45, 9
br i1 %46, label %47, label %57
47: ; preds = %42
%48 = load i8*, i8** %3
store i8 32, i8* %48
br label %49
49: ; preds = %54, %47
%50 = load i32, i32* %4
%51 = add nsw i32 %50, 1
store i32 %51, i32* %4
%52 = srem i32 %51, 8
%53 = icmp ne i32 %52, 0
br i1 %53, label %54, label %56
54: ; preds = %49
%55 = call i32 @putchar(i8 signext 32)
br label %49
56: ; preds = %49
br label %57
57: ; preds = %56, %42
br label %58
58: ; preds = %57, %40
%59 = load i8*, i8** %3
%60 = load i8, i8* %59
%61 = call i32 @putchar(i8 signext %60)
br label %62
62: ; preds = %58
%63 = load i8*, i8** %3
%64 = getelementptr inbounds i8, i8* %63, i32 1
store i8* %64, i8** %3
%65 = load i32, i32* %4
%66 = add nsw i32 %65, 1
store i32 %66, i32* %4
br label %21
67: ; preds = %21
br label %6
68: ; preds = %6
%69 = load i32, i32* %1
ret i32 %69
}

LLVM IR (-O2):
@stdin = global i32 0
@.str.1 = [9 x i8] c"@i{%d} \00"
define i32 @main() {
%1 = alloca [120 x i8]
%2 = getelementptr inbounds [120 x i8], [120 x i8]* %1, i64 0, i64 0
%3 = load i32, i32* @stdin
%4 = call i64 @fgets(i8* %2, i32 120, i32 %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %40, label %10
6: ; preds = %18
%7 = load i32, i32* @stdin
%8 = call i64 @fgets(i8* %2, i32 120, i32 %7)
%9 = icmp eq i64 %8, 0
br i1 %9, label %40, label %10
10: ; preds = %0, %6
%11 = phi i32 [ %12, %6 ], [ 0, %0 ]
%12 = add nuw nsw i32 %11, 1
%13 = icmp ult i32 %11, 9
br i1 %13, label %14, label %16
14: ; preds = %10
%15 = call i32 bitcast (i32 (i8)* @putchar to i32 (i32)*)(i32 32)
br label %16
16: ; preds = %14, %10
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32 %12)
br label %18
18: ; preds = %34, %16
%19 = phi i8* [ %2, %16 ], [ %38, %34 ]
%20 = phi i32 [ 0, %16 ], [ %39, %34 ]
%21 = load i8, i8* %19
switch i8 %21, label %34 [
i8 0, label %6
i8 123, label %22
i8 125, label %22
i8 64, label %22
i8 9, label %24
]
22: ; preds = %18, %18, %18
%23 = call i32 @putchar(i8 signext 64)
br label %34
24: ; preds = %18
store i8 32, i8* %19
%25 = add nsw i32 %20, 1
%26 = and i32 %25, 7
%27 = icmp eq i32 %26, 0
br i1 %27, label %34, label %28
28: ; preds = %24, %28
%29 = phi i32 [ %31, %28 ], [ %25, %24 ]
%30 = call i32 @putchar(i8 signext 32)
%31 = add i32 %29, 1
%32 = trunc i32 %31 to i3
%33 = icmp eq i3 %32, 0
br i1 %33, label %34, label %28
34: ; preds = %28, %24, %18, %22
%35 = phi i32 [ %20, %22 ], [ %20, %18 ], [ %25, %24 ], [ %31, %28 ]
%36 = load i8, i8* %19
%37 = call i32 @putchar(i8 signext %36)
%38 = getelementptr inbounds i8, i8* %19, i64 1
%39 = add nsw i32 %35, 1
br label %18
40: ; preds = %6, %0
ret i32 0
}