int main(int argc, char *argv[]) {
  if (argc != 7) {
    printf(
        "usage: %s -s <stegofile (.ppm)> -m <message filename> -p <password>\n",
        argv[0]);
    return 0;
  }
  unsigned char *message;
  unsigned char *stego;
  unsigned char *password;
  for (int i = 0; i < argc; i++) {
    if (!strcmp(argv[i], "-m")) {
      message = malloc(sizeof(argv[i + 1]) + 1);
      strcpy(message, argv[i + 1]);
    } else if (!strcmp(argv[i], "-s")) {
      stego = malloc(sizeof(argv[i + 1]) + 1);
      strcpy(stego, argv[i + 1]);
    } else if (!strcmp(argv[i], "-p")) {
      password = malloc(sizeof(argv[i + 1]) + 1);
      strcpy(password, argv[i + 1]);
    }
  }
  char cmd[256];
  strcpy(cmd, "./ext -s ");
  strcat(cmd, stego);
  strcat(cmd, " -m ");
  strcat(cmd, "crypto.txt");
  system(cmd);
  strcpy(cmd, "./dec -i crypto.txt -o ");
  strcat(cmd, message);
  strcat(cmd, " -p ");
  strcat(cmd, password);
  system(cmd);
  system("rm crypto.txt");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x130,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x7,-0x8(%rbp)
je     11a4 <main+0x44>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    1379 <main+0x219>
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    12b9 <main+0x159>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe7b(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    1205 <main+0xa5>
mov    $0x9,%edi
call   1070 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    -0x2c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
call   1030 <strcpy@plt>
jmp    12a6 <main+0x146>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xe30(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    1253 <main+0xf3>
mov    $0x9,%edi
call   1070 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    -0x2c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
call   1030 <strcpy@plt>
jmp    12a1 <main+0x141>
mov    -0x10(%rbp),%rax
movslq -0x2c(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
lea    0xde5(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%eax
jne    129c <main+0x13c>
mov    $0x9,%edi
call   1070 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    -0x2c(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,8),%rsi
call   1030 <strcpy@plt>
jmp    12a1 <main+0x141>
jmp    12a6 <main+0x146>
jmp    12ab <main+0x14b>
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    11ab <main+0x4b>
lea    -0x130(%rbp),%rdi
lea    0xd87(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x130(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1080 <strcat@plt>
lea    -0x130(%rbp),%rdi
lea    0xd6e(%rip),%rsi
call   1080 <strcat@plt>
lea    -0x130(%rbp),%rdi
lea    0xd80(%rip),%rsi
call   1080 <strcat@plt>
lea    -0x130(%rbp),%rdi
mov    $0x0,%al
call   1040 <system@plt>
lea    -0x130(%rbp),%rdi
lea    0xd3f(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x130(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1080 <strcat@plt>
lea    -0x130(%rbp),%rdi
lea    0xd34(%rip),%rsi
call   1080 <strcat@plt>
lea    -0x130(%rbp),%rdi
mov    -0x28(%rbp),%rsi
call   1080 <strcat@plt>
lea    -0x130(%rbp),%rdi
mov    $0x0,%al
call   1040 <system@plt>
lea    0xd0f(%rip),%rdi
mov    $0x0,%al
call   1040 <system@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x130,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x118,%rsp
mov    %rsi,%rbx
cmp    $0x7,%edi
jne    123c <main+0xcc>
xor    %r13d,%r13d
lea    0xeae(%rip),%r12
jmp    11c8 <main+0x58>
nopl   0x0(%rax)
mov    $0x9,%edi
call   1080 <malloc@plt>
mov    %rax,%r15
mov    0x8(%rbx,%r13,8),%rsi
add    $0x1,%r13
mov    %rax,%rdi
call   1030 <strcpy@plt>
cmp    $0x7,%r13
je     1252 <main+0xe2>
mov    (%rbx,%r13,8),%r14
mov    %r14,%rdi
mov    %r12,%rsi
call   1070 <strcmp@plt>
test   %eax,%eax
je     11a0 <main+0x30>
mov    %r14,%rdi
lea    0xe63(%rip),%rsi
call   1070 <strcmp@plt>
test   %eax,%eax
je     1210 <main+0xa0>
mov    %r14,%rdi
lea    0xe53(%rip),%rsi
call   1070 <strcmp@plt>
test   %eax,%eax
je     121f <main+0xaf>
add    $0x1,%r13
cmp    $0x7,%r13
jne    11c8 <main+0x58>
jmp    1252 <main+0xe2>
nopl   (%rax)
mov    $0x9,%edi
call   1080 <malloc@plt>
mov    %rax,%rbp
jmp    11ad <main+0x3d>
mov    $0x9,%edi
call   1080 <malloc@plt>
mov    0x8(%rbx,%r13,8),%rsi
add    $0x1,%r13
mov    %rax,0x8(%rsp)
jmp    11b6 <main+0x46>
mov    (%rbx),%rsi
lea    0xdba(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
jmp    1316 <main+0x1a6>
movabs $0x732d207478652f2e,%rax
20 2d 73
mov    %rax,0x10(%rsp)
movw   $0x20,0x18(%rsp)
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
mov    %rbp,%rsi
call   1090 <strcat@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
movl   $0x206d2d20,0x10(%rsp,%rax,1)
20
movb   $0x0,0x14(%rsp,%rax,1)
mov    %rbx,%rdi
call   1040 <strlen@plt>
movabs $0x742e6f7470797263,%rcx
6f 2e 74
mov    %rcx,0x10(%rsp,%rax,1)
movl   $0x747874,0x17(%rsp,%rax,1)
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <system@plt>
movabs $0x206f2d20747874,%rax
mov    %rax,0x20(%rsp)
movups 0xd91(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
mov    %rbx,%rdi
mov    %r15,%rsi
call   1090 <strcat@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
movl   $0x20702d20,0x10(%rsp,%rax,1)
20
movb   $0x0,0x14(%rsp,%rax,1)
mov    %rbx,%rdi
mov    0x8(%rsp),%rsi
call   1090 <strcat@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <system@plt>
lea    0xd6b(%rip),%rdi
xor    %eax,%eax
call   1050 <system@plt>
xor    %eax,%eax
add    $0x118,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [69 x i8] c"usage: %s -s <stegofile (.ppm)> -m <message filename> -p <password>\0A\00"
@.str.1 = [3 x i8] c"-m\00"
@.str.2 = [3 x i8] c"-s\00"
@.str.3 = [3 x i8] c"-p\00"
@.str.4 = [10 x i8] c"./ext -s \00"
@.str.5 = [5 x i8] c" -m \00"
@.str.6 = [11 x i8] c"crypto.txt\00"
@.str.7 = [24 x i8] c"./dec -i crypto.txt -o \00"
@.str.8 = [5 x i8] c" -p \00"
@.str.9 = [14 x i8] c"rm crypto.txt\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 i8*
%9 = alloca i32
%10 = alloca [256 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 7
br i1 %12, label %13, label %18
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 0
%16 = load i8*, i8** %15
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([69 x i8], [69 x i8]* @.str, i64 0, i64 0), i8* %16)
store i32 0, i32* %3
br label %108
18: ; preds = %2
store i32 0, i32* %9
br label %19
19: ; preds = %80, %18
%20 = load i32, i32* %9
%21 = load i32, i32* %4
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %83
23: ; preds = %19
%24 = load i8**, i8*** %5
%25 = load i32, i32* %9
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8*, i8** %24, i64 %26
%28 = load i8*, i8** %27
%29 = call i32 @strcmp(i8* %28, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%30 = icmp ne i32 %29, 0
br i1 %30, label %41, label %31
31: ; preds = %23
%32 = call i8* @malloc(i64 9)
store i8* %32, i8** %6
%33 = load i8*, i8** %6
%34 = load i8**, i8*** %5
%35 = load i32, i32* %9
%36 = add nsw i32 %35, 1
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i8*, i8** %34, i64 %37
%39 = load i8*, i8** %38
%40 = call i8* @strcpy(i8* %33, i8* %39)
br label %79
41: ; preds = %23
%42 = load i8**, i8*** %5
%43 = load i32, i32* %9
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8*, i8** %42, i64 %44
%46 = load i8*, i8** %45
%47 = call i32 @strcmp(i8* %46, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%48 = icmp ne i32 %47, 0
br i1 %48, label %59, label %49
49: ; preds = %41
%50 = call i8* @malloc(i64 9)
store i8* %50, i8** %7
%51 = load i8*, i8** %7
%52 = load i8**, i8*** %5
%53 = load i32, i32* %9
%54 = add nsw i32 %53, 1
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds i8*, i8** %52, i64 %55
%57 = load i8*, i8** %56
%58 = call i8* @strcpy(i8* %51, i8* %57)
br label %78
59: ; preds = %41
%60 = load i8**, i8*** %5
%61 = load i32, i32* %9
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds i8*, i8** %60, i64 %62
%64 = load i8*, i8** %63
%65 = call i32 @strcmp(i8* %64, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%66 = icmp ne i32 %65, 0
br i1 %66, label %77, label %67
67: ; preds = %59
%68 = call i8* @malloc(i64 9)
store i8* %68, i8** %8
%69 = load i8*, i8** %8
%70 = load i8**, i8*** %5
%71 = load i32, i32* %9
%72 = add nsw i32 %71, 1
%73 = sext i32 %72 to i64
%74 = getelementptr inbounds i8*, i8** %70, i64 %73
%75 = load i8*, i8** %74
%76 = call i8* @strcpy(i8* %69, i8* %75)
br label %77
77: ; preds = %67, %59
br label %78
78: ; preds = %77, %49
br label %79
79: ; preds = %78, %31
br label %80
80: ; preds = %79
%81 = load i32, i32* %9
%82 = add nsw i32 %81, 1
store i32 %82, i32* %9
br label %19
83: ; preds = %19
%84 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%85 = call i8* @strcpy(i8* %84, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
%86 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%87 = load i8*, i8** %7
%88 = call i8* @strcat(i8* %86, i8* %87)
%89 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%90 = call i8* @strcat(i8* %89, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.5, i64 0, i64 0))
%91 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%92 = call i8* @strcat(i8* %91, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.6, i64 0, i64 0))
%93 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%94 = call i32 (i8*, ...) bitcast (i32 (...)* @system to i32 (i8*, ...)*)(i8* %93)
%95 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%96 = call i8* @strcpy(i8* %95, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.7, i64 0, i64 0))
%97 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%98 = load i8*, i8** %6
%99 = call i8* @strcat(i8* %97, i8* %98)
%100 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%101 = call i8* @strcat(i8* %100, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.8, i64 0, i64 0))
%102 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%103 = load i8*, i8** %8
%104 = call i8* @strcat(i8* %102, i8* %103)
%105 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%106 = call i32 (i8*, ...) bitcast (i32 (...)* @system to i32 (i8*, ...)*)(i8* %105)
%107 = call i32 (i8*, ...) bitcast (i32 (...)* @system to i32 (i8*, ...)*)(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0))
store i32 0, i32* %3
br label %108
108: ; preds = %83, %13
%109 = load i32, i32* %3
ret i32 %109
}

LLVM IR (-O2):
@.str = [69 x i8] c"usage: %s -s <stegofile (.ppm)> -m <message filename> -p <password>\0A\00"
@.str.1 = [3 x i8] c"-m\00"
@.str.2 = [3 x i8] c"-s\00"
@.str.3 = [3 x i8] c"-p\00"
@.str.4 = [10 x i8] c"./ext -s \00"
@.str.5 = [5 x i8] c" -m \00"
@.str.6 = [11 x i8] c"crypto.txt\00"
@.str.7 = [24 x i8] c"./dec -i crypto.txt -o \00"
@.str.8 = [5 x i8] c" -p \00"
@.str.9 = [14 x i8] c"rm crypto.txt\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [256 x i8]
%4 = icmp eq i32 %0, 7
br i1 %4, label %22, label %5
5: ; preds = %2
%6 = load i8*, i8** %1
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([69 x i8], [69 x i8]* @.str, i64 0, i64 0), i8* %6)
br label %63
8: ; preds = %57
%9 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%10 = call i8* @strcat(i8* %9, i8* dereferenceable(1) %60)
%11 = call i64 @strlen(i8* %9)
%12 = getelementptr [256 x i8], [256 x i8]* %3, i64 0, i64 %11
%13 = call i64 @strlen(i8* %9)
%14 = getelementptr [256 x i8], [256 x i8]* %3, i64 0, i64 %13
%15 = call i32 (i8*, ...) bitcast (i32 (...)* @system to i32 (i8*, ...)*)(i8* %9)
%16 = call i8* @strcat(i8* %9, i8* dereferenceable(1) %59)
%17 = call i64 @strlen(i8* %9)
%18 = getelementptr [256 x i8], [256 x i8]* %3, i64 0, i64 %17
%19 = call i8* @strcat(i8* %9, i8* dereferenceable(1) %61)
%20 = call i32 (i8*, ...) bitcast (i32 (...)* @system to i32 (i8*, ...)*)(i8* %9)
%21 = call i32 (i8*, ...) bitcast (i32 (...)* @system to i32 (i8*, ...)*)(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.9, i64 0, i64 0))
br label %63
22: ; preds = %2, %57
%23 = phi i64 [ %58, %57 ], [ 0, %2 ]
%24 = phi i8* [ %61, %57 ], [ undef, %2 ]
%25 = phi i8* [ %60, %57 ], [ undef, %2 ]
%26 = phi i8* [ %59, %57 ], [ undef, %2 ]
%27 = getelementptr inbounds i8*, i8** %1, i64 %23
%28 = load i8*, i8** %27
%29 = tail call i32 @strcmp(i8* dereferenceable(1) %28, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%30 = icmp eq i32 %29, 0
br i1 %30, label %31, label %37
31: ; preds = %22
%32 = tail call dereferenceable_or_null(9) i8* @malloc(i64 9)
%33 = add nuw nsw i64 %23, 1
%34 = getelementptr inbounds i8*, i8** %1, i64 %33
%35 = load i8*, i8** %34
%36 = tail call i8* @strcpy(i8* dereferenceable(1) %32, i8* dereferenceable(1) %35)
br label %57
37: ; preds = %22
%38 = tail call i32 @strcmp(i8* dereferenceable(1) %28, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%39 = icmp eq i32 %38, 0
br i1 %39, label %40, label %46
40: ; preds = %37
%41 = tail call dereferenceable_or_null(9) i8* @malloc(i64 9)
%42 = add nuw nsw i64 %23, 1
%43 = getelementptr inbounds i8*, i8** %1, i64 %42
%44 = load i8*, i8** %43
%45 = tail call i8* @strcpy(i8* dereferenceable(1) %41, i8* dereferenceable(1) %44)
br label %57
46: ; preds = %37
%47 = tail call i32 @strcmp(i8* dereferenceable(1) %28, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
%48 = icmp eq i32 %47, 0
br i1 %48, label %51, label %49
49: ; preds = %46
%50 = add nuw nsw i64 %23, 1
br label %57
51: ; preds = %46
%52 = tail call dereferenceable_or_null(9) i8* @malloc(i64 9)
%53 = add nuw nsw i64 %23, 1
%54 = getelementptr inbounds i8*, i8** %1, i64 %53
%55 = load i8*, i8** %54
%56 = tail call i8* @strcpy(i8* dereferenceable(1) %52, i8* dereferenceable(1) %55)
br label %57
57: ; preds = %49, %31, %51, %40
%58 = phi i64 [ %50, %49 ], [ %33, %31 ], [ %53, %51 ], [ %42, %40 ]
%59 = phi i8* [ %26, %49 ], [ %32, %31 ], [ %26, %51 ], [ %26, %40 ]
%60 = phi i8* [ %25, %49 ], [ %25, %31 ], [ %25, %51 ], [ %41, %40 ]
%61 = phi i8* [ %24, %49 ], [ %24, %31 ], [ %52, %51 ], [ %24, %40 ]
%62 = icmp eq i64 %58, 7
br i1 %62, label %8, label %22
63: ; preds = %8, %5
ret i32 0
}