#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*/ descramble(char *, char *);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ scramble(char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcmp(char *, char *);
int main(int argc, char *argv[]) {
  int opt = 0;
  if (argc > 1 && !strcmp(argv[1], "-d"))
    opt++;
  if (argc != 3 + opt) {
    fprintf(stderr, "Usage: %s [-d] from to\n", argv[0]);
    exit(1);
  }
  if (opt)
    descramble(argv[2], argv[3]);
  else
    scramble(argv[1], argv[2]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x1,-0x8(%rbp)
jle    119d <main+0x4d>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xe7a(%rip),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%eax
jne    119d <main+0x4d>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    -0x14(%rbp),%ecx
add    $0x3,%ecx
cmp    %ecx,%eax
je     11d4 <main+0x84>
mov    0x2e2b(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe3e(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>
cmpl   $0x0,-0x14(%rbp)
je     11f8 <main+0xa8>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
call   1070 <descramble@plt>
jmp    120d <main+0xbd>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   1030 <scramble@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%rbx
cmp    $0x2,%edi
jl     11a8 <main+0x58>
mov    %edi,%ebp
mov    0x8(%rbx),%r14
lea    0xe97(%rip),%rsi
mov    %r14,%rdi
call   1040 <strcmp@plt>
cmp    $0x1,%eax
mov    $0x3,%ecx
adc    $0x0,%ecx
cmp    %ebp,%ecx
jne    11a8 <main+0x58>
mov    0x10(%rbx),%rsi
test   %eax,%eax
je     1192 <main+0x42>
mov    %r14,%rdi
call   1030 <scramble@plt>
jmp    11a1 <main+0x51>
mov    0x18(%rbx),%rax
mov    %rsi,%rdi
mov    %rax,%rsi
call   1070 <descramble@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret
mov    0x2e31(%rip),%rax
mov    (%rax),%edi
mov    (%rbx),%rdx
lea    0xe48(%rip),%rsi
call   1050 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"-d\00"
@stderr = global i32 0
@.str.1 = [24 x i8] c"Usage: %s [-d] from to\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
%7 = load i32, i32* %4
%8 = icmp sgt i32 %7, 1
br i1 %8, label %9, label %18
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i32 @strcmp(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%14 = icmp ne i32 %13, 0
br i1 %14, label %18, label %15
15: ; preds = %9
%16 = load i32, i32* %6
%17 = add nsw i32 %16, 1
store i32 %17, i32* %6
br label %18
18: ; preds = %15, %9, %2
%19 = load i32, i32* %4
%20 = load i32, i32* %6
%21 = add nsw i32 3, %20
%22 = icmp ne i32 %19, %21
br i1 %22, label %23, label %30
23: ; preds = %18
%24 = load i32, i32* @stderr
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 0
%27 = load i8*, i8** %26
%28 = call i32 @fprintf(i32 %24, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %27)
%29 = call i32 @exit(i32 1)
unreachable
30: ; preds = %18
%31 = load i32, i32* %6
%32 = icmp ne i32 %31, 0
br i1 %32, label %33, label %41
33: ; preds = %30
%34 = load i8**, i8*** %5
%35 = getelementptr inbounds i8*, i8** %34, i64 2
%36 = load i8*, i8** %35
%37 = load i8**, i8*** %5
%38 = getelementptr inbounds i8*, i8** %37, i64 3
%39 = load i8*, i8** %38
%40 = call i32 @descramble(i8* %36, i8* %39)
br label %49
41: ; preds = %30
%42 = load i8**, i8*** %5
%43 = getelementptr inbounds i8*, i8** %42, i64 1
%44 = load i8*, i8** %43
%45 = load i8**, i8*** %5
%46 = getelementptr inbounds i8*, i8** %45, i64 2
%47 = load i8*, i8** %46
%48 = call i32 @scramble(i8* %44, i8* %47)
br label %49
49: ; preds = %41, %33
ret i32 0
}

LLVM IR (-O2):
@.str = [3 x i8] c"-d\00"
@stderr = global i32 0
@.str.1 = [24 x i8] c"Usage: %s [-d] from to\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %11
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %6, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i32 %7, 0
%9 = select i1 %8, i32 4, i32 3
%10 = icmp eq i32 %9, %0
br i1 %10, label %16, label %11
11: ; preds = %2, %4
%12 = load i32, i32* @stderr
%13 = load i8*, i8** %1
%14 = tail call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0), i8* %13)
%15 = tail call i32 @exit(i32 1)
unreachable
16: ; preds = %4
%17 = getelementptr inbounds i8*, i8** %1, i64 2
%18 = load i8*, i8** %17
br i1 %8, label %19, label %23
19: ; preds = %16
%20 = getelementptr inbounds i8*, i8** %1, i64 3
%21 = load i8*, i8** %20
%22 = tail call i32 @descramble(i8* %18, i8* %21)
br label %25
23: ; preds = %16
%24 = tail call i32 @scramble(i8* %6, i8* %18)
br label %25
25: ; preds = %23, %19
ret i32 0
}