#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 getchar();
int /*<<< orphan*/ putchar(int);
int main() {
  int c, i;
  const int tab_width = 3;
  while ((c = getchar()) != EOF) {
    if (c == '\t') {
      for (i = 0; i < tab_width; i++) {
        putchar(' ');
      }
    } else {
      putchar(c);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x3,-0x10(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x8(%rbp)
mov    0x2ea1(%rip),%rcx
cmp    (%rcx),%eax
je     1194 <main+0x74>
cmpl   $0x9,-0x8(%rbp)
jne    1187 <main+0x67>
movl   $0x0,-0xc(%rbp)
cmpl   $0x3,-0xc(%rbp)
jge    1182 <main+0x62>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1160 <main+0x40>
jmp    118f <main+0x6f>
mov    -0x8(%rbp),%edi
call   1030 <putchar@plt>
jmp    1136 <main+0x16>
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    0x2eb6(%rip),%r14
cmp    (%r14),%eax
jne    1141 <main+0x21>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
mov    %eax,%ebx
jmp    1165 <main+0x45>
cs nopw 0x0(%rax,%rax,1)
nop
mov    %ebx,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebx
cmp    (%r14),%eax
je     1137 <main+0x17>
cmp    $0x9,%ebx
jne    1150 <main+0x30>
mov    $0x20,%ebx
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    $0x20,%edi
call   1030 <putchar@plt>
jmp    1150 <main+0x30>

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

LLVM IR (-O2):
@EOF = global i32 0
define i32 @main() {
%1 = tail call i32 (...) @getchar()
%2 = load i32, i32* @EOF
%3 = icmp eq i32 %1, %2
br i1 %3, label %16, label %4
4: ; preds = %0, %10
%5 = phi i32 [ %13, %10 ], [ %1, %0 ]
%6 = icmp eq i32 %5, 9
br i1 %6, label %7, label %10
7: ; preds = %4
%8 = tail call i32 @putchar(i32 32)
%9 = tail call i32 @putchar(i32 32)
br label %10
10: ; preds = %4, %7
%11 = phi i32 [ 32, %7 ], [ %5, %4 ]
%12 = tail call i32 @putchar(i32 %11)
%13 = tail call i32 (...) @getchar()
%14 = load i32, i32* @EOF
%15 = icmp eq i32 %13, %14
br i1 %15, label %16, label %4
16: ; preds = %10, %0
ret i32 0
}