#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);
scalar_t__ str2num(char *);
int main(int argc, char *argv[]) {
  int c, e;
  int tabstop = 4;
  int offset = 0;
  if (argc == 2) {
    tabstop = (int)str2num(argv[1]);
  }
  while ((c = getchar()) != EOF) {
    if (c == '\n') {
      putchar(c);
      offset = 0;
    } else if (c == '\t') {
      for (e = 0; e < tabstop - offset; ++e) {
        putchar(' ');
      }
      offset = 0;
    } else {
      putchar(c);
      ++offset;
    }
  }
  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)
movl   $0x4,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
cmpl   $0x2,-0x8(%rbp)
jne    116e <main+0x3e>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <str2num@plt>
mov    %eax,-0x1c(%rbp)
jmp    1173 <main+0x43>
mov    $0x0,%al
call   1040 <getchar@plt>
mov    %eax,-0x14(%rbp)
mov    0x2e64(%rip),%rcx
cmp    (%rcx),%eax
je     120b <main+0xdb>
cmpl   $0xa,-0x14(%rbp)
jne    11aa <main+0x7a>
mov    -0x14(%rbp),%edi
call   1030 <putchar@plt>
movl   $0x0,-0x20(%rbp)
jmp    1206 <main+0xd6>
cmpl   $0x9,-0x14(%rbp)
jne    11f0 <main+0xc0>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    -0x1c(%rbp),%ecx
sub    -0x20(%rbp),%ecx
cmp    %ecx,%eax
jge    11e4 <main+0xb4>
mov    $0x20,%edi
call   1030 <putchar@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11bb <main+0x8b>
movl   $0x0,-0x20(%rbp)
jmp    1201 <main+0xd1>
mov    -0x14(%rbp),%edi
call   1030 <putchar@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1206 <main+0xd6>
jmp    1173 <main+0x43>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0x4,%r14d
cmp    $0x2,%edi
jne    114e <main+0x1e>
mov    0x8(%rsi),%rdi
call   1050 <str2num@plt>
mov    %rax,%r14
xor    %eax,%eax
call   1040 <getchar@plt>
mov    0x2e8c(%rip),%r15
cmp    (%r15),%eax
jne    116e <main+0x3e>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %ebp,%ebp
jmp    1196 <main+0x66>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %eax,%edi
call   1030 <putchar@plt>
add    $0x1,%ebp
xor    %eax,%eax
call   1040 <getchar@plt>
cmp    (%r15),%eax
je     1161 <main+0x31>
cmp    $0xa,%eax
je     11d0 <main+0xa0>
cmp    $0x9,%eax
jne    1180 <main+0x50>
mov    %r14d,%ebx
sub    %ebp,%ebx
xor    %ebp,%ebp
test   %ebx,%ebx
jle    118a <main+0x5a>
nopl   0x0(%rax,%rax,1)
mov    $0x20,%edi
call   1030 <putchar@plt>
add    $0xffffffff,%ebx
jne    11b0 <main+0x80>
jmp    118a <main+0x5a>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %ebp,%ebp
jmp    118a <main+0x5a>

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

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