#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 EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ decode(char *, char *);
int /*<<< orphan*/ encode(char *, char *);
scalar_t__ strcmp(char *, char *);
int main(int argc, char **argv) {
  if (argc != 4) {
    return EXIT_FAILURE;
  }
  if (strcmp(argv[1], "e") == 0) {
    encode(argv[2], argv[3]);
  }
  if (strcmp(argv[1], "d") == 0) {
    decode(argv[2], argv[3]);
  }
  return EXIT_SUCCESS;
}


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     1161 <main+0x31>
mov    0x2e89(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11d3 <main+0xa3>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe90(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    1194 <main+0x64>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
call   1030 <encode@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe5f(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
jne    11c7 <main+0x97>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
call   1050 <decode@plt>
mov    0x2e0a(%rip),%rax
mov    (%rax),%eax
mov    %eax,-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    1189 <main+0x59>
mov    %rsi,%r14
mov    0x8(%rsi),%rdi
lea    0xeb9(%rip),%rsi
call   1040 <strcmp@plt>
test   %rax,%rax
jne    115e <main+0x2e>
mov    0x10(%r14),%rdi
mov    0x18(%r14),%rsi
call   1030 <encode@plt>
mov    0x8(%r14),%rdi
lea    0xe99(%rip),%rsi
call   1040 <strcmp@plt>
mov    0x2e63(%rip),%rbx
test   %rax,%rax
jne    1190 <main+0x60>
mov    0x10(%r14),%rdi
mov    0x18(%r14),%rsi
call   1050 <decode@plt>
jmp    1190 <main+0x60>
mov    0x2e50(%rip),%rbx
mov    (%rbx),%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@EXIT_FAILURE = global i32 0
@.str = [2 x i8] c"e\00"
@.str.1 = [2 x i8] c"d\00"
@EXIT_SUCCESS = 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 ne i32 %6, 4
br i1 %7, label %8, label %10
8: ; preds = %2
%9 = load i32, i32* @EXIT_FAILURE
store i32 %9, i32* %3
br label %40
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 1
%13 = load i8*, i8** %12
%14 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %24
16: ; preds = %10
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 2
%19 = load i8*, i8** %18
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 3
%22 = load i8*, i8** %21
%23 = call i32 @encode(i8* %19, i8* %22)
br label %24
24: ; preds = %16, %10
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = call i64 @strcmp(i8* %27, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%29 = icmp eq i64 %28, 0
br i1 %29, label %30, label %38
30: ; preds = %24
%31 = load i8**, i8*** %5
%32 = getelementptr inbounds i8*, i8** %31, i64 2
%33 = load i8*, i8** %32
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 3
%36 = load i8*, i8** %35
%37 = call i32 @decode(i8* %33, i8* %36)
br label %38
38: ; preds = %30, %24
%39 = load i32, i32* @EXIT_SUCCESS
store i32 %39, i32* %3
br label %40
40: ; preds = %38, %8
%41 = load i32, i32* %3
ret i32 %41
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@.str = [2 x i8] c"e\00"
@.str.1 = [2 x i8] c"d\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 4
br i1 %3, label %4, label %25
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %15
9: ; preds = %4
%10 = getelementptr inbounds i8*, i8** %1, i64 2
%11 = load i8*, i8** %10
%12 = getelementptr inbounds i8*, i8** %1, i64 3
%13 = load i8*, i8** %12
%14 = tail call i32 @encode(i8* %11, i8* %13)
br label %15
15: ; preds = %9, %4
%16 = load i8*, i8** %5
%17 = tail call i64 @strcmp(i8* %16, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%18 = icmp eq i64 %17, 0
br i1 %18, label %19, label %25
19: ; preds = %15
%20 = getelementptr inbounds i8*, i8** %1, i64 2
%21 = load i8*, i8** %20
%22 = getelementptr inbounds i8*, i8** %1, i64 3
%23 = load i8*, i8** %22
%24 = tail call i32 @decode(i8* %21, i8* %23)
br label %25
25: ; preds = %15, %19, %2
%26 = phi i32* [ @EXIT_FAILURE, %2 ], [ @EXIT_SUCCESS, %19 ], [ @EXIT_SUCCESS, %15 ]
%27 = load i32, i32* %26
ret i32 %27
}