#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;
char getchar();
int /*<<< orphan*/ putchar(char);
int main(void) {
  char c;
  int pos = 1;
  int nb;
  while ((c = getchar()) != EOF) {
    if (c == '\t')
      for (nb = 4 - (pos - 1) % 4; nb > 0; nb--, pos++)
        (void)putchar(' ');
    else {
      (void)putchar(c);
      if (c == '\n')
        pos = 1;
      else
        pos++;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x1,-0xc(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x5(%rbp)
movsbl %al,%eax
mov    0x2e9e(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     11df <main+0xbf>
movsbl -0x5(%rbp),%eax
cmp    $0x9,%eax
jne    11aa <main+0x8a>
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    $0x4,%eax
sub    %edx,%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x0,-0x10(%rbp)
jle    11a5 <main+0x85>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x10(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    117a <main+0x5a>
jmp    11da <main+0xba>
movsbl -0x5(%rbp),%edi
call   1030 <putchar@plt>
movsbl -0x5(%rbp),%eax
cmp    $0xa,%eax
jne    11cc <main+0xac>
movl   $0x1,-0xc(%rbp)
jmp    11d5 <main+0xb5>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11da <main+0xba>
jmp    1136 <main+0x16>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb2(%rip),%r14
cmp    (%r14),%al
jne    1146 <main+0x26>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %eax,%ebx
mov    $0x1,%r15d
mov    $0x1,%ebp
jmp    1180 <main+0x60>
cs nopw 0x0(%rax,%rax,1)
nop
movsbl %bl,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
cmp    $0xa,%bl
cmove  %r15d,%ebp
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebx
cmp    (%r14),%al
je     113b <main+0x1b>
cmp    $0x9,%bl
jne    1160 <main+0x40>
lea    -0x1(%rbp),%eax
lea    0x2(%rbp),%ecx
test   %eax,%eax
cmovns %eax,%ecx
and    $0xfffffffc,%ecx
neg    %ecx
lea    (%rcx,%rbp,1),%r12d
add    $0xffffffff,%r12d
add    $0x4,%ebp
mov    $0x5,%ebx
sub    %r12d,%ebx
nopl   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
cmp    $0x1,%ebx
ja     11b0 <main+0x90>
sub    %r12d,%ebp
jmp    1172 <main+0x52>

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