#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 */
scalar_t__ EOF;
scalar_t__ fclose(int /*<<< orphan*/ *);
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, ...);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ *stdin;
scalar_t__ strcmp(char *, char *);
long strtol(char *, char **, int);
int process_arguments(int argc, char *argv[], long *number, FILE **file) {
  if (argc > 4 || argc < 1) {
    fprintf(stderr, "[ERR] Chybny pocet argumentov\n");
    return -1;
  } else if (argc == 1) {
    return argc;
  } else if (argc == 2) {
    *file = fopen(argv[1], "r");
    if (*file == NULL) {
      if ((strcmp(argv[1], "-n") == 0))
        fprintf(stderr,
                "[ERR] Parameter -n vyzaduje dalsi parameter [cislo >=0]\n");
      else
        fprintf(stderr, "[ERR] Nepodarilo sa otvorit subor %s \n", argv[1]);
      return -1;
    }
    return argc;
  } else if (argc == 3) {
    char *ptr = NULL;
    *number = strtol(argv[2], &ptr, 10);
    if (strcmp(argv[1], "-n") == 0 && *ptr == '\0' && *number >= 0)
      return argc;
    else {
      fprintf(stderr, "[ERR] Chybne argumenty [%s %s] \n", argv[1], argv[2]);
      return -1;
    }
  } else {
    *file = fopen(argv[3], "r");
    if (*file == NULL) {
      fprintf(stderr, "[ERR] Nepodarilo sa otvorit subor %s\n", argv[3]);
      return -1;
    }
    char *ptr = NULL;
    *number = strtol(argv[2], &ptr, 10);
    if (strcmp(argv[1], "-n") == 0 && *ptr == '\0' && *number >= 0)
      return argc;
    else {
      if (*file != stdin && fclose(*file) == EOF)
        fprintf(stderr, "[WARNING] Nepodarilo sa zatvorit subor %s\n", argv[3]);
      fprintf(stderr, "[ERR] Chybne argumenty [%s %s %s] \n", argv[1], argv[2],
              argv[3]);
      return -1;
    }
  }
}


