#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 O_RDONLY;
int O_WRONLY;
int /*<<< orphan*/ abort();
int /*<<< orphan*/ close(int);
int /*<<< orphan*/ exit(int);
int getopt(int, char **, char *);
int open(char *, int);
scalar_t__ opterr;
int optind;
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ show_help();
int main(int argc, char **argv) {
  if (argc == 1) {
    printf("argc = %d\n", argc);
    show_help();
    exit(1);
  }
  if (argc > 4) {
    printf("argc = %d\n", argc);
    printf("Error: too many arguments passed to the program.\n");
    printf("Use 'copy -h' for help\n");
    exit(1);
  }
  printf("argc = %d\n", argc);
  int mflag = 0;
  char *old_fname = NULL;
  char *new_fname = NULL;
  int index, i;
  int c;
  opterr = 0;
  while ((c = getopt(argc, argv, "hm")) != -1) {
    switch (c) {
    case 'h':
      show_help();
      exit(0);
      break;
    case 'm':
      mflag = 1;
      break;
    case '?':
      printf("Error: inappropriate argument passed\n");
      printf("Use 'copy -h' for help\n");
      return 1;
    default:
      abort();
    }
  }
  printf("optind before read = %d\n", optind);
  printf("argv[optind] = %s\n", argv[optind]);
  old_fname = argv[optind++];
  new_fname = argv[optind++];
  printf("optind after read = %d\n", optind);
  if (old_fname == NULL || new_fname == NULL) {
    printf("Error: to few arguments.\n");
    exit(1);
  }
  if (optind < argc) {
    printf("Too many arguments. The rest args will be dropped out.\n");
    printf("Trying to execute...\n");
  }
  int src_file = open(old_fname, O_RDONLY);
  int dest_file = open(new_fname, O_WRONLY | O_WRONLY);
  close(src_file);
  close(dest_file);
  printf("Printf of example:\nmflag = %d, old_fname = %s\n", mflag, old_fname);
  for (index = optind; index < argc; index++)
    printf("Non-option argument %s\n", argv[index]);
  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)
