int main(int argc, char **argv) {
  char key1 = 0xab;
  char key2 = 0xdc;
  char buf1[1024] = {
      0,
  };
  char buf2[1024] = {
      0,
  };
  char buf3[1024] = {
      0,
  };
  if (argc != 2) {
    printf("uages: value [%d]\n");
    return -1;
  }
  printf("1[%d]\n", decode(buf1, argv[1], key1));
  printf("2[%d]\n", decode(buf2, buf1, key2));
  printf("3[%d]\n", decode(buf3, buf2, key1));
  printf("4[%d]\n", decode(buf2, buf3, key2));
  printf("argv[%s]\n", argv[1]);
  printf("buf1[%s]\n", buf1);
  printf("buf2[%s]\n", buf2);
  printf("buf3[%s]\n", buf3);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movb   $0xab,-0x11(%rbp)
movb   $0xdc,-0x12(%rbp)
lea    -0x420(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1040 <memset@plt>
lea    -0x820(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1040 <memset@plt>
lea    -0xc20(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1040 <memset@plt>
cmpl   $0x2,-0x8(%rbp)
je     11ae <main+0x7e>
lea    0xe65(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    12af <main+0x17f>
lea    -0x420(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
movsbl -0x11(%rbp),%edx
mov    $0x0,%al
call   1050 <decode@plt>
mov    %eax,%esi
lea    0xe42(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x820(%rbp),%rdi
lea    -0x420(%rbp),%rsi
movsbl -0x12(%rbp),%edx
mov    $0x0,%al
call   1050 <decode@plt>
mov    %eax,%esi
lea    0xe20(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xc20(%rbp),%rdi
lea    -0x820(%rbp),%rsi
movsbl -0x11(%rbp),%edx
mov    $0x0,%al
call   1050 <decode@plt>
mov    %eax,%esi
lea    0xdfe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x820(%rbp),%rdi
lea    -0xc20(%rbp),%rsi
movsbl -0x12(%rbp),%edx
mov    $0x0,%al
call   1050 <decode@plt>
mov    %eax,%esi
lea    0xddc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
lea    0xdcd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x420(%rbp),%rsi
lea    0xdc2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x820(%rbp),%rsi
lea    0xdb7(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xc20(%rbp),%rsi
lea    0xdac(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0xc20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xc08,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0x800(%rsp),%rdi
xor    %r13d,%r13d
mov    $0x400,%edx
xor    %esi,%esi
call   1040 <memset@plt>
lea    0x400(%rsp),%rdi
mov    $0x400,%edx
xor    %esi,%esi
call   1040 <memset@plt>
mov    %rsp,%rdi
mov    $0x400,%edx
xor    %esi,%esi
call   1040 <memset@plt>
cmp    $0x2,%ebp
jne    126c <main+0x13c>
mov    0x8(%rbx),%rsi
lea    0x800(%rsp),%r14
mov    %r14,%rdi
mov    $0xffffffab,%edx
xor    %eax,%eax
call   1050 <decode@plt>
lea    0xe68(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0x400(%rsp),%r15
mov    %r15,%rdi
mov    %r14,%rsi
mov    $0xffffffdc,%edx
xor    %eax,%eax
call   1050 <decode@plt>
lea    0xe45(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rsp,%r12
mov    %r12,%rdi
mov    %r15,%rsi
mov    $0xffffffab,%edx
xor    %eax,%eax
call   1050 <decode@plt>
lea    0xe27(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
mov    $0xffffffdc,%edx
xor    %eax,%eax
call   1050 <decode@plt>
lea    0xe0c(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x8(%rbx),%rsi
lea    0xdff(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xdfb(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xdf4(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xded(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1280 <main+0x150>
lea    0xd8d(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0xffffffff,%r13d
mov    %r13d,%eax
add    $0xc08,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [19 x i8] c"uages: value [%d]\0A\00"
@.str.1 = [7 x i8] c"1[%d]\0A\00"
@.str.2 = [7 x i8] c"2[%d]\0A\00"
@.str.3 = [7 x i8] c"3[%d]\0A\00"
@.str.4 = [7 x i8] c"4[%d]\0A\00"
@.str.5 = [10 x i8] c"argv[%s]\0A\00"
@.str.6 = [10 x i8] c"buf1[%s]\0A\00"
@.str.7 = [10 x i8] c"buf2[%s]\0A\00"
@.str.8 = [10 x i8] c"buf3[%s]\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8
%7 = alloca i8
%8 = alloca [1024 x i8]
%9 = alloca [1024 x i8]
%10 = alloca [1024 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8 -85, i8* %6
store i8 -36, i8* %7
%11 = bitcast [1024 x i8]* %8 to i8*
%12 = bitcast [1024 x i8]* %9 to i8*
%13 = bitcast [1024 x i8]* %10 to i8*
%14 = load i32, i32* %4
%15 = icmp ne i32 %14, 2
br i1 %15, label %16, label %18
16: ; preds = %2
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
store i32 -1, i32* %3
br label %55
18: ; preds = %2
%19 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = load i8, i8* %6
%24 = sext i8 %23 to i32
%25 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @decode to i32 (i8*, i8*, i32, ...)*)(i8* %19, i8* %22, i32 %24)
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %25)
%27 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%28 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%29 = load i8, i8* %7
%30 = sext i8 %29 to i32
%31 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @decode to i32 (i8*, i8*, i32, ...)*)(i8* %27, i8* %28, i32 %30)
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %31)
%33 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%34 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%35 = load i8, i8* %6
%36 = sext i8 %35 to i32
%37 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @decode to i32 (i8*, i8*, i32, ...)*)(i8* %33, i8* %34, i32 %36)
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %37)
%39 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%40 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%41 = load i8, i8* %7
%42 = sext i8 %41 to i32
%43 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @decode to i32 (i8*, i8*, i32, ...)*)(i8* %39, i8* %40, i32 %42)
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %43)
%45 = load i8**, i8*** %5
%46 = getelementptr inbounds i8*, i8** %45, i64 1
%47 = load i8*, i8** %46
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* %47)
%49 = getelementptr inbounds [1024 x i8], [1024 x i8]* %8, i64 0, i64 0
%50 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* %49)
%51 = getelementptr inbounds [1024 x i8], [1024 x i8]* %9, i64 0, i64 0
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i8* %51)
%53 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i8* %53)
store i32 0, i32* %3
br label %55
55: ; preds = %18, %16
%56 = load i32, i32* %3
ret i32 %56
}

LLVM IR (-O2):
@.str = [19 x i8] c"uages: value [%d]\0A\00"
@.str.1 = [7 x i8] c"1[%d]\0A\00"
@.str.2 = [7 x i8] c"2[%d]\0A\00"
@.str.3 = [7 x i8] c"3[%d]\0A\00"
@.str.4 = [7 x i8] c"4[%d]\0A\00"
@.str.5 = [10 x i8] c"argv[%s]\0A\00"
@.str.6 = [10 x i8] c"buf1[%s]\0A\00"
@.str.7 = [10 x i8] c"buf2[%s]\0A\00"
@.str.8 = [10 x i8] c"buf3[%s]\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1024 x i8]
%4 = alloca [1024 x i8]
%5 = alloca [1024 x i8]
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%9 = icmp eq i32 %0, 2
br i1 %9, label %12, label %10
10: ; preds = %2
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %28
12: ; preds = %2
%13 = getelementptr inbounds i8*, i8** %1, i64 1
%14 = load i8*, i8** %13
%15 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @decode to i32 (i8*, i8*, i32, ...)*)(i8* %6, i8* %14, i32 -85)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%17 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @decode to i32 (i8*, i8*, i32, ...)*)(i8* %7, i8* %6, i32 -36)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0), i32 %17)
%19 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @decode to i32 (i8*, i8*, i32, ...)*)(i8* %8, i8* %7, i32 -85)
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i32 %19)
%21 = call i32 (i8*, i8*, i32, ...) bitcast (i32 (...)* @decode to i32 (i8*, i8*, i32, ...)*)(i8* %7, i8* %8, i32 -36)
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i32 %21)
%23 = load i8*, i8** %13
%24 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i8* %23)
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i8* %6)
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.7, i64 0, i64 0), i8* %7)
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.8, i64 0, i64 0), i8* %8)
br label %28
28: ; preds = %12, %10
%29 = phi i32 [ -1, %10 ], [ 0, %12 ]
ret i32 %29
}