#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*/ decode(char *, char *);
int /*<<< orphan*/ encode(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  if (argc != 4) {
    fprintf(stderr, "%s\n",
            "Error! Incorrect number of parameters.\nHint: program ifile "
            "[-c|-x] ofile");
    return 1;
  }
  if (!strcmp(argv[2], "-c")) {
    encode(argv[1], argv[3]);
  } else if (!strcmp(argv[2], "-x")) {
    decode(argv[1], argv[3]);
  } else {
    fprintf(stderr, "%s\n",
            "Error! Wrong arguments.\nHint: program ifile [-c|-x] ofile");
    return 1;
  }
  return 0;
}


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   $0x4,-0x8(%rbp)
je     1188 <main+0x48>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
lea    0xe90(%rip),%rsi
lea    0xe8d(%rip),%rdx
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    122a <main+0xea>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xeb6(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11bf <main+0x7f>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
call   1030 <encode@plt>
jmp    1223 <main+0xe3>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
lea    0xe82(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    11f6 <main+0xb6>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
call   1060 <decode@plt>
jmp    121e <main+0xde>
mov    0x2de3(%rip),%rax
mov    (%rax),%edi
lea    0xdfa(%rip),%rsi
lea    0xe46(%rip),%rdx
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    122a <main+0xea>
jmp    1223 <main+0xe3>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
cmp    $0x4,%edi
jne    118f <main+0x4f>
mov    %rsi,%rbx
mov    0x10(%rsi),%r14
lea    0xef6(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     11b2 <main+0x72>
lea    0xee6(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcmp@plt>
test   %eax,%eax
je     11c1 <main+0x81>
mov    0x2e63(%rip),%rax
mov    (%rax),%edi
lea    0xe7a(%rip),%rsi
lea    0xec6(%rip),%rdx
jmp    11a6 <main+0x66>
mov    0x2e4a(%rip),%rax
mov    (%rax),%edi
lea    0xe61(%rip),%rsi
lea    0xe5e(%rip),%rdx
call   1050 <fprintf@plt>
mov    $0x1,%eax
jmp    11d0 <main+0x90>
mov    0x8(%rbx),%rdi
mov    0x18(%rbx),%rsi
call   1030 <encode@plt>
jmp    11ce <main+0x8e>
mov    0x8(%rbx),%rdi
mov    0x18(%rbx),%rsi
call   1060 <decode@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [73 x i8] c"Error! Incorrect number of parameters.\0AHint: program ifile [-c|-x] ofile\00"
@.str.2 = [3 x i8] c"-c\00"
@.str.3 = [3 x i8] c"-x\00"
@.str.4 = [58 x i8] c"Error! Wrong arguments.\0AHint: program ifile [-c|-x] ofile\00"
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 ne i32 %6, 4
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
br label %44
11: ; preds = %2
%12 = load i8**, i8*** %5
%13 = getelementptr inbounds i8*, i8** %12, i64 2
%14 = load i8*, i8** %13
%15 = call i32 @strcmp(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%16 = icmp ne i32 %15, 0
br i1 %16, label %25, label %17
17: ; preds = %11
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 1
%20 = load i8*, i8** %19
%21 = load i8**, i8*** %5
%22 = getelementptr inbounds i8*, i8** %21, i64 3
%23 = load i8*, i8** %22
%24 = call i32 @encode(i8* %20, i8* %23)
br label %43
25: ; preds = %11
%26 = load i8**, i8*** %5
%27 = getelementptr inbounds i8*, i8** %26, i64 2
%28 = load i8*, i8** %27
%29 = call i32 @strcmp(i8* %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%30 = icmp ne i32 %29, 0
br i1 %30, label %39, label %31
31: ; preds = %25
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 1
%34 = load i8*, i8** %33
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 3
%37 = load i8*, i8** %36
%38 = call i32 @decode(i8* %34, i8* %37)
br label %42
39: ; preds = %25
%40 = load i32, i32* @stderr
%41 = call i32 @fprintf(i32 %40, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %3
br label %44
42: ; preds = %31
br label %43
43: ; preds = %42, %17
store i32 0, i32* %3
br label %44
44: ; preds = %43, %39, %8
%45 = load i32, i32* %3
ret i32 %45
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [73 x i8] c"Error! Incorrect number of parameters.\0AHint: program ifile [-c|-x] ofile\00"
@.str.2 = [3 x i8] c"-c\00"
@.str.3 = [3 x i8] c"-x\00"
@.str.4 = [58 x i8] c"Error! Wrong arguments.\0AHint: program ifile [-c|-x] ofile\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 4
br i1 %3, label %7, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([73 x i8], [73 x i8]* @.str.1, i64 0, i64 0))
br label %30
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 2
%9 = load i8*, i8** %8
%10 = tail call i32 @strcmp(i8* dereferenceable(1) %9, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %18
12: ; preds = %7
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = getelementptr inbounds i8*, i8** %1, i64 3
%16 = load i8*, i8** %15
%17 = tail call i32 @encode(i8* %14, i8* %16)
br label %30
18: ; preds = %7
%19 = tail call i32 @strcmp(i8* dereferenceable(1) %9, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %27
21: ; preds = %18
%22 = getelementptr inbounds i8*, i8** %1, i64 1
%23 = load i8*, i8** %22
%24 = getelementptr inbounds i8*, i8** %1, i64 3
%25 = load i8*, i8** %24
%26 = tail call i32 @decode(i8* %23, i8* %25)
br label %30
27: ; preds = %18
%28 = load i32, i32* @stderr
%29 = tail call i32 @fprintf(i32 %28, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.4, i64 0, i64 0))
br label %30
30: ; preds = %12, %21, %27, %4
%31 = phi i32 [ 1, %4 ], [ 1, %27 ], [ 0, %21 ], [ 0, %12 ]
ret i32 %31
}