#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*/ append_all(int, char *);
int /*<<< orphan*/ ar_append(int, char *);
int /*<<< orphan*/ ar_close(int);
int /*<<< orphan*/ ar_extract(int, char *);
int ar_open(char *);
int /*<<< orphan*/ ar_print_concise(int);
int /*<<< orphan*/ ar_print_verbose(int);
int /*<<< orphan*/ ar_remove(int, char *);
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int getopt(int, char **, char *);
scalar_t__ malloc(int);
int optind;
int /*<<< orphan*/ perror(int /*<<< orphan*/ *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcpy(char *, char *);
int strlen(char *);
int /*<<< orphan*/ usage();
int main(int argc, char **argv) {
  char *archive_path = NULL;
  int mode = 0;
  int c;
  int fd;
  while ((c = getopt(argc, argv, "Adqtvx")) != -1) {
    switch (c) {
    case 'A':
      if (mode != 0) {
        usage();
      }
      mode = 1;
      break;
    case 'd':
      if (mode != 0) {
        usage();
      }
      mode = 2;
      break;
    case 'q':
      if (mode != 0) {
        usage();
      }
      mode = 3;
      break;
    case 't':
      if (mode != 0) {
        usage();
      }
      mode = 4;
      break;
    case 'v':
      if (mode != 0) {
        usage();
      }
      mode = 5;
      break;
    case 'x':
      if (mode != 0) {
        usage();
      }
      mode = 6;
      break;
    default:
      break;
    }
  }
  if (mode == 0) {
    usage();
  }
  if (optind < argc) {
    archive_path = (char *)malloc((strlen(argv[optind]) + 1) * sizeof(char));
    if (archive_path == NULL) {
      perror(NULL);
      exit(0);
    }
    strcpy(archive_path, argv[optind++]);
  } else {
    usage();
  }
  fd = ar_open(archive_path);
  if (fd == -1) {
    fprintf(stderr, "Could not open archive file\n");
    return -1;
  }
  do {
    switch (mode) {
    case 1:
      append_all(fd, archive_path);
      break;
    case 2:
      ar_remove(fd, argv[optind++]);
      break;
    case 3:
      ar_append(fd, argv[optind++]);
      break;
    case 4:
      ar_print_concise(fd);
      break;
    case 5:
      ar_print_verbose(fd);
      break;
    case 6:
      ar_extract(fd, argv[optind++]);
      break;
    }
  } while (optind < argc);
  ar_close(fd);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xec5(%rip),%rdx
call   1100 <getopt@plt>
mov    %eax,-0x20(%rbp)
cmp    $0xffffffff,%eax
je     1325 <main+0x125>
mov    -0x20(%rbp),%eax
add    $0xffffffbf,%eax
mov    %eax,%ecx
mov    %rcx,-0x30(%rbp)
sub    $0x37,%eax
ja     131b <main+0x11b>
mov    -0x30(%rbp),%rax
lea    0xdb4(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
cmpl   $0x0,-0x1c(%rbp)
je     127e <main+0x7e>
mov    $0x0,%al
call   10d0 <usage@plt>
movl   $0x1,-0x1c(%rbp)
jmp    1320 <main+0x120>
cmpl   $0x0,-0x1c(%rbp)
je     129b <main+0x9b>
mov    $0x0,%al
call   10d0 <usage@plt>
movl   $0x2,-0x1c(%rbp)
jmp    1320 <main+0x120>
cmpl   $0x0,-0x1c(%rbp)
je     12b8 <main+0xb8>
mov    $0x0,%al
call   10d0 <usage@plt>
movl   $0x3,-0x1c(%rbp)
jmp    1320 <main+0x120>
cmpl   $0x0,-0x1c(%rbp)
je     12d5 <main+0xd5>
mov    $0x0,%al
call   10d0 <usage@plt>
movl   $0x4,-0x1c(%rbp)
jmp    1320 <main+0x120>
cmpl   $0x0,-0x1c(%rbp)
je     12f2 <main+0xf2>
mov    $0x0,%al
call   10d0 <usage@plt>
movl   $0x5,-0x1c(%rbp)
jmp    1320 <main+0x120>
cmpl   $0x0,-0x1c(%rbp)
je     130f <main+0x10f>
mov    $0x0,%al
call   10d0 <usage@plt>
movl   $0x6,-0x1c(%rbp)
jmp    1320 <main+0x120>
jmp    1320 <main+0x120>
jmp    1225 <main+0x25>
cmpl   $0x0,-0x1c(%rbp)
jne    1336 <main+0x136>
mov    $0x0,%al
call   10d0 <usage@plt>
mov    0x2cab(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jge    13be <main+0x1be>
mov    -0x10(%rbp),%rax
mov    0x2c95(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rdi
call   1070 <strlen@plt>
add    $0x1,%eax
cltq
shl    $0x0,%rax
mov    %eax,%edi
call   10c0 <malloc@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    138e <main+0x18e>
xor    %eax,%eax
mov    %eax,%edi
call   10f0 <perror@plt>
xor    %edi,%edi
call   1120 <exit@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x2c4b(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    0x2c3d(%rip),%rdx
mov    %esi,(%rdx)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
call   1030 <strcpy@plt>
jmp    13c5 <main+0x1c5>
mov    $0x0,%al
call   10d0 <usage@plt>
mov    -0x18(%rbp),%rdi
call   1090 <ar_open@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0xffffffff,-0x24(%rbp)
jne    13fc <main+0x1fc>
mov    0x2bf6(%rip),%rax
mov    (%rax),%edi
lea    0xd14(%rip),%rsi
call   1080 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1503 <main+0x303>
jmp    1401 <main+0x201>
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,%ecx
mov    %rcx,-0x38(%rbp)
sub    $0x5,%eax
ja     14dd <main+0x2dd>
mov    -0x38(%rbp),%rax
lea    0xbdf(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
mov    -0x24(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   10a0 <append_all@plt>
jmp    14dd <main+0x2dd>
mov    -0x24(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    0x2b9f(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    0x2b91(%rip),%rdx
mov    %esi,(%rdx)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
call   10b0 <ar_remove@plt>
jmp    14dd <main+0x2dd>
mov    -0x24(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    0x2b70(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    0x2b62(%rip),%rdx
mov    %esi,(%rdx)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
call   10e0 <ar_append@plt>
jmp    14dd <main+0x2dd>
mov    -0x24(%rbp),%edi
call   1040 <ar_print_concise@plt>
jmp    14dd <main+0x2dd>
mov    -0x24(%rbp),%edi
call   1050 <ar_print_verbose@plt>
jmp    14dd <main+0x2dd>
mov    -0x24(%rbp),%edi
mov    -0x10(%rbp),%rax
mov    0x2b27(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    0x2b19(%rip),%rdx
mov    %esi,(%rdx)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
call   1060 <ar_extract@plt>
jmp    14e2 <main+0x2e2>
mov    0x2aff(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jl     1401 <main+0x201>
mov    -0x24(%rbp),%edi
call   1110 <ar_close@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%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,%r12
mov    %edi,%r13d
lea    0xee0(%rip),%r14
lea    0xde1(%rip),%rbx
xor    %ebp,%ebp
jmp    1237 <main+0x37>
test   %ebp,%ebp
mov    $0x5,%ebp
je     1237 <main+0x37>
nopl   0x0(%rax)
xor    %eax,%eax
call   10d0 <usage@plt>
mov    %r13d,%edi
mov    %r12,%rsi
mov    %r14,%rdx
call   1100 <getopt@plt>
lea    -0x41(%rax),%ecx
cmp    $0x37,%ecx
ja     128d <main+0x8d>
movslq (%rbx,%rcx,4),%rax
add    %rbx,%rax
jmp    *%rax
test   %ebp,%ebp
mov    $0x1,%ebp
jne    1230 <main+0x30>
jmp    1237 <main+0x37>
test   %ebp,%ebp
mov    $0x3,%ebp
jne    1230 <main+0x30>
jmp    1237 <main+0x37>
test   %ebp,%ebp
mov    $0x4,%ebp
jne    1230 <main+0x30>
jmp    1237 <main+0x37>
test   %ebp,%ebp
mov    $0x2,%ebp
jne    1230 <main+0x30>
jmp    1237 <main+0x37>
test   %ebp,%ebp
mov    $0x6,%ebp
jne    1230 <main+0x30>
jmp    1237 <main+0x37>
cmp    $0xffffffff,%eax
jne    1237 <main+0x37>
test   %ebp,%ebp
jne    129d <main+0x9d>
xor    %eax,%eax
call   10d0 <usage@plt>
mov    0x2d44(%rip),%rbx
movslq (%rbx),%rax
cmp    %r13d,%eax
jge    12df <main+0xdf>
mov    (%r12,%rax,8),%rdi
call   1070 <strlen@plt>
lea    0x1(%rax),%edi
call   10c0 <malloc@plt>
test   %rax,%rax
je     13c2 <main+0x1c2>
mov    %rax,%r14
movslq (%rbx),%rax
lea    0x1(%rax),%ecx
mov    %ecx,(%rbx)
mov    (%r12,%rax,8),%rsi
mov    %r14,%rdi
call   1030 <strcpy@plt>
jmp    12e9 <main+0xe9>
xor    %r14d,%r14d
xor    %eax,%eax
call   10d0 <usage@plt>
mov    %r14,%rdi
call   1090 <ar_open@plt>
cmp    $0xffffffff,%eax
je     1399 <main+0x199>
mov    %eax,%r15d
mov    %r14,(%rsp)
add    $0xffffffff,%ebp
lea    0xdd5(%rip),%r14
jmp    1325 <main+0x125>
mov    %r15d,%edi
call   1050 <ar_print_verbose@plt>
cs nopw 0x0(%rax,%rax,1)
nop
cmp    %r13d,(%rbx)
jge    138d <main+0x18d>
cmp    $0x5,%ebp
ja     1320 <main+0x120>
movslq (%r14,%rbp,4),%rax
add    %r14,%rax
jmp    *%rax
mov    %r15d,%edi
mov    (%rsp),%rsi
call   10a0 <append_all@plt>
jmp    1320 <main+0x120>
movslq (%rbx),%rax
lea    0x1(%rax),%ecx
mov    %ecx,(%rbx)
mov    (%r12,%rax,8),%rsi
mov    %r15d,%edi
call   10e0 <ar_append@plt>
jmp    1320 <main+0x120>
mov    %r15d,%edi
call   1040 <ar_print_concise@plt>
jmp    1320 <main+0x120>
movslq (%rbx),%rax
lea    0x1(%rax),%ecx
mov    %ecx,(%rbx)
mov    (%r12,%rax,8),%rsi
mov    %r15d,%edi
call   10b0 <ar_remove@plt>
jmp    1320 <main+0x120>
movslq (%rbx),%rax
lea    0x1(%rax),%ecx
mov    %ecx,(%rbx)
mov    (%r12,%rax,8),%rsi
mov    %r15d,%edi
call   1060 <ar_extract@plt>
jmp    1320 <main+0x120>
mov    %r15d,%edi
call   1110 <ar_close@plt>
xor    %eax,%eax
jmp    13b3 <main+0x1b3>
mov    0x2c38(%rip),%rax
mov    (%rax),%edi
lea    0xd56(%rip),%rsi
call   1080 <fprintf@plt>
mov    $0xffffffff,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %edi,%edi
call   10f0 <perror@plt>
xor    %edi,%edi
call   1120 <exit@plt>

LLVM IR (-O0):
@.str = [7 x i8] c"Adqtvx\00"
@optind = global i32 0
@stderr = global i32 0
@.str.1 = [29 x i8] c"Could not open archive file\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %6
store i32 0, i32* %7
br label %10
10: ; preds = %54, %2
%11 = load i32, i32* %4
%12 = load i8**, i8*** %5
%13 = call i32 @getopt(i32 %11, i8** %12, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store i32 %13, i32* %8
%14 = icmp ne i32 %13, -1
br i1 %14, label %15, label %55
15: ; preds = %10
%16 = load i32, i32* %8
switch i32 %16, label %53 [
i32 65, label %17
i32 100, label %23
i32 113, label %29
i32 116, label %35
i32 118, label %41
i32 120, label %47
]
17: ; preds = %15
%18 = load i32, i32* %7
%19 = icmp ne i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = call i32 (...) @usage()
br label %22
22: ; preds = %20, %17
store i32 1, i32* %7
br label %54
23: ; preds = %15
%24 = load i32, i32* %7
%25 = icmp ne i32 %24, 0
br i1 %25, label %26, label %28
26: ; preds = %23
%27 = call i32 (...) @usage()
br label %28
28: ; preds = %26, %23
store i32 2, i32* %7
br label %54
29: ; preds = %15
%30 = load i32, i32* %7
%31 = icmp ne i32 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %29
%33 = call i32 (...) @usage()
br label %34
34: ; preds = %32, %29
store i32 3, i32* %7
br label %54
35: ; preds = %15
%36 = load i32, i32* %7
%37 = icmp ne i32 %36, 0
br i1 %37, label %38, label %40
38: ; preds = %35
%39 = call i32 (...) @usage()
br label %40
40: ; preds = %38, %35
store i32 4, i32* %7
br label %54
41: ; preds = %15
%42 = load i32, i32* %7
%43 = icmp ne i32 %42, 0
br i1 %43, label %44, label %46
44: ; preds = %41
%45 = call i32 (...) @usage()
br label %46
46: ; preds = %44, %41
store i32 5, i32* %7
br label %54
47: ; preds = %15
%48 = load i32, i32* %7
%49 = icmp ne i32 %48, 0
br i1 %49, label %50, label %52
50: ; preds = %47
%51 = call i32 (...) @usage()
br label %52
52: ; preds = %50, %47
store i32 6, i32* %7
br label %54
53: ; preds = %15
br label %54
54: ; preds = %53, %52, %46, %40, %34, %28, %22
br label %10
55: ; preds = %10
%56 = load i32, i32* %7
%57 = icmp eq i32 %56, 0
br i1 %57, label %58, label %60
58: ; preds = %55
%59 = call i32 (...) @usage()
br label %60
60: ; preds = %58, %55
%61 = load i32, i32* @optind
%62 = load i32, i32* %4
%63 = icmp slt i32 %61, %62
br i1 %63, label %64, label %91
64: ; preds = %60
%65 = load i8**, i8*** %5
%66 = load i32, i32* @optind
%67 = sext i32 %66 to i64
%68 = getelementptr inbounds i8*, i8** %65, i64 %67
%69 = load i8*, i8** %68
%70 = call i32 @strlen(i8* %69)
%71 = add nsw i32 %70, 1
%72 = sext i32 %71 to i64
%73 = mul i64 %72, 1
%74 = trunc i64 %73 to i32
%75 = call i64 @malloc(i32 %74)
%76 = inttoptr i64 %75 to i8*
store i8* %76, i8** %6
%77 = load i8*, i8** %6
%78 = icmp eq i8* %77, null
br i1 %78, label %79, label %82
79: ; preds = %64
%80 = call i32 @perror(i32* null)
%81 = call i32 @exit(i32 0)
unreachable
82: ; preds = %64
%83 = load i8*, i8** %6
%84 = load i8**, i8*** %5
%85 = load i32, i32* @optind
%86 = add nsw i32 %85, 1
store i32 %86, i32* @optind
%87 = sext i32 %85 to i64
%88 = getelementptr inbounds i8*, i8** %84, i64 %87
%89 = load i8*, i8** %88
%90 = call i32 @strcpy(i8* %83, i8* %89)
br label %93
91: ; preds = %60
%92 = call i32 (...) @usage()
br label %93
93: ; preds = %91, %82
%94 = load i8*, i8** %6
%95 = call i32 @ar_open(i8* %94)
store i32 %95, i32* %9
%96 = load i32, i32* %9
%97 = icmp eq i32 %96, -1
br i1 %97, label %98, label %101
98: ; preds = %93
%99 = load i32, i32* @stderr
%100 = call i32 @fprintf(i32 %99, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %3
br label %149
101: ; preds = %93
br label %102
102: ; preds = %142, %101
%103 = load i32, i32* %7
switch i32 %103, label %141 [
i32 1, label %104
i32 2, label %108
i32 3, label %117
i32 4, label %126
i32 5, label %129
i32 6, label %132
]
104: ; preds = %102
%105 = load i32, i32* %9
%106 = load i8*, i8** %6
%107 = call i32 @append_all(i32 %105, i8* %106)
br label %141
108: ; preds = %102
%109 = load i32, i32* %9
%110 = load i8**, i8*** %5
%111 = load i32, i32* @optind
%112 = add nsw i32 %111, 1
store i32 %112, i32* @optind
%113 = sext i32 %111 to i64
%114 = getelementptr inbounds i8*, i8** %110, i64 %113
%115 = load i8*, i8** %114
%116 = call i32 @ar_remove(i32 %109, i8* %115)
br label %141
117: ; preds = %102
%118 = load i32, i32* %9
%119 = load i8**, i8*** %5
%120 = load i32, i32* @optind
%121 = add nsw i32 %120, 1
store i32 %121, i32* @optind
%122 = sext i32 %120 to i64
%123 = getelementptr inbounds i8*, i8** %119, i64 %122
%124 = load i8*, i8** %123
%125 = call i32 @ar_append(i32 %118, i8* %124)
br label %141
126: ; preds = %102
%127 = load i32, i32* %9
%128 = call i32 @ar_print_concise(i32 %127)
br label %141
129: ; preds = %102
%130 = load i32, i32* %9
%131 = call i32 @ar_print_verbose(i32 %130)
br label %141
132: ; preds = %102
%133 = load i32, i32* %9
%134 = load i8**, i8*** %5
%135 = load i32, i32* @optind
%136 = add nsw i32 %135, 1
store i32 %136, i32* @optind
%137 = sext i32 %135 to i64
%138 = getelementptr inbounds i8*, i8** %134, i64 %137
%139 = load i8*, i8** %138
%140 = call i32 @ar_extract(i32 %133, i8* %139)
br label %141
141: ; preds = %102, %132, %129, %126, %117, %108, %104
br label %142
142: ; preds = %141
%143 = load i32, i32* @optind
%144 = load i32, i32* %4
%145 = icmp slt i32 %143, %144
br i1 %145, label %102, label %146
146: ; preds = %142
%147 = load i32, i32* %9
%148 = call i32 @ar_close(i32 %147)
store i32 0, i32* %3
br label %149
149: ; preds = %146, %98
%150 = load i32, i32* %3
ret i32 %150
}

LLVM IR (-O2):
@.str = [7 x i8] c"Adqtvx\00"
@optind = global i32 0
@stderr = global i32 0
@.str.1 = [29 x i8] c"Could not open archive file\0A\00"
define i32 @main(i32 %0, i8** %1) {
br label %3
3: ; preds = %21, %2
%4 = phi i32 [ 0, %2 ], [ %22, %21 ]
%5 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
switch i32 %5, label %21 [
i32 -1, label %23
i32 65, label %6
i32 100, label %8
i32 113, label %10
i32 116, label %12
i32 118, label %14
i32 120, label %16
]
6: ; preds = %3
%7 = icmp eq i32 %4, 0
br i1 %7, label %21, label %18
8: ; preds = %3
%9 = icmp eq i32 %4, 0
br i1 %9, label %21, label %18
10: ; preds = %3
%11 = icmp eq i32 %4, 0
br i1 %11, label %21, label %18
12: ; preds = %3
%13 = icmp eq i32 %4, 0
br i1 %13, label %21, label %18
14: ; preds = %3
%15 = icmp eq i32 %4, 0
br i1 %15, label %21, label %18
16: ; preds = %3
%17 = icmp eq i32 %4, 0
br i1 %17, label %21, label %18
18: ; preds = %16, %14, %12, %10, %8, %6
%19 = phi i32 [ 1, %6 ], [ 2, %8 ], [ 3, %10 ], [ 4, %12 ], [ 5, %14 ], [ 6, %16 ]
%20 = tail call i32 (...) @usage()
br label %21
21: ; preds = %18, %16, %14, %12, %10, %8, %6, %3
%22 = phi i32 [ %4, %3 ], [ 1, %6 ], [ 2, %8 ], [ 3, %10 ], [ 4, %12 ], [ 5, %14 ], [ 6, %16 ], [ %19, %18 ]
br label %3
23: ; preds = %3
%24 = icmp eq i32 %4, 0
br i1 %24, label %25, label %27
25: ; preds = %23
%26 = tail call i32 (...) @usage()
br label %27
27: ; preds = %25, %23
%28 = load i32, i32* @optind
%29 = icmp slt i32 %28, %0
br i1 %29, label %30, label %49
30: ; preds = %27
%31 = sext i32 %28 to i64
%32 = getelementptr inbounds i8*, i8** %1, i64 %31
%33 = load i8*, i8** %32
%34 = tail call i32 @strlen(i8* %33)
%35 = add nsw i32 %34, 1
%36 = tail call i64 @malloc(i32 %35)
%37 = inttoptr i64 %36 to i8*
%38 = icmp eq i64 %36, 0
br i1 %38, label %39, label %42
39: ; preds = %30
%40 = tail call i32 @perror(i32* null)
%41 = tail call i32 @exit(i32 0)
unreachable
42: ; preds = %30
%43 = load i32, i32* @optind
%44 = add nsw i32 %43, 1
store i32 %44, i32* @optind
%45 = sext i32 %43 to i64
%46 = getelementptr inbounds i8*, i8** %1, i64 %45
%47 = load i8*, i8** %46
%48 = tail call i32 @strcpy(i8* %37, i8* %47)
br label %51
49: ; preds = %27
%50 = tail call i32 (...) @usage()
br label %51
51: ; preds = %49, %42
%52 = phi i8* [ %37, %42 ], [ null, %49 ]
%53 = tail call i32 @ar_open(i8* %52)
%54 = icmp eq i32 %53, -1
br i1 %54, label %55, label %58
55: ; preds = %51
%56 = load i32, i32* @stderr
%57 = tail call i32 @fprintf(i32 %56, i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0))
br label %91
58: ; preds = %51, %86
switch i32 %4, label %86 [
i32 1, label %59
i32 2, label %61
i32 3, label %68
i32 4, label %75
i32 5, label %77
i32 6, label %79
]
59: ; preds = %58
%60 = tail call i32 @append_all(i32 %53, i8* %52)
br label %86
61: ; preds = %58
%62 = load i32, i32* @optind
%63 = add nsw i32 %62, 1
store i32 %63, i32* @optind
%64 = sext i32 %62 to i64
%65 = getelementptr inbounds i8*, i8** %1, i64 %64
%66 = load i8*, i8** %65
%67 = tail call i32 @ar_remove(i32 %53, i8* %66)
br label %86
68: ; preds = %58
%69 = load i32, i32* @optind
%70 = add nsw i32 %69, 1
store i32 %70, i32* @optind
%71 = sext i32 %69 to i64
%72 = getelementptr inbounds i8*, i8** %1, i64 %71
%73 = load i8*, i8** %72
%74 = tail call i32 @ar_append(i32 %53, i8* %73)
br label %86
75: ; preds = %58
%76 = tail call i32 @ar_print_concise(i32 %53)
br label %86
77: ; preds = %58
%78 = tail call i32 @ar_print_verbose(i32 %53)
br label %86
79: ; preds = %58
%80 = load i32, i32* @optind
%81 = add nsw i32 %80, 1
store i32 %81, i32* @optind
%82 = sext i32 %80 to i64
%83 = getelementptr inbounds i8*, i8** %1, i64 %82
%84 = load i8*, i8** %83
%85 = tail call i32 @ar_extract(i32 %53, i8* %84)
br label %86
86: ; preds = %59, %61, %68, %75, %77, %79, %58
%87 = load i32, i32* @optind
%88 = icmp slt i32 %87, %0
br i1 %88, label %58, label %89
89: ; preds = %86
%90 = tail call i32 @ar_close(i32 %53)
br label %91
91: ; preds = %89, %55
%92 = phi i32 [ -1, %55 ], [ 0, %89 ]
ret i32 %92
}