#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*/ EXIT_FAILURE;
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ perror(char *);
int s(char *, int /*<<< orphan*/, char *);
int main(int argc, char *argv[]) {
  if (argc == 1 || argc > 3) {
    perror("ERROR zle zadané argumenty");
    exit(EXIT_FAILURE);
  }
  if (argc == 3) {
    return s(argv[1], 0, argv[2]);
  } else {
    return s(argv[1], 0, NULL);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x1,-0x8(%rbp)
je     115a <main+0x2a>
cmpl   $0x3,-0x8(%rbp)
jle    1174 <main+0x44>
lea    0xe9f(%rip),%rdi
call   1040 <perror@plt>
mov    0x2e73(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>
cmpl   $0x3,-0x8(%rbp)
jne    119d <main+0x6d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdx
xor    %esi,%esi
call   1030 <s@plt>
mov    %eax,-0x4(%rbp)
jmp    11b3 <main+0x83>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %esi,%esi
xor    %eax,%eax
mov    %eax,%edx
call   1030 <s@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
cmp    $0x1,%edi
je     1156 <main+0x26>
mov    %edi,%eax
cmp    $0x4,%edi
jge    1156 <main+0x26>
mov    0x8(%rsi),%rdi
cmp    $0x3,%eax
jne    114c <main+0x1c>
mov    0x10(%rsi),%rdx
jmp    114e <main+0x1e>
xor    %edx,%edx
xor    %esi,%esi
pop    %rax
jmp    1030 <s@plt>
lea    0xea3(%rip),%rdi
call   1040 <perror@plt>
mov    0x2e77(%rip),%rax
mov    (%rax),%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"ERROR zle zadan\C3\A9 argumenty\00"
@EXIT_FAILURE = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp eq i32 %6, 1
br i1 %7, label %11, label %8
8: ; preds = %2
%9 = load i32, i32* %4
%10 = icmp sgt i32 %9, 3
br i1 %10, label %11, label %15
11: ; preds = %8, %2
%12 = call i32 @perror(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%13 = load i32, i32* @EXIT_FAILURE
%14 = call i32 @exit(i32 %13)
unreachable
15: ; preds = %8
%16 = load i32, i32* %4
%17 = icmp eq i32 %16, 3
br i1 %17, label %18, label %26
18: ; preds = %15
%19 = load i8**, i8*** %5
%20 = getelementptr inbounds i8*, i8** %19, i64 1
%21 = load i8*, i8** %20
%22 = load i8**, i8*** %5
%23 = getelementptr inbounds i8*, i8** %22, i64 2
%24 = load i8*, i8** %23
%25 = call i32 @s(i8* %21, i32 0, i8* %24)
store i32 %25, i32* %3
br label %31
26: ; preds = %15
%27 = load i8**, i8*** %5
%28 = getelementptr inbounds i8*, i8** %27, i64 1
%29 = load i8*, i8** %28
%30 = call i32 @s(i8* %29, i32 0, i8* null)
store i32 %30, i32* %3
br label %31
31: ; preds = %26, %18
%32 = load i32, i32* %3
ret i32 %32
}

LLVM IR (-O2):
@.str = [28 x i8] c"ERROR zle zadan\C3\A9 argumenty\00"
@EXIT_FAILURE = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 1
%4 = icmp sgt i32 %0, 3
%5 = or i1 %3, %4
br i1 %5, label %6, label %10
6: ; preds = %2
%7 = tail call i32 @perror(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* @EXIT_FAILURE
%9 = tail call i32 @exit(i32 %8)
unreachable
10: ; preds = %2
%11 = icmp eq i32 %0, 3
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
br i1 %11, label %14, label %17
14: ; preds = %10
%15 = getelementptr inbounds i8*, i8** %1, i64 2
%16 = load i8*, i8** %15
br label %17
17: ; preds = %10, %14
%18 = phi i8* [ %16, %14 ], [ null, %10 ]
%19 = tail call i32 @s(i8* %13, i32 0, i8* %18)
ret i32 %19
}