#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 */
char EOF;
int get_tab_size(int);
char getchar();
int /*<<< orphan*/ putchar(char);
int main() {
  char current_char = EOF;
  int char_index = 0;
  while ((current_char = getchar()) != EOF) {
    if (current_char == '\t') {
      for (; char_index < get_tab_size(char_index); ++char_index) {
        putchar(' ');
      }
    } else if (current_char == '\n') {
      char_index = 0;
      putchar('\n');
    } else {
      putchar(current_char);
    }
    ++char_index;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2ea2(%rip),%rax
mov    (%rax),%al
mov    %al,-0x5(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl %al,%eax
mov    0x2e82(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     11fa <main+0xca>
movsbl -0x5(%rbp),%eax
cmp    $0x9,%eax
jne    11bb <main+0x8b>
jmp    1183 <main+0x53>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%edi
call   1050 <get_tab_size@plt>
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
cmp    %ecx,%eax
jge    11b6 <main+0x86>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1183 <main+0x53>
jmp    11ec <main+0xbc>
movsbl -0x5(%rbp),%eax
cmp    $0xa,%eax
jne    11de <main+0xae>
movl   $0x0,-0xc(%rbp)
mov    $0xa,%edi
call   1030 <putchar@plt>
jmp    11e7 <main+0xb7>
movsbl -0x5(%rbp),%edi
call   1030 <putchar@plt>
jmp    11ec <main+0xbc>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1152 <main+0x22>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2ea6(%rip),%r14
cmp    (%r14),%al
jne    1151 <main+0x21>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
xor    %ebx,%ebx
jmp    1179 <main+0x49>
cs nopw 0x0(%rax,%rax,1)
nop
xor    %ebx,%ebx
movsbl %al,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%r14),%al
je     1147 <main+0x17>
cmp    $0xa,%al
je     1160 <main+0x30>
cmp    $0x9,%al
jne    1162 <main+0x32>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    %ebx,%edi
call   1050 <get_tab_size@plt>
cmp    %eax,%ebx
jge    116a <main+0x3a>
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0x1,%ebx
jmp    1190 <main+0x60>

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

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