#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 compress(int /*<<< orphan*/, int, int);
int getopt(int, char **, char *);
int /*<<< orphan*/ optarg;
int /*<<< orphan*/ stdin;
int main(int argc, char *argv[]) {
  int size = 512, mode = 'd';
  int p, res, loop = 0;
  while ((p = getopt(argc, argv, "s:cl")) != EOF) {
    switch (p) {
    case 's':
      size = atoi(optarg);
      break;
    case 'c':
      mode = 'c';
      break;
    case 'l':
      loop = 1;
      break;
    default:
      break;
    }
  }
  do {
    res = compress(stdin, size, mode == 'c');
  } while (res == 0 && loop);
  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   $0x200,-0x14(%rbp)
movl   $0x64,-0x18(%rbp)
movl   $0x0,-0x24(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe97(%rip),%rdx
call   1040 <getopt@plt>
mov    %eax,-0x1c(%rbp)
mov    0x2e60(%rip),%rcx
cmp    (%rcx),%eax
je     11ee <main+0xbe>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x28(%rbp)
sub    $0x63,%eax
je     11cc <main+0x9c>
jmp    1194 <main+0x64>
mov    -0x28(%rbp),%eax
sub    $0x6c,%eax
je     11d8 <main+0xa8>
jmp    11a5 <main+0x75>
mov    -0x28(%rbp),%eax
sub    $0x73,%eax
jne    11e4 <main+0xb4>
jmp    11b6 <main+0x86>
mov    0x2e3b(%rip),%rax
mov    (%rax),%edi
call   1050 <atoi@plt>
mov    %eax,-0x14(%rbp)
jmp    11e9 <main+0xb9>
movl   $0x63,-0x18(%rbp)
jmp    11e9 <main+0xb9>
movl   $0x1,-0x24(%rbp)
jmp    11e9 <main+0xb9>
jmp    11e9 <main+0xb9>
jmp    115b <main+0x2b>
jmp    11f3 <main+0xc3>
mov    0x2de6(%rip),%rax
mov    (%rax),%edi
mov    -0x14(%rbp),%esi
cmpl   $0x63,-0x18(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edx
call   1030 <compress@plt>
mov    %eax,-0x20(%rbp)
xor    %eax,%eax
cmpl   $0x0,-0x20(%rbp)
mov    %al,-0x29(%rbp)
jne    122c <main+0xfc>
cmpl   $0x0,-0x24(%rbp)
setne  %al
mov    %al,-0x29(%rbp)
mov    -0x29(%rbp),%al
test   $0x1,%al
jne    11f3 <main+0xc3>
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,%r14
mov    %edi,%ebp
lea    0xeb9(%rip),%rdx
call   1040 <getopt@plt>
mov    0x2e85(%rip),%rbx
cmp    (%rbx),%eax
jne    11a6 <main+0x76>
xor    %r12d,%r12d
mov    $0x200,%r13d
movl   $0x64,0x4(%rsp)
xor    %ebp,%ebp
cmpl   $0x63,0x4(%rsp)
sete   %bpl
mov    0x2e66(%rip),%rbx
nopw   0x0(%rax,%rax,1)
mov    (%rbx),%edi
mov    %r13d,%esi
mov    %ebp,%edx
call   1030 <compress@plt>
test   %eax,%eax
jne    1195 <main+0x65>
test   %r12d,%r12d
jne    1180 <main+0x50>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
movl   $0x64,0x4(%rsp)
mov    $0x200,%r13d
xor    %r12d,%r12d
lea    0xe42(%rip),%r15
jmp    11d7 <main+0xa7>
mov    $0x1,%r12d
mov    %ebp,%edi
mov    %r14,%rsi
mov    %r15,%rdx
call   1040 <getopt@plt>
cmp    (%rbx),%eax
je     1168 <main+0x38>
cmp    $0x63,%eax
je     1200 <main+0xd0>
cmp    $0x6c,%eax
je     11c0 <main+0x90>
cmp    $0x73,%eax
jne    11c6 <main+0x96>
mov    0x2e0b(%rip),%rax
mov    (%rax),%edi
call   1050 <atoi@plt>
mov    %eax,%r13d
jmp    11c6 <main+0x96>
nopl   0x0(%rax)
movl   $0x63,0x4(%rsp)
jmp    11c6 <main+0x96>

LLVM IR (-O0):
@.str = [5 x i8] c"s:cl\00"
@EOF = global i32 0
@optarg = global i32 0
@stdin = 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
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 512, i32* %6
store i32 100, i32* %7
store i32 0, i32* %10
br label %11
11: ; preds = %25, %2
%12 = load i32, i32* %4
%13 = load i8**, i8*** %5
%14 = call i32 @getopt(i32 %12, i8** %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
store i32 %14, i32* %8
%15 = load i32, i32* @EOF
%16 = icmp ne i32 %14, %15
br i1 %16, label %17, label %26
17: ; preds = %11
%18 = load i32, i32* %8
switch i32 %18, label %24 [
i32 115, label %19
i32 99, label %22
i32 108, label %23
]
19: ; preds = %17
%20 = load i32, i32* @optarg
%21 = call i32 @atoi(i32 %20)
store i32 %21, i32* %6
br label %25
22: ; preds = %17
store i32 99, i32* %7
br label %25
23: ; preds = %17
store i32 1, i32* %10
br label %25
24: ; preds = %17
br label %25
25: ; preds = %24, %23, %22, %19
br label %11
26: ; preds = %11
br label %27
27: ; preds = %40, %26
%28 = load i32, i32* @stdin
%29 = load i32, i32* %6
%30 = load i32, i32* %7
%31 = icmp eq i32 %30, 99
%32 = zext i1 %31 to i32
%33 = call i32 @compress(i32 %28, i32 %29, i32 %32)
store i32 %33, i32* %9
br label %34
34: ; preds = %27
%35 = load i32, i32* %9
%36 = icmp eq i32 %35, 0
br i1 %36, label %37, label %40
37: ; preds = %34
%38 = load i32, i32* %10
%39 = icmp ne i32 %38, 0
br label %40
40: ; preds = %37, %34
%41 = phi i1 [ false, %34 ], [ %39, %37 ]
br i1 %41, label %27, label %42
42: ; preds = %40
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"s:cl\00"
@EOF = global i32 0
@optarg = global i32 0
@stdin = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* @EOF
%5 = icmp eq i32 %3, %4
br i1 %5, label %6, label %13
6: ; preds = %23, %2
%7 = phi i32 [ 100, %2 ], [ %24, %23 ]
%8 = phi i32 [ 512, %2 ], [ %25, %23 ]
%9 = phi i32 [ 0, %2 ], [ %26, %23 ]
%10 = icmp eq i32 %7, 99
%11 = zext i1 %10 to i32
%12 = icmp ne i32 %9, 0
br label %30
13: ; preds = %2, %23
%14 = phi i32 [ %27, %23 ], [ %3, %2 ]
%15 = phi i32 [ %26, %23 ], [ 0, %2 ]
%16 = phi i32 [ %25, %23 ], [ 512, %2 ]
%17 = phi i32 [ %24, %23 ], [ 100, %2 ]
switch i32 %14, label %23 [
i32 115, label %18
i32 99, label %21
i32 108, label %22
]
18: ; preds = %13
%19 = load i32, i32* @optarg
%20 = tail call i32 @atoi(i32 %19)
br label %23
21: ; preds = %13
br label %23
22: ; preds = %13
br label %23
23: ; preds = %13, %22, %21, %18
%24 = phi i32 [ %17, %13 ], [ %17, %22 ], [ 99, %21 ], [ %17, %18 ]
%25 = phi i32 [ %16, %13 ], [ %16, %22 ], [ %16, %21 ], [ %20, %18 ]
%26 = phi i32 [ %15, %13 ], [ 1, %22 ], [ %15, %21 ], [ %15, %18 ]
%27 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%28 = load i32, i32* @EOF
%29 = icmp eq i32 %27, %28
br i1 %29, label %6, label %13
30: ; preds = %6, %30
%31 = load i32, i32* @stdin
%32 = tail call i32 @compress(i32 %31, i32 %8, i32 %11)
%33 = icmp eq i32 %32, 0
%34 = select i1 %33, i1 %12, i1 false
br i1 %34, label %30, label %35
35: ; preds = %30
ret i32 0
}