#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 */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ OptChar(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ OptLign(int /*<<< orphan*/, int /*<<< orphan*/ *);
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ atoi(char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
int /*<<< orphan*/ *stdin;
int main(int argc, char *argv[], char *env[]) {
  FILE *f;
  if (argv[argc - 1][0] == '-')
    f = stdin;
  else
    f = fopen(argv[argc - 1], "r+");
  for (int i = 1; i < argc; i++) {
    fseek(f, 0, SEEK_SET);
    if (argv[i][0] == '-') {
      if (argv[i][1] == 'c')
        OptChar(atoi(argv[i] + 2), f);
      else
        OptLign(atoi(argv[i] + 1), f);
    }
  }
  fclose(f);
  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)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    11aa <main+0x4a>
mov    0x2e4a(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
jmp    11cb <main+0x6b>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe3e(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,-0x20(%rbp)
movl   $0x1,-0x24(%rbp)
mov    -0x24(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    1280 <main+0x120>
mov    -0x20(%rbp),%rdi
mov    0x2def(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1050 <fseek@plt>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    126d <main+0x10d>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl 0x1(%rax),%eax
cmp    $0x63,%eax
jne    1248 <main+0xe8>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
add    $0x2,%rdi
call   1080 <atoi@plt>
mov    %eax,%edi
mov    -0x20(%rbp),%rsi
call   1040 <OptChar@plt>
jmp    1268 <main+0x108>
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
add    $0x1,%rdi
call   1080 <atoi@plt>
mov    %eax,%edi
mov    -0x20(%rbp),%rsi
call   1070 <OptLign@plt>
jmp    126d <main+0x10d>
jmp    1272 <main+0x112>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    11d2 <main+0x72>
mov    -0x20(%rbp),%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%r14
mov    %edi,%ebp
movslq %edi,%rax
mov    -0x8(%rsi,%rax,8),%rdi
cmpb   $0x2d,(%rdi)
jne    118b <main+0x2b>
mov    0x2e67(%rip),%rax
mov    (%rax),%rbx
cmp    $0x2,%ebp
jge    119f <main+0x3f>
jmp    11fe <main+0x9e>
lea    0xe6e(%rip),%rsi
call   1060 <fopen@plt>
mov    %rax,%rbx
cmp    $0x2,%ebp
jl     11fe <main+0x9e>
mov    %ebp,%r15d
mov    $0x1,%ebp
mov    0x2e2a(%rip),%r12
jmp    11cc <main+0x6c>
add    $0x1,%rdi
call   1080 <atoi@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1070 <OptLign@plt>
add    $0x1,%rbp
cmp    %rbp,%r15
je     11fe <main+0x9e>
mov    (%r12),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1050 <fseek@plt>
mov    (%r14,%rbp,8),%rdi
cmpb   $0x2d,(%rdi)
jne    11c3 <main+0x63>
cmpb   $0x63,0x1(%rdi)
jne    11b0 <main+0x50>
add    $0x2,%rdi
call   1080 <atoi@plt>
mov    %eax,%edi
mov    %rbx,%rsi
call   1040 <OptChar@plt>
jmp    11c3 <main+0x63>
mov    %rbx,%rdi
call   1030 <fclose@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@stdin = global i32* null
@.str = [3 x i8] c"r+\00"
@SEEK_SET = global i32 0
define i32 @main(i32 %0, i8** %1, i8** %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8**
%8 = alloca i32*
%9 = alloca i32
store i32 0, i32* %4
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
%10 = load i8**, i8*** %6
%11 = load i32, i32* %5
%12 = sub nsw i32 %11, 1
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8*, i8** %10, i64 %13
%15 = load i8*, i8** %14
%16 = getelementptr inbounds i8, i8* %15, i64 0
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 45
br i1 %19, label %20, label %22
20: ; preds = %3
%21 = load i32*, i32** @stdin
store i32* %21, i32** %8
br label %30
22: ; preds = %3
%23 = load i8**, i8*** %6
%24 = load i32, i32* %5
%25 = sub nsw i32 %24, 1
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8*, i8** %23, i64 %26
%28 = load i8*, i8** %27
%29 = call i32* @fopen(i8* %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %29, i32** %8
br label %30
30: ; preds = %22, %20
store i32 1, i32* %9
br label %31
31: ; preds = %80, %30
%32 = load i32, i32* %9
%33 = load i32, i32* %5
%34 = icmp slt i32 %32, %33
br i1 %34, label %35, label %83
35: ; preds = %31
%36 = load i32*, i32** %8
%37 = load i32, i32* @SEEK_SET
%38 = call i32 @fseek(i32* %36, i32 0, i32 %37)
%39 = load i8**, i8*** %6
%40 = load i32, i32* %9
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds i8*, i8** %39, i64 %41
%43 = load i8*, i8** %42
%44 = getelementptr inbounds i8, i8* %43, i64 0
%45 = load i8, i8* %44
%46 = sext i8 %45 to i32
%47 = icmp eq i32 %46, 45
br i1 %47, label %48, label %79
48: ; preds = %35
%49 = load i8**, i8*** %6
%50 = load i32, i32* %9
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds i8*, i8** %49, i64 %51
%53 = load i8*, i8** %52
%54 = getelementptr inbounds i8, i8* %53, i64 1
%55 = load i8, i8* %54
%56 = sext i8 %55 to i32
%57 = icmp eq i32 %56, 99
br i1 %57, label %58, label %68
58: ; preds = %48
%59 = load i8**, i8*** %6
%60 = load i32, i32* %9
%61 = sext i32 %60 to i64
%62 = getelementptr inbounds i8*, i8** %59, i64 %61
%63 = load i8*, i8** %62
%64 = getelementptr inbounds i8, i8* %63, i64 2
%65 = call i32 @atoi(i8* %64)
%66 = load i32*, i32** %8
%67 = call i32 @OptChar(i32 %65, i32* %66)
br label %78
68: ; preds = %48
%69 = load i8**, i8*** %6
%70 = load i32, i32* %9
%71 = sext i32 %70 to i64
%72 = getelementptr inbounds i8*, i8** %69, i64 %71
%73 = load i8*, i8** %72
%74 = getelementptr inbounds i8, i8* %73, i64 1
%75 = call i32 @atoi(i8* %74)
%76 = load i32*, i32** %8
%77 = call i32 @OptLign(i32 %75, i32* %76)
br label %78
78: ; preds = %68, %58
br label %79
79: ; preds = %78, %35
br label %80
80: ; preds = %79
%81 = load i32, i32* %9
%82 = add nsw i32 %81, 1
store i32 %82, i32* %9
br label %31
83: ; preds = %31
%84 = load i32*, i32** %8
%85 = call i32 @fclose(i32* %84)
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32* null
@.str = [3 x i8] c"r+\00"
@SEEK_SET = global i32 0
define i32 @main(i32 %0, i8** nocapture %1, i8** nocapture readnone %2) {
%4 = add nsw i32 %0, -1
%5 = sext i32 %4 to i64
%6 = getelementptr inbounds i8*, i8** %1, i64 %5
%7 = load i8*, i8** %6
%8 = load i8, i8* %7
%9 = icmp eq i8 %8, 45
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = load i32*, i32** @stdin
br label %14
12: ; preds = %3
%13 = tail call i32* @fopen(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %14
14: ; preds = %12, %10
%15 = phi i32* [ %11, %10 ], [ %13, %12 ]
%16 = icmp sgt i32 %0, 1
br i1 %16, label %17, label %19
17: ; preds = %14
%18 = zext i32 %0 to i64
br label %21
19: ; preds = %40, %14
%20 = tail call i32 @fclose(i32* %15)
ret i32 0
21: ; preds = %17, %40
%22 = phi i64 [ 1, %17 ], [ %41, %40 ]
%23 = load i32, i32* @SEEK_SET
%24 = tail call i32 @fseek(i32* %15, i32 0, i32 %23)
%25 = getelementptr inbounds i8*, i8** %1, i64 %22
%26 = load i8*, i8** %25
%27 = load i8, i8* %26
%28 = icmp eq i8 %27, 45
br i1 %28, label %29, label %40
29: ; preds = %21
%30 = getelementptr inbounds i8, i8* %26, i64 1
%31 = load i8, i8* %30
%32 = icmp eq i8 %31, 99
br i1 %32, label %33, label %37
33: ; preds = %29
%34 = getelementptr inbounds i8, i8* %26, i64 2
%35 = tail call i32 @atoi(i8* %34)
%36 = tail call i32 @OptChar(i32 %35, i32* %15)
br label %40
37: ; preds = %29
%38 = tail call i32 @atoi(i8* %30)
%39 = tail call i32 @OptLign(i32 %38, i32* %15)
br label %40
40: ; preds = %21, %37, %33
%41 = add nuw nsw i64 %22, 1
%42 = icmp eq i64 %41, %18
br i1 %42, label %19, label %21
}