x86 assembly (clang, -O0):
<process_arguments>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpl   $0x4,-0x8(%rbp)
jg     117b <process_arguments+0x2b>
cmpl   $0x1,-0x8(%rbp)
jge    119e <process_arguments+0x4e>
mov    0x2e4e(%rip),%rax
mov    (%rax),%edi
lea    0xe75(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1453 <process_arguments+0x303>
cmpl   $0x1,-0x8(%rbp)
jne    11b3 <process_arguments+0x63>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1453 <process_arguments+0x303>
cmpl   $0x2,-0x8(%rbp)
jne    1259 <process_arguments+0x109>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe53(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
cmpq   $0x0,(%rax)
jne    124e <process_arguments+0xfe>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe29(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1223 <process_arguments+0xd3>
mov    0x2dc2(%rip),%rax
mov    (%rax),%edi
lea    0xe0d(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
jmp    1242 <process_arguments+0xf2>
mov    0x2da6(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
lea    0xe22(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1453 <process_arguments+0x303>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1453 <process_arguments+0x303>
cmpl   $0x3,-0x8(%rbp)
jne    1305 <process_arguments+0x1b5>
movq   $0x0,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    -0x28(%rbp),%rsi
mov    $0xa,%edx
call   1060 <strtol@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd87(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    12d2 <process_arguments+0x182>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    12d2 <process_arguments+0x182>
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
jl     12d2 <process_arguments+0x182>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1453 <process_arguments+0x303>
mov    0x2cf7(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rcx
lea    0xd92(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1453 <process_arguments+0x303>
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdi
lea    0xd0b(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
cmpq   $0x0,(%rax)
jne    135c <process_arguments+0x20c>
mov    0x2c98(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdx
lea    0xd5c(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1453 <process_arguments+0x303>
movq   $0x0,-0x30(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    -0x30(%rbp),%rsi
mov    $0xa,%edx
call   1060 <strtol@plt>
mov    %rax,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xc8e(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    13cb <process_arguments+0x27b>
mov    -0x30(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    13cb <process_arguments+0x27b>
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
jl     13cb <process_arguments+0x27b>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1453 <process_arguments+0x303>
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    0x2c0f(%rip),%rcx
cmp    (%rcx),%rax
je     141d <process_arguments+0x2cd>
mov    -0x20(%rbp),%rax
mov    (%rax),%rdi
call   1030 <fclose@plt>
mov    0x2beb(%rip),%rcx
cmp    (%rcx),%rax
jne    141d <process_arguments+0x2cd>
mov    0x2bcb(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rdx
lea    0xcb5(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
mov    0x2bac(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdx
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rcx
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%r8
lea    0xcb1(%rip),%rsi
mov    $0x0,%al
call   1050 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<process_arguments>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rcx,%rbx
mov    %edi,%eax
lea    -0x5(%rax),%ecx
cmp    $0xfffffffb,%ecx
ja     118c <process_arguments+0x3c>
mov    0x2e63(%rip),%rax
mov    (%rax),%edi
lea    0xe8a(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    $0xffffffff,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
cmp    $0x1,%eax
je     1182 <process_arguments+0x32>
mov    %rdx,%r14
mov    %rsi,%r15
cmp    $0x3,%eax
je     11f7 <process_arguments+0xa7>
cmp    $0x2,%eax
jne    125d <process_arguments+0x10d>
mov    0x8(%r15),%rdi
lea    0xe6f(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,%rcx
mov    %rax,(%rbx)
mov    $0x2,%eax
test   %rcx,%rcx
jne    1182 <process_arguments+0x32>
mov    0x8(%r15),%rdi
lea    0xe51(%rip),%rsi
call   1040 <strcmp@plt>
mov    0x2df4(%rip),%rcx
mov    (%rcx),%edi
test   %rax,%rax
je     1349 <process_arguments+0x1f9>
mov    0x8(%r15),%rdx
lea    0xe6b(%rip),%rsi
jmp    133d <process_arguments+0x1ed>
movq   $0x0,0x8(%rsp)
mov    0x10(%r15),%rdi
lea    0x8(%rsp),%rsi
mov    $0xa,%edx
call   1060 <strtol@plt>
mov    %rax,(%r14)
mov    0x8(%r15),%rdi
lea    0xe00(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    1239 <process_arguments+0xe9>
mov    0x8(%rsp),%rax
cmpb   $0x0,(%rax)
je     1355 <process_arguments+0x205>
mov    0x2d90(%rip),%rax
mov    (%rax),%edi
mov    0x8(%r15),%rdx
mov    0x10(%r15),%rcx
lea    0xe33(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    117d <process_arguments+0x2d>
mov    0x18(%r15),%rdi
lea    0xdb7(%rip),%rsi
call   1070 <fopen@plt>
mov    %rax,(%rbx)
test   %rax,%rax
je     1329 <process_arguments+0x1d9>
movq   $0x0,0x8(%rsp)
mov    0x10(%r15),%rdi
lea    0x8(%rsp),%rsi
mov    $0xa,%edx
call   1060 <strtol@plt>
mov    %rax,(%r14)
mov    0x8(%r15),%rdi
lea    0xd7e(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    12c6 <process_arguments+0x176>
mov    0x8(%rsp),%rax
cmpb   $0x0,(%rax)
jne    12c6 <process_arguments+0x176>
mov    $0x4,%eax
cmpq   $0x0,(%r14)
jns    1182 <process_arguments+0x32>
mov    (%rbx),%rdi
mov    0x2d18(%rip),%rax
cmp    (%rax),%rdi
je     1301 <process_arguments+0x1b1>
call   1030 <fclose@plt>
mov    0x2cff(%rip),%rcx
cmp    (%rcx),%rax
jne    1301 <process_arguments+0x1b1>
mov    0x2ce3(%rip),%rax
mov    (%rax),%edi
mov    0x18(%r15),%rdx
lea    0xdd1(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
mov    0x2cc8(%rip),%rax
mov    (%rax),%edi
mov    0x8(%r15),%rdx
mov    0x10(%r15),%rcx
mov    0x18(%r15),%r8
lea    0xdd9(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    117d <process_arguments+0x2d>
mov    0x2ca0(%rip),%rax
mov    (%rax),%edi
mov    0x18(%r15),%rdx
lea    0xd68(%rip),%rsi
xor    %eax,%eax
call   1050 <fprintf@plt>
jmp    117d <process_arguments+0x2d>
lea    0xcd4(%rip),%rsi
jmp    1176 <process_arguments+0x26>
mov    $0x3,%eax
cmpq   $0x0,(%r14)
jns    1182 <process_arguments+0x32>
jmp    1239 <process_arguments+0xe9>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [31 x i8] c"[ERR] Chybny pocet argumentov\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c"-n\00"
@.str.3 = [57 x i8] c"[ERR] Parameter -n vyzaduje dalsi parameter [cislo >=0]\0A\00"
@.str.4 = [39 x i8] c"[ERR] Nepodarilo sa otvorit subor %s \0A\00"
@.str.5 = [33 x i8] c"[ERR] Chybne argumenty [%s %s] \0A\00"
@.str.6 = [38 x i8] c"[ERR] Nepodarilo sa otvorit subor %s\0A\00"
@stdin = global i32* null
@EOF = global i64 0
@.str.7 = [43 x i8] c"[WARNING] Nepodarilo sa zatvorit subor %s\0A\00"
@.str.8 = [36 x i8] c"[ERR] Chybne argumenty [%s %s %s] \0A\00"
define i32 @process_arguments(i32 %0, i8** %1, i64* %2, i32** %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8**
%8 = alloca i64*
%9 = alloca i32**
%10 = alloca i8*
%11 = alloca i8*
store i32 %0, i32* %6
store i8** %1, i8*** %7
store i64* %2, i64** %8
store i32** %3, i32*** %9
%12 = load i32, i32* %6
%13 = icmp sgt i32 %12, 4
br i1 %13, label %17, label %14
14: ; preds = %4
%15 = load i32, i32* %6
%16 = icmp slt i32 %15, 1
br i1 %16, label %17, label %20
17: ; preds = %14, %4
%18 = load i32, i32* @stderr
%19 = call i32 (i32, i8*, ...) @fprintf(i32 %18, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %5
br label %155
20: ; preds = %14
%21 = load i32, i32* %6
%22 = icmp eq i32 %21, 1
br i1 %22, label %23, label %25
23: ; preds = %20
%24 = load i32, i32* %6
store i32 %24, i32* %5
br label %155
25: ; preds = %20
%26 = load i32, i32* %6
%27 = icmp eq i32 %26, 2
br i1 %27, label %28, label %55
28: ; preds = %25
%29 = load i8**, i8*** %7
%30 = getelementptr inbounds i8*, i8** %29, i64 1
%31 = load i8*, i8** %30
%32 = call i32* @fopen(i8* %31, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%33 = load i32**, i32*** %9
store i32* %32, i32** %33
%34 = load i32**, i32*** %9
%35 = load i32*, i32** %34
%36 = icmp eq i32* %35, null
br i1 %36, label %37, label %53
37: ; preds = %28
%38 = load i8**, i8*** %7
%39 = getelementptr inbounds i8*, i8** %38, i64 1
%40 = load i8*, i8** %39
%41 = call i64 @strcmp(i8* %40, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%42 = icmp eq i64 %41, 0
br i1 %42, label %43, label %46
43: ; preds = %37
%44 = load i32, i32* @stderr
%45 = call i32 (i32, i8*, ...) @fprintf(i32 %44, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.3, i64 0, i64 0))
br label %52
46: ; preds = %37
%47 = load i32, i32* @stderr
%48 = load i8**, i8*** %7
%49 = getelementptr inbounds i8*, i8** %48, i64 1
%50 = load i8*, i8** %49
%51 = call i32 (i32, i8*, ...) @fprintf(i32 %47, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0), i8* %50)
br label %52
52: ; preds = %46, %43
store i32 -1, i32* %5
br label %155
53: ; preds = %28
%54 = load i32, i32* %6
store i32 %54, i32* %5
br label %155
55: ; preds = %25
%56 = load i32, i32* %6
%57 = icmp eq i32 %56, 3
br i1 %57, label %58, label %89
58: ; preds = %55
store i8* null, i8** %10
%59 = load i8**, i8*** %7
%60 = getelementptr inbounds i8*, i8** %59, i64 2
%61 = load i8*, i8** %60
%62 = call i64 @strtol(i8* %61, i8** %10, i32 10)
%63 = load i64*, i64** %8
store i64 %62, i64* %63
%64 = load i8**, i8*** %7
%65 = getelementptr inbounds i8*, i8** %64, i64 1
%66 = load i8*, i8** %65
%67 = call i64 @strcmp(i8* %66, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%68 = icmp eq i64 %67, 0
br i1 %68, label %69, label %80
69: ; preds = %58
%70 = load i8*, i8** %10
%71 = load i8, i8* %70
%72 = sext i8 %71 to i32
%73 = icmp eq i32 %72, 0
br i1 %73, label %74, label %80
74: ; preds = %69
%75 = load i64*, i64** %8
%76 = load i64, i64* %75
%77 = icmp sge i64 %76, 0
br i1 %77, label %78, label %80
78: ; preds = %74
%79 = load i32, i32* %6
store i32 %79, i32* %5
br label %155
80: ; preds = %74, %69, %58
%81 = load i32, i32* @stderr
%82 = load i8**, i8*** %7
%83 = getelementptr inbounds i8*, i8** %82, i64 1
%84 = load i8*, i8** %83
%85 = load i8**, i8*** %7
%86 = getelementptr inbounds i8*, i8** %85, i64 2
%87 = load i8*, i8** %86
%88 = call i32 (i32, i8*, ...) @fprintf(i32 %81, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), i8* %84, i8* %87)
store i32 -1, i32* %5
br label %155
89: ; preds = %55
%90 = load i8**, i8*** %7
%91 = getelementptr inbounds i8*, i8** %90, i64 3
%92 = load i8*, i8** %91
%93 = call i32* @fopen(i8* %92, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%94 = load i32**, i32*** %9
store i32* %93, i32** %94
%95 = load i32**, i32*** %9
%96 = load i32*, i32** %95
%97 = icmp eq i32* %96, null
br i1 %97, label %98, label %104
98: ; preds = %89
%99 = load i32, i32* @stderr
%100 = load i8**, i8*** %7
%101 = getelementptr inbounds i8*, i8** %100, i64 3
%102 = load i8*, i8** %101
%103 = call i32 (i32, i8*, ...) @fprintf(i32 %99, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.6, i64 0, i64 0), i8* %102)
store i32 -1, i32* %5
br label %155
104: ; preds = %89
store i8* null, i8** %11
%105 = load i8**, i8*** %7
%106 = getelementptr inbounds i8*, i8** %105, i64 2
%107 = load i8*, i8** %106
%108 = call i64 @strtol(i8* %107, i8** %11, i32 10)
%109 = load i64*, i64** %8
store i64 %108, i64* %109
%110 = load i8**, i8*** %7
%111 = getelementptr inbounds i8*, i8** %110, i64 1
%112 = load i8*, i8** %111
%113 = call i64 @strcmp(i8* %112, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%114 = icmp eq i64 %113, 0
br i1 %114, label %115, label %126
115: ; preds = %104
%116 = load i8*, i8** %11
%117 = load i8, i8* %116
%118 = sext i8 %117 to i32
%119 = icmp eq i32 %118, 0
br i1 %119, label %120, label %126
120: ; preds = %115
%121 = load i64*, i64** %8
%122 = load i64, i64* %121
%123 = icmp sge i64 %122, 0
br i1 %123, label %124, label %126
124: ; preds = %120
%125 = load i32, i32* %6
store i32 %125, i32* %5
br label %155
126: ; preds = %120, %115, %104
%127 = load i32**, i32*** %9
%128 = load i32*, i32** %127
%129 = load i32*, i32** @stdin
%130 = icmp ne i32* %128, %129
br i1 %130, label %131, label %143
131: ; preds = %126
%132 = load i32**, i32*** %9
%133 = load i32*, i32** %132
%134 = call i64 @fclose(i32* %133)
%135 = load i64, i64* @EOF
%136 = icmp eq i64 %134, %135
br i1 %136, label %137, label %143
137: ; preds = %131
%138 = load i32, i32* @stderr
%139 = load i8**, i8*** %7
%140 = getelementptr inbounds i8*, i8** %139, i64 3
%141 = load i8*, i8** %140
%142 = call i32 (i32, i8*, ...) @fprintf(i32 %138, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.7, i64 0, i64 0), i8* %141)
br label %143
143: ; preds = %137, %131, %126
%144 = load i32, i32* @stderr
%145 = load i8**, i8*** %7
%146 = getelementptr inbounds i8*, i8** %145, i64 1
%147 = load i8*, i8** %146
%148 = load i8**, i8*** %7
%149 = getelementptr inbounds i8*, i8** %148, i64 2
%150 = load i8*, i8** %149
%151 = load i8**, i8*** %7
%152 = getelementptr inbounds i8*, i8** %151, i64 3
%153 = load i8*, i8** %152
%154 = call i32 (i32, i8*, ...) @fprintf(i32 %144, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.8, i64 0, i64 0), i8* %147, i8* %150, i8* %153)
store i32 -1, i32* %5
br label %155
155: ; preds = %143, %124, %98, %80, %78, %53, %52, %23, %17
%156 = load i32, i32* %5
ret i32 %156
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [31 x i8] c"[ERR] Chybny pocet argumentov\0A\00"
@.str.1 = [2 x i8] c"r\00"
@.str.2 = [3 x i8] c"-n\00"
@.str.3 = [57 x i8] c"[ERR] Parameter -n vyzaduje dalsi parameter [cislo >=0]\0A\00"
@.str.4 = [39 x i8] c"[ERR] Nepodarilo sa otvorit subor %s \0A\00"
@.str.5 = [33 x i8] c"[ERR] Chybne argumenty [%s %s] \0A\00"
@.str.6 = [38 x i8] c"[ERR] Nepodarilo sa otvorit subor %s\0A\00"
@stdin = global i32* null
@EOF = global i64 0
@.str.7 = [43 x i8] c"[WARNING] Nepodarilo sa zatvorit subor %s\0A\00"
@.str.8 = [36 x i8] c"[ERR] Chybne argumenty [%s %s %s] \0A\00"
define i32 @process_arguments(i32 %0, i8** nocapture %1, i64* nocapture %2, i32** nocapture %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = add i32 %0, -5
%8 = icmp ult i32 %7, -4
br i1 %8, label %9, label %12
9: ; preds = %4
%10 = load i32, i32* @stderr
%11 = tail call i32 (i32, i8*, ...) @fprintf(i32 %10, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
br label %96
12: ; preds = %4
switch i32 %0, label %51 [
i32 1, label %96
i32 2, label %13
i32 3, label %28
]
13: ; preds = %12
%14 = getelementptr inbounds i8*, i8** %1, i64 1
%15 = load i8*, i8** %14
%16 = tail call i32* @fopen(i8* %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %16, i32** %3
%17 = icmp eq i32* %16, null
br i1 %17, label %18, label %96
18: ; preds = %13
%19 = load i8*, i8** %14
%20 = tail call i64 @strcmp(i8* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%21 = icmp eq i64 %20, 0
%22 = load i32, i32* @stderr
br i1 %21, label %23, label %25
23: ; preds = %18
%24 = tail call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str.3, i64 0, i64 0))
br label %96
25: ; preds = %18
%26 = load i8*, i8** %14
%27 = tail call i32 (i32, i8*, ...) @fprintf(i32 %22, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0), i8* %26)
br label %96
28: ; preds = %12
%29 = bitcast i8** %5 to i8*
store i8* null, i8** %5
%30 = getelementptr inbounds i8*, i8** %1, i64 2
%31 = load i8*, i8** %30
%32 = call i64 @strtol(i8* %31, i8** %5, i32 10)
store i64 %32, i64* %2
%33 = getelementptr inbounds i8*, i8** %1, i64 1
%34 = load i8*, i8** %33
%35 = tail call i64 @strcmp(i8* %34, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%36 = icmp eq i64 %35, 0
br i1 %36, label %37, label %44
37: ; preds = %28
%38 = load i8*, i8** %5
%39 = load i8, i8* %38
%40 = icmp eq i8 %39, 0
br i1 %40, label %41, label %44
41: ; preds = %37
%42 = load i64, i64* %2
%43 = icmp sgt i64 %42, -1
br i1 %43, label %49, label %44
44: ; preds = %41, %37, %28
%45 = load i32, i32* @stderr
%46 = load i8*, i8** %33
%47 = load i8*, i8** %30
%48 = tail call i32 (i32, i8*, ...) @fprintf(i32 %45, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.5, i64 0, i64 0), i8* %46, i8* %47)
br label %49
49: ; preds = %41, %44
%50 = phi i32 [ -1, %44 ], [ 3, %41 ]
br label %96
51: ; preds = %12
%52 = getelementptr inbounds i8*, i8** %1, i64 3
%53 = load i8*, i8** %52
%54 = tail call i32* @fopen(i8* %53, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32* %54, i32** %3
%55 = icmp eq i32* %54, null
br i1 %55, label %56, label %60
56: ; preds = %51
%57 = load i32, i32* @stderr
%58 = load i8*, i8** %52
%59 = tail call i32 (i32, i8*, ...) @fprintf(i32 %57, i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.6, i64 0, i64 0), i8* %58)
br label %96
60: ; preds = %51
%61 = bitcast i8** %6 to i8*
store i8* null, i8** %6
%62 = getelementptr inbounds i8*, i8** %1, i64 2
%63 = load i8*, i8** %62
%64 = call i64 @strtol(i8* %63, i8** %6, i32 10)
store i64 %64, i64* %2
%65 = getelementptr inbounds i8*, i8** %1, i64 1
%66 = load i8*, i8** %65
%67 = tail call i64 @strcmp(i8* %66, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%68 = icmp eq i64 %67, 0
br i1 %68, label %69, label %76
69: ; preds = %60
%70 = load i8*, i8** %6
%71 = load i8, i8* %70
%72 = icmp eq i8 %71, 0
br i1 %72, label %73, label %76
73: ; preds = %69
%74 = load i64, i64* %2
%75 = icmp sgt i64 %74, -1
br i1 %75, label %94, label %76
76: ; preds = %73, %69, %60
%77 = load i32*, i32** %3
%78 = load i32*, i32** @stdin
%79 = icmp eq i32* %77, %78
br i1 %79, label %88, label %80
80: ; preds = %76
%81 = tail call i64 @fclose(i32* %77)
%82 = load i64, i64* @EOF
%83 = icmp eq i64 %81, %82
br i1 %83, label %84, label %88
84: ; preds = %80
%85 = load i32, i32* @stderr
%86 = load i8*, i8** %52
%87 = tail call i32 (i32, i8*, ...) @fprintf(i32 %85, i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str.7, i64 0, i64 0), i8* %86)
br label %88
88: ; preds = %84, %80, %76
%89 = load i32, i32* @stderr
%90 = load i8*, i8** %65
%91 = load i8*, i8** %62
%92 = load i8*, i8** %52
%93 = tail call i32 (i32, i8*, ...) @fprintf(i32 %89, i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.8, i64 0, i64 0), i8* %90, i8* %91, i8* %92)
br label %94
94: ; preds = %73, %88
%95 = phi i32 [ -1, %88 ], [ 4, %73 ]
br label %96
96: ; preds = %12, %13, %23, %25, %94, %56, %49, %9
%97 = phi i32 [ -1, %9 ], [ %50, %49 ], [ -1, %56 ], [ %95, %94 ], [ %0, %12 ], [ -1, %25 ], [ -1, %23 ], [ 2, %13 ]
ret i32 %97
}