#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 /*<<< orphan*/ abort();
int atoi(int /*<<< orphan*/);
int /*<<< orphan*/ formate(int, int, int, char *);
int getopt(int, char **, char *);
int /*<<< orphan*/ optarg;
int optind;
int main(int argc, char *argv[]) {
  int length = 80, cut = 0, option, source = 1;
  char *filename = "";
  while ((option = getopt(argc, argv, "cw:")) != -1)
    switch (option) {
    case 'w':
      length = atoi(optarg);
      break;
    case 'c':
      cut = 1;
      break;
    default:
      abort();
    }
  if (optind < argc) {
    source = 0;
    filename = argv[optind];
  }
  formate(length, cut, source, filename);
  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   $0x50,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x1,-0x20(%rbp)
lea    0xe91(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe7c(%rip),%rdx
call   1050 <getopt@plt>
mov    %eax,-0x1c(%rbp)
cmp    $0xffffffff,%eax
je     11e8 <main+0xa8>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x2c(%rbp)
sub    $0x63,%eax
je     11d0 <main+0x90>
jmp    11a9 <main+0x69>
mov    -0x2c(%rbp),%eax
sub    $0x77,%eax
jne    11dc <main+0x9c>
jmp    11ba <main+0x7a>
mov    0x2e37(%rip),%rax
mov    (%rax),%edi
call   1060 <atoi@plt>
mov    %eax,-0x14(%rbp)
jmp    11e3 <main+0xa3>
movl   $0x1,-0x18(%rbp)
jmp    11e3 <main+0xa3>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    1176 <main+0x36>
mov    0x2df1(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jge    1217 <main+0xd7>
movl   $0x0,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x2dd4(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x28(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
mov    -0x20(%rbp),%edx
mov    -0x28(%rbp),%rcx
call   1040 <formate@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,%rbx
mov    %edi,%ebp
mov    $0x50,%r15d
xor    %r14d,%r14d
lea    0xea0(%rip),%r12
mov    0x2e91(%rip),%r13
jmp    117c <main+0x3c>
nopl   0x0(%rax)
mov    0x0(%r13),%edi
call   1060 <atoi@plt>
mov    %eax,%r15d
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %r12,%rdx
call   1050 <getopt@plt>
cmp    $0x77,%eax
je     1170 <main+0x30>
cmp    $0xffffffff,%eax
je     11a0 <main+0x60>
cmp    $0x63,%eax
jne    11de <main+0x9e>
mov    $0x1,%r14d
jmp    117c <main+0x3c>
mov    0x2e39(%rip),%rax
movslq (%rax),%rax
cmp    %ebp,%eax
jge    11b6 <main+0x76>
mov    (%rbx,%rax,8),%rcx
xor    %edx,%edx
jmp    11c2 <main+0x82>
lea    0xe46(%rip),%rcx
mov    $0x1,%edx
mov    %r15d,%edi
mov    %r14d,%esi
call   1040 <formate@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [1 x i8] zeroinitializer
@.str.1 = [4 x i8] c"cw:\00"
@optarg = global i32 0
@optind = 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 i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 80, i32* %6
store i32 0, i32* %7
store i32 1, i32* %9
store i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), i8** %10
br label %11
11: ; preds = %24, %2
%12 = load i32, i32* %4
%13 = load i8**, i8*** %5
%14 = call i32 @getopt(i32 %12, i8** %13, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
store i32 %14, i32* %8
%15 = icmp ne i32 %14, -1
br i1 %15, label %16, label %25
16: ; preds = %11
%17 = load i32, i32* %8
switch i32 %17, label %22 [
i32 119, label %18
i32 99, label %21
]
18: ; preds = %16
%19 = load i32, i32* @optarg
%20 = call i32 @atoi(i32 %19)
store i32 %20, i32* %6
br label %24
21: ; preds = %16
store i32 1, i32* %7
br label %24
22: ; preds = %16
%23 = call i32 (...) @abort()
unreachable
24: ; preds = %21, %18
br label %11
25: ; preds = %11
%26 = load i32, i32* @optind
%27 = load i32, i32* %4
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %35
29: ; preds = %25
store i32 0, i32* %9
%30 = load i8**, i8*** %5
%31 = load i32, i32* @optind
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i8*, i8** %30, i64 %32
%34 = load i8*, i8** %33
store i8* %34, i8** %10
br label %35
35: ; preds = %29, %25
%36 = load i32, i32* %6
%37 = load i32, i32* %7
%38 = load i32, i32* %9
%39 = load i8*, i8** %10
%40 = call i32 @formate(i32 %36, i32 %37, i32 %38, i8* %39)
ret i32 0
}

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [4 x i8] c"cw:\00"
@optarg = global i32 0
@optind = global i32 0
define i32 @main(i32 %0, i8** %1) {
br label %3
3: ; preds = %6, %2
%4 = phi i32 [ 0, %2 ], [ 1, %6 ]
%5 = phi i32 [ 80, %2 ], [ %7, %6 ]
br label %6
6: ; preds = %3, %9
%7 = phi i32 [ %11, %9 ], [ %5, %3 ]
%8 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0))
switch i32 %8, label %12 [
i32 -1, label %14
i32 119, label %9
i32 99, label %3
]
9: ; preds = %6
%10 = load i32, i32* @optarg
%11 = tail call i32 @atoi(i32 %10)
br label %6
12: ; preds = %6
%13 = tail call i32 (...) @abort()
unreachable
14: ; preds = %6
%15 = load i32, i32* @optind
%16 = icmp slt i32 %15, %0
br i1 %16, label %17, label %21
17: ; preds = %14
%18 = sext i32 %15 to i64
%19 = getelementptr inbounds i8*, i8** %1, i64 %18
%20 = load i8*, i8** %19
br label %21
21: ; preds = %17, %14
%22 = phi i32 [ 0, %17 ], [ 1, %14 ]
%23 = phi i8* [ %20, %17 ], [ getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0), %14 ]
%24 = tail call i32 @formate(i32 %7, i32 %4, i32 %22, i8* %23)
ret i32 0
}