#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 atoi(int /*<<< orphan*/);
int /*<<< orphan*/ free(int *);
int *get_tablist(int /*<<< orphan*/);
int getchar();
int getopt(int, char **, char *);
int /*<<< orphan*/ optarg;
int print_spaces(int, int, int *);
int /*<<< orphan*/ putchar(int);
int main(int argc, char **argv) {
  int column = 0;
  int c = 0;
  int arg = 0;
  int tabsize = 8;
  int *tablist = NULL;
  while ((arg = getopt(argc, argv, "m:M:")) != -1) {
    switch (arg) {
      int val = 0;
    case 'm':
      val = atoi(optarg);
      if (val > 0)
        tabsize = val;
      break;
    case 'M':
      tablist = get_tablist(optarg);
      break;
    case '?':
    default:
      break;
    }
  }
  while ((c = getchar()) != EOF) {
    if (c == '\t') {
      column = print_spaces(column, tabsize, tablist);
    } else if (c == '\n') {
      putchar(c);
      column = 0;
    } else {
      putchar(c);
      column++;
    }
  }
  free(tablist);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movl   $0x8,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe48(%rip),%rdx
call   1080 <getopt@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0xffffffff,%eax
je     124b <main+0xdb>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x30(%rbp)
sub    $0x3f,%eax
je     123c <main+0xcc>
jmp    11dd <main+0x6d>
mov    -0x30(%rbp),%eax
sub    $0x4d,%eax
je     1225 <main+0xb5>
jmp    11ee <main+0x7e>
mov    -0x30(%rbp),%eax
sub    $0x6d,%eax
jne    1241 <main+0xd1>
jmp    11ff <main+0x8f>
mov    0x2df2(%rip),%rax
mov    (%rax),%edi
call   1090 <atoi@plt>
mov    %eax,-0x2c(%rbp)
cmpl   $0x0,-0x2c(%rbp)
jle    1220 <main+0xb0>
mov    -0x2c(%rbp),%eax
mov    %eax,-0x20(%rbp)
jmp    1246 <main+0xd6>
mov    0x2dcc(%rip),%rax
mov    (%rax),%edi
call   1060 <get_tablist@plt>
mov    %rax,-0x28(%rbp)
jmp    1246 <main+0xd6>
jmp    1241 <main+0xd1>
jmp    1246 <main+0xd6>
jmp    11aa <main+0x3a>
jmp    1250 <main+0xe0>
mov    $0x0,%al
call   1070 <getchar@plt>
mov    %eax,-0x18(%rbp)
mov    0x2d7f(%rip),%rcx
cmp    (%rcx),%eax
je     12c3 <main+0x153>
cmpl   $0x9,-0x18(%rbp)
jne    128a <main+0x11a>
mov    -0x14(%rbp),%edi
mov    -0x20(%rbp),%esi
mov    -0x28(%rbp),%rdx
call   1050 <print_spaces@plt>
mov    %eax,-0x14(%rbp)
jmp    12be <main+0x14e>
cmpl   $0xa,-0x18(%rbp)
jne    12a8 <main+0x138>
mov    -0x18(%rbp),%edi
call   1040 <putchar@plt>
movl   $0x0,-0x14(%rbp)
jmp    12b9 <main+0x149>
mov    -0x18(%rbp),%edi
call   1040 <putchar@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    12be <main+0x14e>
jmp    1250 <main+0xe0>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%rbp
mov    %edi,%ebx
mov    $0x8,%r14d
xor    %r15d,%r15d
lea    0xe70(%rip),%r12
mov    0x2e61(%rip),%r13
nopw   0x0(%rax,%rax,1)
mov    %ebx,%edi
mov    %rbp,%rsi
mov    %r12,%rdx
call   1080 <getopt@plt>
cmp    $0x6d,%eax
je     11be <main+0x4e>
cmp    $0x4d,%eax
je     11cf <main+0x5f>
cmp    $0xffffffff,%eax
jne    11a0 <main+0x30>
jmp    11dd <main+0x6d>
mov    0x0(%r13),%edi
call   1090 <atoi@plt>
test   %eax,%eax
cmovg  %eax,%r14d
jmp    11a0 <main+0x30>
mov    0x0(%r13),%edi
call   1060 <get_tablist@plt>
mov    %rax,%r15
jmp    11a0 <main+0x30>
xor    %eax,%eax
call   1070 <getchar@plt>
mov    0x2df5(%rip),%rbp
cmp    0x0(%rbp),%eax
jne    1209 <main+0x99>
mov    %r15,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %ebx,%ebx
jmp    1226 <main+0xb6>
nopl   (%rax)
mov    %eax,%edi
call   1040 <putchar@plt>
add    $0x1,%ebx
xor    %eax,%eax
call   1070 <getchar@plt>
cmp    0x0(%rbp),%eax
je     11f0 <main+0x80>
cmp    $0xa,%eax
je     1250 <main+0xe0>
cmp    $0x9,%eax
jne    1210 <main+0xa0>
mov    %ebx,%edi
mov    %r14d,%esi
mov    %r15,%rdx
call   1050 <print_spaces@plt>
mov    %eax,%ebx
jmp    121a <main+0xaa>
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0xa,%edi
call   1040 <putchar@plt>
xor    %ebx,%ebx
jmp    121a <main+0xaa>

LLVM IR (-O0):
@.str = [5 x i8] c"m:M:\00"
@optarg = global i32 0
@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
%10 = alloca i32*
%11 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32 0, i32* %7
store i32 0, i32* %8
store i32 8, i32* %9
store i32* null, i32** %10
br label %12
12: ; preds = %32, %2
%13 = load i32, i32* %4
%14 = load i8**, i8*** %5
%15 = call i32 @getopt(i32 %13, i8** %14, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i32 %15, i32* %8
%16 = icmp ne i32 %15, -1
br i1 %16, label %17, label %33
17: ; preds = %12
%18 = load i32, i32* %8
switch i32 %18, label %31 [
i32 109, label %19
i32 77, label %27
i32 63, label %30
]
19: ; preds = %17
%20 = load i32, i32* @optarg
%21 = call i32 @atoi(i32 %20)
store i32 %21, i32* %11
%22 = load i32, i32* %11
%23 = icmp sgt i32 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %19
%25 = load i32, i32* %11
store i32 %25, i32* %9
br label %26
26: ; preds = %24, %19
br label %32
27: ; preds = %17
%28 = load i32, i32* @optarg
%29 = call i32* @get_tablist(i32 %28)
store i32* %29, i32** %10
br label %32
30: ; preds = %17
br label %31
31: ; preds = %17, %30
br label %32
32: ; preds = %31, %27, %26
br label %12
33: ; preds = %12
br label %34
34: ; preds = %58, %33
%35 = call i32 (...) @getchar()
store i32 %35, i32* %7
%36 = load i32, i32* @EOF
%37 = icmp ne i32 %35, %36
br i1 %37, label %38, label %59
38: ; preds = %34
%39 = load i32, i32* %7
%40 = icmp eq i32 %39, 9
br i1 %40, label %41, label %46
41: ; preds = %38
%42 = load i32, i32* %6
%43 = load i32, i32* %9
%44 = load i32*, i32** %10
%45 = call i32 @print_spaces(i32 %42, i32 %43, i32* %44)
store i32 %45, i32* %6
br label %58
46: ; preds = %38
%47 = load i32, i32* %7
%48 = icmp eq i32 %47, 10
br i1 %48, label %49, label %52
49: ; preds = %46
%50 = load i32, i32* %7
%51 = call i32 @putchar(i32 %50)
store i32 0, i32* %6
br label %57
52: ; preds = %46
%53 = load i32, i32* %7
%54 = call i32 @putchar(i32 %53)
%55 = load i32, i32* %6
%56 = add nsw i32 %55, 1
store i32 %56, i32* %6
br label %57
57: ; preds = %52, %49
br label %58
58: ; preds = %57, %41
br label %34
59: ; preds = %34
%60 = load i32*, i32** %10
%61 = call i32 @free(i32* %60)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"m:M:\00"
@optarg = global i32 0
@EOF = global i32 0
define i32 @main(i32 %0, i8** %1) {
br label %3
3: ; preds = %14, %2
%4 = phi i32 [ %18, %14 ], [ 8, %2 ]
%5 = phi i32* [ %7, %14 ], [ null, %2 ]
br label %6
6: ; preds = %3, %19
%7 = phi i32* [ %5, %3 ], [ %21, %19 ]
br label %8
8: ; preds = %6, %8
%9 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
switch i32 %9, label %8 [
i32 -1, label %10
i32 109, label %14
i32 77, label %19
]
10: ; preds = %8
%11 = tail call i32 (...) @getchar()
%12 = load i32, i32* @EOF
%13 = icmp eq i32 %11, %12
br i1 %13, label %37, label %22
14: ; preds = %8
%15 = load i32, i32* @optarg
%16 = tail call i32 @atoi(i32 %15)
%17 = icmp sgt i32 %16, 0
%18 = select i1 %17, i32 %16, i32 %4
br label %3
19: ; preds = %8
%20 = load i32, i32* @optarg
%21 = tail call i32* @get_tablist(i32 %20)
br label %6
22: ; preds = %10, %32
%23 = phi i32 [ %34, %32 ], [ %11, %10 ]
%24 = phi i32 [ %33, %32 ], [ 0, %10 ]
switch i32 %23, label %29 [
i32 9, label %25
i32 10, label %27
]
25: ; preds = %22
%26 = tail call i32 @print_spaces(i32 %24, i32 %4, i32* %7)
br label %32
27: ; preds = %22
%28 = tail call i32 @putchar(i32 10)
br label %32
29: ; preds = %22
%30 = tail call i32 @putchar(i32 %23)
%31 = add nsw i32 %24, 1
br label %32
32: ; preds = %27, %29, %25
%33 = phi i32 [ %26, %25 ], [ 0, %27 ], [ %31, %29 ]
%34 = tail call i32 (...) @getchar()
%35 = load i32, i32* @EOF
%36 = icmp eq i32 %34, %35
br i1 %36, label %37, label %22
37: ; preds = %32, %10
%38 = tail call i32 @free(i32* %7)
ret i32 0
}