#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(int argc, char *argv[]) {
  char c;
  int i;
  int bn;
  while ((c = getchar()) != EOF) {
    if (c == ' ') {
      ++bn;
      if (bn >= 4) {
        putchar('\t');
        bn -= 4;
      }
    } else {
      for (; bn > 0; --bn)
        putchar(' ');
      putchar(c);
    }
  }
  return 0;
}


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)
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %al,-0x11(%rbp)
movsbl %al,%eax
mov    0x2e9e(%rip),%rcx
movsbl (%rcx),%ecx
cmp    %ecx,%eax
je     11c2 <main+0xa2>
movsbl -0x11(%rbp),%eax
cmp    $0x20,%eax
jne    118d <main+0x6d>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x4,-0x1c(%rbp)
jl     1188 <main+0x68>
mov    $0x9,%edi
call   1030 <putchar@plt>
mov    -0x1c(%rbp),%eax
sub    $0x4,%eax
mov    %eax,-0x1c(%rbp)
jmp    11bd <main+0x9d>
jmp    1192 <main+0x72>
cmpl   $0x0,-0x1c(%rbp)
jle    11b4 <main+0x94>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
jmp    1192 <main+0x72>
movsbl -0x11(%rbp),%edi
call   1030 <putchar@plt>
jmp    1136 <main+0x16>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2eb6(%rip),%r14
cmp    (%r14),%al
jne    113e <main+0x1e>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    %eax,%ebx
jmp    116b <main+0x4b>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    $0x9,%edi
call   1030 <putchar@plt>
add    $0xfffffffd,%ebp
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %eax,%ebx
cmp    (%r14),%al
je     1137 <main+0x17>
cmp    $0x20,%bl
jne    1180 <main+0x60>
cmp    $0x3,%ebp
jge    1150 <main+0x30>
add    $0x1,%ebp
jmp    115d <main+0x3d>
nopw   0x0(%rax,%rax,1)
test   %ebp,%ebp
jle    11a4 <main+0x84>
add    $0x1,%ebp
nopw   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebp
cmp    $0x1,%ebp
ja     1190 <main+0x70>
xor    %ebp,%ebp
movsbl %bl,%edi
call   1030 <putchar@plt>
jmp    115d <main+0x3d>

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

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