#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 EOF;
int EXIT_SUCCESS;
int getchar();
int /*<<< orphan*/ putchar(int);
int main(int argc, char **argv) {
  int c, line_size, space_num, i;
  line_size = space_num = 0;
  while ((c = getchar()) != EOF) {
    ++line_size;
    if (c == '\n') {
      line_size = 0;
      putchar('\n');
    } else if (c == '\t') {
      space_num = 9 - (line_size % 9);
      for (i = 0; i < space_num; i++)
        putchar(' ');
      line_size += space_num;
    } else {
      putchar(c);
    }
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x0,-0x18(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x14(%rbp)
mov    0x2e93(%rip),%rcx
cmp    (%rcx),%eax
je     11f0 <main+0xd0>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
cmpl   $0xa,-0x14(%rbp)
jne    1186 <main+0x66>
movl   $0x0,-0x18(%rbp)
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    11eb <main+0xcb>
cmpl   $0x9,-0x14(%rbp)
jne    11de <main+0xbe>
mov    -0x18(%rbp),%eax
mov    $0x9,%ecx
cltd
idiv   %ecx
mov    $0x9,%eax
sub    %edx,%eax
mov    %eax,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x1c(%rbp),%eax
jge    11d0 <main+0xb0>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11ac <main+0x8c>
mov    -0x1c(%rbp),%eax
add    -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    11e6 <main+0xc6>
mov    -0x14(%rbp),%edi
call   1030 <putchar@plt>
jmp    11eb <main+0xcb>
jmp    1144 <main+0x24>
mov    0x2de1(%rip),%rax
mov    (%rax),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb3(%rip),%r14
cmp    (%r14),%eax
jne    114e <main+0x2e>
mov    0x2e97(%rip),%rax
mov    (%rax),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %ebp,%ebp
jmp    1173 <main+0x53>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %eax,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%r14),%eax
je     113a <main+0x1a>
add    $0x1,%ebp
cmp    $0x9,%eax
je     1190 <main+0x70>
cmp    $0xa,%eax
jne    1160 <main+0x40>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %ebp,%ebp
jmp    1167 <main+0x47>
xchg   %ax,%ax
movslq %ebp,%rax
imul   $0x38e38e39,%rax,%rcx
mov    %rcx,%rdx
shr    $0x3f,%rdx
sar    $0x21,%rcx
add    %edx,%ecx
lea    (%rcx,%rcx,8),%ecx
mov    %eax,%edx
sub    %ecx,%edx
mov    $0x9,%r15d
sub    %edx,%r15d
neg    %ecx
lea    (%rax,%rcx,1),%ebx
add    $0xfffffff7,%ebx
nop
mov    $0x20,%edi
call   1030 <putchar@plt>
inc    %ebx
jne    11c0 <main+0xa0>
add    %r15d,%ebp
jmp    1167 <main+0x47>

LLVM IR (-O0):
@EOF = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%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* %8
store i32 0, i32* %7
br label %10
10: ; preds = %45, %2
%11 = call i32 (...) @getchar()
store i32 %11, i32* %6
%12 = load i32, i32* @EOF
%13 = icmp ne i32 %11, %12
br i1 %13, label %14, label %46
14: ; preds = %10
%15 = load i32, i32* %7
%16 = add nsw i32 %15, 1
store i32 %16, i32* %7
%17 = load i32, i32* %6
%18 = icmp eq i32 %17, 10
br i1 %18, label %19, label %21
19: ; preds = %14
store i32 0, i32* %7
%20 = call i32 @putchar(i32 10)
br label %45
21: ; preds = %14
%22 = load i32, i32* %6
%23 = icmp eq i32 %22, 9
br i1 %23, label %24, label %41
24: ; preds = %21
%25 = load i32, i32* %7
%26 = srem i32 %25, 9
%27 = sub nsw i32 9, %26
store i32 %27, i32* %8
store i32 0, i32* %9
br label %28
28: ; preds = %34, %24
%29 = load i32, i32* %9
%30 = load i32, i32* %8
%31 = icmp slt i32 %29, %30
br i1 %31, label %32, label %37
32: ; preds = %28
%33 = call i32 @putchar(i32 32)
br label %34
34: ; preds = %32
%35 = load i32, i32* %9
%36 = add nsw i32 %35, 1
store i32 %36, i32* %9
br label %28
37: ; preds = %28
%38 = load i32, i32* %8
%39 = load i32, i32* %7
%40 = add nsw i32 %39, %38
store i32 %40, i32* %7
br label %44
41: ; preds = %21
%42 = load i32, i32* %6
%43 = call i32 @putchar(i32 %42)
br label %44
44: ; preds = %41, %37
br label %45
45: ; preds = %44, %19
br label %10
46: ; preds = %10
%47 = load i32, i32* @EXIT_SUCCESS
ret i32 %47
}

LLVM IR (-O2):
@EOF = global i32 0
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @getchar()
%4 = load i32, i32* @EOF
%5 = icmp eq i32 %3, %4
br i1 %5, label %29, label %6
6: ; preds = %2, %24
%7 = phi i32 [ %26, %24 ], [ %3, %2 ]
%8 = phi i32 [ %25, %24 ], [ 0, %2 ]
%9 = add nsw i32 %8, 1
switch i32 %7, label %22 [
i32 10, label %10
i32 9, label %12
]
10: ; preds = %6
%11 = tail call i32 @putchar(i32 10)
br label %24
12: ; preds = %6
%13 = srem i32 %9, 9
%14 = sub nsw i32 9, %13
br label %15
15: ; preds = %12, %15
%16 = phi i32 [ %18, %15 ], [ 0, %12 ]
%17 = tail call i32 @putchar(i32 32)
%18 = add nuw nsw i32 %16, 1
%19 = icmp eq i32 %18, %14
br i1 %19, label %20, label %15
20: ; preds = %15
%21 = add nsw i32 %14, %9
br label %24
22: ; preds = %6
%23 = tail call i32 @putchar(i32 %7)
br label %24
24: ; preds = %20, %22, %10
%25 = phi i32 [ 0, %10 ], [ %21, %20 ], [ %9, %22 ]
%26 = tail call i32 (...) @getchar()
%27 = load i32, i32* @EOF
%28 = icmp eq i32 %26, %27
br i1 %28, label %29, label %6
29: ; preds = %24, %2
%30 = load i32, i32* @EXIT_SUCCESS
ret i32 %30
}