#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*/, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ OptLign(int /*<<< orphan*/, char *, int /*<<< orphan*/ *);
int /*<<< orphan*/ SEEK_SET;
int /*<<< orphan*/ atoi(char *);
int /*<<< orphan*/ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, int /*<<< orphan*/,
                         int /*<<< orphan*/);
char *malloc(int);
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+");
  char *buffer = malloc(1024);
  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), buffer, f);
      else
        OptLign(atoi(argv[i] + 1), buffer, f);
    }
  }
  free(buffer);
  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    11ca <main+0x4a>
mov    0x2e2a(%rip),%rax
mov    (%rax),%rax
mov    %rax,-0x20(%rbp)
jmp    11eb <main+0x6b>
mov    -0x10(%rbp),%rax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe1e(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,-0x20(%rbp)
mov    $0x400,%edi
call   1060 <malloc@plt>
mov    %rax,-0x28(%rbp)
movl   $0x1,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12b6 <main+0x136>
mov    -0x20(%rbp),%rdi
mov    0x2dc1(%rip),%rax
mov    (%rax),%edx
xor    %esi,%esi
call   1070 <fseek@plt>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    12a3 <main+0x123>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rax
movsbl 0x1(%rax),%eax
cmp    $0x63,%eax
jne    127a <main+0xfa>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
add    $0x2,%rdi
call   10a0 <atoi@plt>
mov    %eax,%edi
mov    -0x28(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1050 <OptChar@plt>
jmp    129e <main+0x11e>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
add    $0x1,%rdi
call   10a0 <atoi@plt>
mov    %eax,%edi
mov    -0x28(%rbp),%rsi
mov    -0x20(%rbp),%rdx
call   1090 <OptLign@plt>
jmp    12a3 <main+0x123>
jmp    12a8 <main+0x128>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1200 <main+0x80>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    -0x20(%rbp),%rdi
call   1040 <fclose@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,%r14
mov    %edi,%ebp
movslq %edi,%rax
mov    -0x8(%rsi,%rax,8),%rdi
cmpb   $0x2d,(%rdi)
jne    11a9 <main+0x29>
mov    0x2e44(%rip),%rax
mov    (%rax),%rbx
jmp    11b8 <main+0x38>
lea    0xe50(%rip),%rsi
call   1080 <fopen@plt>
mov    %rax,%rbx
mov    $0x400,%edi
call   1060 <malloc@plt>
mov    %rax,%r15
cmp    $0x2,%ebp
jl     1234 <main+0xb4>
mov    %ebp,%r12d
mov    $0x1,%ebp
mov    0x2dff(%rip),%r13
jmp    11ff <main+0x7f>
nopl   0x0(%rax,%rax,1)
add    $0x1,%rdi
call   10a0 <atoi@plt>
mov    %eax,%edi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1090 <OptLign@plt>
add    $0x1,%rbp
cmp    %rbp,%r12
je     1234 <main+0xb4>
mov    0x0(%r13),%edx
mov    %rbx,%rdi
xor    %esi,%esi
call   1070 <fseek@plt>
mov    (%r14,%rbp,8),%rdi
cmpb   $0x2d,(%rdi)
jne    11f6 <main+0x76>
cmpb   $0x63,0x1(%rdi)
jne    11e0 <main+0x60>
add    $0x2,%rdi
call   10a0 <atoi@plt>
mov    %eax,%edi
mov    %r15,%rsi
mov    %rbx,%rdx
call   1050 <OptChar@plt>
jmp    11f6 <main+0x76>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1040 <fclose@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
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 i8*
%10 = alloca i32
store i32 0, i32* %4
store i32 %0, i32* %5
store i8** %1, i8*** %6
store i8** %2, i8*** %7
%11 = load i8**, i8*** %6
%12 = load i32, i32* %5
%13 = sub nsw i32 %12, 1
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8*, i8** %11, i64 %14
%16 = load i8*, i8** %15
%17 = getelementptr inbounds i8, i8* %16, i64 0
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp eq i32 %19, 45
br i1 %20, label %21, label %23
21: ; preds = %3
%22 = load i32*, i32** @stdin
store i32* %22, i32** %8
br label %31
23: ; preds = %3
%24 = load i8**, i8*** %6
%25 = load i32, i32* %5
%26 = sub nsw i32 %25, 1
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8*, i8** %24, i64 %27
%29 = load i8*, i8** %28
%30 = call i32* @fopen(i8* %29, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
store i32* %30, i32** %8
br label %31
31: ; preds = %23, %21
%32 = call i8* @malloc(i32 1024)
store i8* %32, i8** %9
store i32 1, i32* %10
br label %33
33: ; preds = %84, %31
%34 = load i32, i32* %10
%35 = load i32, i32* %5
%36 = icmp slt i32 %34, %35
br i1 %36, label %37, label %87
37: ; preds = %33
%38 = load i32*, i32** %8
%39 = load i32, i32* @SEEK_SET
%40 = call i32 @fseek(i32* %38, i32 0, i32 %39)
%41 = load i8**, i8*** %6
%42 = load i32, i32* %10
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds i8*, i8** %41, i64 %43
%45 = load i8*, i8** %44
%46 = getelementptr inbounds i8, i8* %45, i64 0
%47 = load i8, i8* %46
%48 = sext i8 %47 to i32
%49 = icmp eq i32 %48, 45
br i1 %49, label %50, label %83
50: ; preds = %37
%51 = load i8**, i8*** %6
%52 = load i32, i32* %10
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i8*, i8** %51, i64 %53
%55 = load i8*, i8** %54
%56 = getelementptr inbounds i8, i8* %55, i64 1
%57 = load i8, i8* %56
%58 = sext i8 %57 to i32
%59 = icmp eq i32 %58, 99
br i1 %59, label %60, label %71
60: ; preds = %50
%61 = load i8**, i8*** %6
%62 = load i32, i32* %10
%63 = sext i32 %62 to i64
%64 = getelementptr inbounds i8*, i8** %61, i64 %63
%65 = load i8*, i8** %64
%66 = getelementptr inbounds i8, i8* %65, i64 2
%67 = call i32 @atoi(i8* %66)
%68 = load i8*, i8** %9
%69 = load i32*, i32** %8
%70 = call i32 @OptChar(i32 %67, i8* %68, i32* %69)
br label %82
71: ; preds = %50
%72 = load i8**, i8*** %6
%73 = load i32, i32* %10
%74 = sext i32 %73 to i64
%75 = getelementptr inbounds i8*, i8** %72, i64 %74
%76 = load i8*, i8** %75
%77 = getelementptr inbounds i8, i8* %76, i64 1
%78 = call i32 @atoi(i8* %77)
%79 = load i8*, i8** %9
%80 = load i32*, i32** %8
%81 = call i32 @OptLign(i32 %78, i8* %79, i32* %80)
br label %82
82: ; preds = %71, %60
br label %83
83: ; preds = %82, %37
br label %84
84: ; preds = %83
%85 = load i32, i32* %10
%86 = add nsw i32 %85, 1
store i32 %86, i32* %10
br label %33
87: ; preds = %33
%88 = load i8*, i8** %9
%89 = call i32 @free(i8* %88)
%90 = load i32*, i32** %8
%91 = call i32 @fclose(i32* %90)
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 = tail call dereferenceable_or_null(1024) i8* @malloc(i32 1024)
%17 = icmp sgt i32 %0, 1
br i1 %17, label %18, label %20
18: ; preds = %14
%19 = zext i32 %0 to i64
br label %23
20: ; preds = %42, %14
%21 = tail call i32 @free(i8* %16)
%22 = tail call i32 @fclose(i32* %15)
ret i32 0
23: ; preds = %18, %42
%24 = phi i64 [ 1, %18 ], [ %43, %42 ]
%25 = load i32, i32* @SEEK_SET
%26 = tail call i32 @fseek(i32* %15, i32 0, i32 %25)
%27 = getelementptr inbounds i8*, i8** %1, i64 %24
%28 = load i8*, i8** %27
%29 = load i8, i8* %28
%30 = icmp eq i8 %29, 45
br i1 %30, label %31, label %42
31: ; preds = %23
%32 = getelementptr inbounds i8, i8* %28, i64 1
%33 = load i8, i8* %32
%34 = icmp eq i8 %33, 99
br i1 %34, label %35, label %39
35: ; preds = %31
%36 = getelementptr inbounds i8, i8* %28, i64 2
%37 = tail call i32 @atoi(i8* %36)
%38 = tail call i32 @OptChar(i32 %37, i8* %16, i32* %15)
br label %42
39: ; preds = %31
%40 = tail call i32 @atoi(i8* %32)
%41 = tail call i32 @OptLign(i32 %40, i8* %16, i32* %15)
br label %42
42: ; preds = %23, %39, %35
%43 = add nuw nsw i64 %24, 1
%44 = icmp eq i64 %43, %19
br i1 %44, label %20, label %23
}