cmpl   $0x1,-0x8(%rbp)
jne    11b2 <main+0x42>
mov    -0x8(%rbp),%esi
lea    0xe66(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1060 <show_help@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
cmpl   $0x4,-0x8(%rbp)
jle    11f3 <main+0x83>
mov    -0x8(%rbp),%esi
lea    0xe3a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe37(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    -0x8(%rbp),%esi
lea    0xe03(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
mov    0x2dae(%rip),%rax
movq   $0x0,(%rax)
mov    -0x8(%rbp),%edi
mov    -0x10(%rbp),%rsi
lea    0xe1e(%rip),%rdx
call   1080 <getopt@plt>
mov    %eax,-0x34(%rbp)
cmp    $0xffffffff,%eax
je     12cc <main+0x15c>
mov    -0x34(%rbp),%eax
mov    %eax,-0x40(%rbp)
sub    $0x3f,%eax
je     1298 <main+0x128>
jmp    125c <main+0xec>
mov    -0x40(%rbp),%eax
sub    $0x68,%eax
je     127e <main+0x10e>
jmp    126d <main+0xfd>
mov    -0x40(%rbp),%eax
sub    $0x6d,%eax
je     128c <main+0x11c>
jmp    12c0 <main+0x150>
mov    $0x0,%al
call   1060 <show_help@plt>
xor    %edi,%edi
call   1090 <exit@plt>
movl   $0x1,-0x14(%rbp)
jmp    12c7 <main+0x157>
lea    0xdb9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd90(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1461 <main+0x2f1>
mov    $0x0,%al
call   1030 <abort@plt>
jmp    1229 <main+0xb9>
mov    0x2d0d(%rip),%rax
mov    (%rax),%esi
lea    0xda2(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x2cf2(%rip),%rcx
movslq (%rcx),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xd9b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x2cd2(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    0x2cc4(%rip),%rdx
mov    %esi,(%rdx)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x2cac(%rip),%rcx
mov    (%rcx),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    0x2c9e(%rip),%rdx
mov    %esi,(%rdx)
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rax
mov    %rax,-0x28(%rbp)
mov    0x2c8a(%rip),%rax
mov    (%rax),%esi
lea    0xd4b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
cmpq   $0x0,-0x20(%rbp)
je     137c <main+0x20c>
cmpq   $0x0,-0x28(%rbp)
jne    1394 <main+0x224>
lea    0xd3f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1090 <exit@plt>
mov    0x2c45(%rip),%rax
mov    (%rax),%eax
cmp    -0x8(%rbp),%eax
jge    13c2 <main+0x252>
lea    0xd2f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd59(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%rdi
mov    0x2c1b(%rip),%rax
mov    (%rax),%esi
call   1070 <open@plt>
mov    %eax,-0x38(%rbp)
mov    -0x28(%rbp),%rdi
mov    0x2bde(%rip),%rax
mov    (%rax),%esi
mov    0x2bd5(%rip),%rax
or     (%rax),%esi
call   1070 <open@plt>
mov    %eax,-0x3c(%rbp)
mov    -0x38(%rbp),%edi
call   1050 <close@plt>
mov    -0x3c(%rbp),%edi
call   1050 <close@plt>
mov    -0x14(%rbp),%esi
mov    -0x20(%rbp),%rdx
lea    0xd17(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    0x2bbf(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    145a <main+0x2ea>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rsi
lea    0xd14(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1426 <main+0x2b6>
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
cmp    $0x1,%edi
je     1353 <main+0x1d3>
mov    %rsi,%r14
mov    %edi,%r13d
lea    0xe5f(%rip),%rdi
xor    %ebp,%ebp
mov    %r13d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
cmp    $0x5,%r13d
jge    1377 <main+0x1f7>
mov    0x2e12(%rip),%rax
movq   $0x0,(%rax)
lea    0xe3f(%rip),%rbx
nopl   0x0(%rax)
mov    %ebp,%r15d
mov    %r13d,%edi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1090 <getopt@plt>
mov    $0x1,%ebp
cmp    $0x6d,%eax
je     11d0 <main+0x50>
cmp    $0xffffffff,%eax
je     121c <main+0x9c>
cmp    $0x3f,%eax
jne    1339 <main+0x1b9>
lea    0xefe(%rip),%rdi
call   1040 <puts@plt>
lea    0xf48(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%r12d
jmp    1327 <main+0x1a7>
mov    0x2dbd(%rip),%rbx
mov    (%rbx),%esi
lea    0xde2(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movslq (%rbx),%rax
mov    (%r14,%rax,8),%rsi
lea    0xde6(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movslq (%rbx),%rax
mov    (%r14,%rax,8),%rbp
lea    0x2(%rax),%esi
mov    %esi,(%rbx)
mov    0x8(%r14,%rax,8),%r12
lea    0xdda(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
test   %rbp,%rbp
je     138c <main+0x20c>
test   %r12,%r12
je     138c <main+0x20c>
cmp    %r13d,(%rbx)
jge    1296 <main+0x116>
lea    0xe14(%rip),%rdi
call   1040 <puts@plt>
lea    0xe3f(%rip),%rdi
call   1040 <puts@plt>
mov    0x2d4b(%rip),%rax
mov    (%rax),%esi
mov    %rbp,%rdi
call   1080 <open@plt>
mov    %rbp,(%rsp)
mov    %eax,%ebp
mov    0x2d0c(%rip),%rax
mov    (%rax),%esi
mov    %r12,%rdi
call   1080 <open@plt>
mov    %eax,%ebx
mov    %ebp,%edi
call   1060 <close@plt>
mov    %ebx,%edi
call   1060 <close@plt>
lea    0xd7d(%rip),%rdi
xor    %r12d,%r12d
mov    %r15d,%esi
mov    (%rsp),%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    0x2cf3(%rip),%rax
movslq (%rax),%rax
cmp    %r13d,%eax
jge    1327 <main+0x1a7>
lea    (%r14,%rax,8),%rbx
sub    %eax,%r13d
xor    %r12d,%r12d
lea    0xd7b(%rip),%r14
xor    %ebp,%ebp
nopl   0x0(%rax,%rax,1)
mov    (%rbx,%rbp,8),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%rbp
cmp    %ebp,%r13d
jne    1310 <main+0x190>
mov    %r12d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
cmp    $0x68,%eax
jne    134c <main+0x1cc>
xor    %eax,%eax
call   1070 <show_help@plt>
xor    %edi,%edi
call   10a0 <exit@plt>
xor    %eax,%eax
call   1030 <abort@plt>
lea    0xca6(%rip),%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
call   1070 <show_help@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>
lea    0xda5(%rip),%rdi
call   1040 <puts@plt>
lea    0xdca(%rip),%rdi
jmp    1393 <main+0x213>
lea    0xd52(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   10a0 <exit@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"argc = %d\0A\00"
@.str.1 = [50 x i8] c"Error: too many arguments passed to the program.\0A\00"
@.str.2 = [24 x i8] c"Use 'copy -h' for help\0A\00"
@opterr = global i64 0
@.str.3 = [3 x i8] c"hm\00"
@.str.4 = [38 x i8] c"Error: inappropriate argument passed\0A\00"
@.str.5 = [25 x i8] c"optind before read = %d\0A\00"
@optind = global i32 0
@.str.6 = [19 x i8] c"argv[optind] = %s\0A\00"
@.str.7 = [24 x i8] c"optind after read = %d\0A\00"
@.str.8 = [26 x i8] c"Error: to few arguments.\0A\00"
@.str.9 = [56 x i8] c"Too many arguments. The rest args will be dropped out.\0A\00"
@.str.10 = [22 x i8] c"Trying to execute...\0A\00"
@O_RDONLY = global i32 0
@O_WRONLY = global i32 0
@.str.11 = [47 x i8] c"Printf of example:\0Amflag = %d, old_fname = %s\0A\00"
@.str.12 = [24 x i8] c"Non-option argument %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%14 = load i32, i32* %4
%15 = icmp eq i32 %14, 1
br i1 %15, label %16, label %21
16: ; preds = %2
%17 = load i32, i32* %4
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %17)
%19 = call i32 (...) @show_help()
%20 = call i32 @exit(i32 1)
unreachable
21: ; preds = %2
%22 = load i32, i32* %4
%23 = icmp sgt i32 %22, 4
br i1 %23, label %24, label %30
24: ; preds = %21
%25 = load i32, i32* %4
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %25)
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.1, i64 0, i64 0))
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%29 = call i32 @exit(i32 1)
unreachable
30: ; preds = %21
%31 = load i32, i32* %4
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %31)
store i32 0, i32* %6
store i8* null, i8** %7
store i8* null, i8** %8
store i64 0, i64* @opterr
br label %33
33: ; preds = %49, %30
%34 = load i32, i32* %4
%35 = load i8**, i8*** %5
%36 = call i32 @getopt(i32 %34, i8** %35, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
store i32 %36, i32* %11
%37 = icmp ne i32 %36, -1
br i1 %37, label %38, label %50
38: ; preds = %33
%39 = load i32, i32* %11
switch i32 %39, label %47 [
i32 104, label %40
i32 109, label %43
i32 63, label %44
]
40: ; preds = %38
%41 = call i32 (...) @show_help()
%42 = call i32 @exit(i32 0)
unreachable
43: ; preds = %38
store i32 1, i32* %6
br label %49
44: ; preds = %38
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0))
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %3
br label %120
47: ; preds = %38
%48 = call i32 (...) @abort()
unreachable
49: ; preds = %43
br label %33
50: ; preds = %33
%51 = load i32, i32* @optind
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i32 %51)
%53 = load i8**, i8*** %5
%54 = load i32, i32* @optind
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds i8*, i8** %53, i64 %55
%57 = load i8*, i8** %56
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i8* %57)
%59 = load i8**, i8*** %5
%60 = load i32, i32* @optind
%61 = add nsw i32 %60, 1
store i32 %61, i32* @optind
%62 = sext i32 %60 to i64
%63 = getelementptr inbounds i8*, i8** %59, i64 %62
%64 = load i8*, i8** %63
store i8* %64, i8** %7
%65 = load i8**, i8*** %5
%66 = load i32, i32* @optind
%67 = add nsw i32 %66, 1
store i32 %67, i32* @optind
%68 = sext i32 %66 to i64
%69 = getelementptr inbounds i8*, i8** %65, i64 %68
%70 = load i8*, i8** %69
store i8* %70, i8** %8
%71 = load i32, i32* @optind
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0), i32 %71)
%73 = load i8*, i8** %7
%74 = icmp eq i8* %73, null
br i1 %74, label %78, label %75
75: ; preds = %50
%76 = load i8*, i8** %8
%77 = icmp eq i8* %76, null
br i1 %77, label %78, label %81
78: ; preds = %75, %50
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.8, i64 0, i64 0))
%80 = call i32 @exit(i32 1)
unreachable
81: ; preds = %75
%82 = load i32, i32* @optind
%83 = load i32, i32* %4
%84 = icmp slt i32 %82, %83
br i1 %84, label %85, label %88
85: ; preds = %81
%86 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str.9, i64 0, i64 0))
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.10, i64 0, i64 0))
br label %88
88: ; preds = %85, %81
%89 = load i8*, i8** %7
%90 = load i32, i32* @O_RDONLY
%91 = call i32 @open(i8* %89, i32 %90)
store i32 %91, i32* %12
%92 = load i8*, i8** %8
%93 = load i32, i32* @O_WRONLY
%94 = load i32, i32* @O_WRONLY
%95 = or i32 %93, %94
%96 = call i32 @open(i8* %92, i32 %95)
store i32 %96, i32* %13
%97 = load i32, i32* %12
%98 = call i32 @close(i32 %97)
%99 = load i32, i32* %13
%100 = call i32 @close(i32 %99)
%101 = load i32, i32* %6
%102 = load i8*, i8** %7
%103 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.11, i64 0, i64 0), i32 %101, i8* %102)
%104 = load i32, i32* @optind
store i32 %104, i32* %9
br label %105
105: ; preds = %116, %88
%106 = load i32, i32* %9
%107 = load i32, i32* %4
%108 = icmp slt i32 %106, %107
br i1 %108, label %109, label %119
109: ; preds = %105
%110 = load i8**, i8*** %5
%111 = load i32, i32* %9
%112 = sext i32 %111 to i64
%113 = getelementptr inbounds i8*, i8** %110, i64 %112
%114 = load i8*, i8** %113
%115 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.12, i64 0, i64 0), i8* %114)
br label %116
116: ; preds = %109
%117 = load i32, i32* %9
%118 = add nsw i32 %117, 1
store i32 %118, i32* %9
br label %105
119: ; preds = %105
store i32 0, i32* %3
br label %120
120: ; preds = %119, %44
%121 = load i32, i32* %3
ret i32 %121
}

LLVM IR (-O2):
@.str = [11 x i8] c"argc = %d\0A\00"
@opterr = global i64 0
@.str.3 = [3 x i8] c"hm\00"
@.str.5 = [25 x i8] c"optind before read = %d\0A\00"
@optind = global i32 0
@.str.6 = [19 x i8] c"argv[optind] = %s\0A\00"
@.str.7 = [24 x i8] c"optind after read = %d\0A\00"
@O_RDONLY = global i32 0
@O_WRONLY = global i32 0
@.str.11 = [47 x i8] c"Printf of example:\0Amflag = %d, old_fname = %s\0A\00"
@.str.12 = [24 x i8] c"Non-option argument %s\0A\00"
@str = [55 x i8] c"Too many arguments. The rest args will be dropped out.\00"
@str.13 = [21 x i8] c"Trying to execute...\00"
@str.14 = [25 x i8] c"Error: to few arguments.\00"
@str.15 = [37 x i8] c"Error: inappropriate argument passed\00"
@str.17 = [49 x i8] c"Error: too many arguments passed to the program.\00"
@str.18 = [23 x i8] c"Use 'copy -h' for help\00"
define i32 @main(i32 %0, i8** %1) {
%3 = icmp eq i32 %0, 1
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 1)
%6 = tail call i32 (...) @show_help()
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %2
%9 = icmp sgt i32 %0, 4
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %0)
br i1 %9, label %11, label %15
11: ; preds = %8
%12 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([49 x i8], [49 x i8]* @str.17, i64 0, i64 0))
%13 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.18, i64 0, i64 0))
%14 = tail call i32 @exit(i32 1)
unreachable
15: ; preds = %8
store i64 0, i64* @opterr
br label %16
16: ; preds = %16, %15
%17 = phi i32 [ 0, %15 ], [ 1, %16 ]
%18 = tail call i32 @getopt(i32 %0, i8** %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
switch i32 %18, label %25 [
i32 -1, label %27
i32 104, label %19
i32 109, label %16
i32 63, label %22
]
19: ; preds = %16
%20 = tail call i32 (...) @show_help()
%21 = tail call i32 @exit(i32 0)
unreachable
22: ; preds = %16
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.15, i64 0, i64 0))
%24 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @str.18, i64 0, i64 0))
br label %77
25: ; preds = %16
%26 = tail call i32 (...) @abort()
unreachable
27: ; preds = %16
%28 = load i32, i32* @optind
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i32 %28)
%30 = load i32, i32* @optind
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8*, i8** %1, i64 %31
%33 = load i8*, i8** %32
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.6, i64 0, i64 0), i8* %33)
%35 = load i32, i32* @optind
%36 = add nsw i32 %35, 1
%37 = sext i32 %35 to i64
%38 = getelementptr inbounds i8*, i8** %1, i64 %37
%39 = load i8*, i8** %38
%40 = add nsw i32 %35, 2
store i32 %40, i32* @optind
%41 = sext i32 %36 to i64
%42 = getelementptr inbounds i8*, i8** %1, i64 %41
%43 = load i8*, i8** %42
%44 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0), i32 %40)
%45 = icmp eq i8* %39, null
%46 = icmp eq i8* %43, null
%47 = select i1 %45, i1 true, i1 %46
br i1 %47, label %48, label %51
48: ; preds = %27
%49 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @str.14, i64 0, i64 0))
%50 = tail call i32 @exit(i32 1)
unreachable
51: ; preds = %27
%52 = load i32, i32* @optind
%53 = icmp slt i32 %52, %0
br i1 %53, label %54, label %57
54: ; preds = %51
%55 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @str, i64 0, i64 0))
%56 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.13, i64 0, i64 0))
br label %57
57: ; preds = %54, %51
%58 = load i32, i32* @O_RDONLY
%59 = tail call i32 @open(i8* %39, i32 %58)
%60 = load i32, i32* @O_WRONLY
%61 = tail call i32 @open(i8* %43, i32 %60)
%62 = tail call i32 @close(i32 %59)
%63 = tail call i32 @close(i32 %61)
%64 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([47 x i8], [47 x i8]* @.str.11, i64 0, i64 0), i32 %17, i8* %39)
%65 = load i32, i32* @optind
%66 = icmp slt i32 %65, %0
br i1 %66, label %67, label %77
67: ; preds = %57
%68 = sext i32 %65 to i64
br label %69
69: ; preds = %67, %69
%70 = phi i64 [ %68, %67 ], [ %74, %69 ]
%71 = getelementptr inbounds i8*, i8** %1, i64 %70
%72 = load i8*, i8** %71
%73 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.12, i64 0, i64 0), i8* %72)
%74 = add nsw i64 %70, 1
%75 = trunc i64 %74 to i32
%76 = icmp eq i32 %75, %0
br i1 %76, label %77, label %69
77: ; preds = %69, %57, %22
%78 = phi i32 [ 1, %22 ], [ 0, %57 ], [ 0, %69 ]
ret i32 %78
}