int main(argc, argv)
int argc;
char *argv[];
{
  char cover_image_name[80], message_image_name[80];
  int hide = 0, i, j, lsb, n, uncover = 0;
  long clength, mlength, cwidth, mwidth;
  short **the_image;
  short **out_image;
  if (argc < 5) {
    stega_show_usage();
    exit(0);
  }
  if (strcmp(argv[1], "-h") == 0) {
    hide = 1;
    uncover = 0;
  }
  if (strcmp(argv[1], "-u") == 0) {
    hide = 0;
    uncover = 1;
  }
  if ((hide == 0) && (uncover == 0)) {
    printf("\nNiether hiding nor uncovering");
    printf("\nSo, quitting");
    exit(1);
  }
  strcpy(cover_image_name, argv[2]);
  strcpy(message_image_name, argv[3]);
  n = atoi(argv[4]);
  if (hide) {
    if (does_not_exist(cover_image_name)) {
      printf("\n%s does not exist, quitting", cover_image_name);
    }
    if (does_not_exist(message_image_name)) {
      printf("\n%s does not exist, quitting", message_image_name);
    }
    get_image_size(cover_image_name, &clength, &cwidth);
    get_image_size(message_image_name, &mlength, &mwidth);
    if (mlength != clength) {
      printf("\n\nmlength NOT EQUAL TO clength");
      printf("\nQUITING");
      exit(2);
    }
    if (cwidth != (n * mwidth)) {
      printf("\nCover image not wide enough");
      printf("\nQUITING");
      exit(3);
    }
    lsb = get_lsb(cover_image_name);
    the_image = allocate_image_array(clength, cwidth);
    out_image = allocate_image_array(mlength, mwidth);
    read_image_array(cover_image_name, the_image);
    read_image_array(message_image_name, out_image);
    hide_image(the_image, out_image, mlength, mwidth, clength, cwidth, lsb, n);
    write_image_array(cover_image_name, the_image);
  }
  if (uncover) {
    printf("\nMAIN> Uncover");
    if (does_not_exist(cover_image_name)) {
      printf("\n%s does not exist, quitting", cover_image_name);
    }
    get_image_size(cover_image_name, &clength, &cwidth);
    mlength = clength;
    mwidth = cwidth / n;
    create_resized_image_file(cover_image_name, message_image_name, mlength,
                              mwidth);
    lsb = get_lsb(cover_image_name);
    the_image = allocate_image_array(clength, cwidth);
    out_image = allocate_image_array(mlength, mwidth);
    read_image_array(cover_image_name, the_image);
    uncover_image(the_image, out_image, mlength, mwidth, clength, cwidth, lsb,
                  n);
    write_image_array(message_image_name, out_image);
  }
  free_image_array(the_image, clength);
  free_image_array(out_image, mlength);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0xb4(%rbp)
movl   $0x0,-0xc8(%rbp)
cmpl   $0x5,-0x8(%rbp)
jge    1245 <main+0x45>
mov    $0x0,%al
call   10f0 <stega_show_usage@plt>
xor    %edi,%edi
call   10e0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xdac(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%eax
jne    1276 <main+0x76>
movl   $0x1,-0xb4(%rbp)
movl   $0x0,-0xc8(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    0xd7e(%rip),%rsi
call   1090 <strcmp@plt>
cmp    $0x0,%eax
jne    12a7 <main+0xa7>
movl   $0x0,-0xb4(%rbp)
movl   $0x1,-0xc8(%rbp)
cmpl   $0x0,-0xb4(%rbp)
jne    12e7 <main+0xe7>
cmpl   $0x0,-0xc8(%rbp)
jne    12e7 <main+0xe7>
lea    0xd3e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xd4f(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
lea    -0x60(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   1030 <strcpy@plt>
lea    -0xb0(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
call   1030 <strcpy@plt>
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rdi
mov    $0x0,%al
call   10d0 <atoi@plt>
mov    %eax,-0xc4(%rbp)
cmpl   $0x0,-0xb4(%rbp)
je     1500 <main+0x300>
lea    -0x60(%rbp),%rdi
mov    $0x0,%al
call   10b0 <does_not_exist@plt>
cmp    $0x0,%eax
je     1354 <main+0x154>
lea    -0x60(%rbp),%rsi
lea    0xce6(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0xb0(%rbp),%rdi
mov    $0x0,%al
call   10b0 <does_not_exist@plt>
cmp    $0x0,%eax
je     1380 <main+0x180>
lea    -0xb0(%rbp),%rsi
lea    0xcba(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x60(%rbp),%rdi
lea    -0xd0(%rbp),%rsi
lea    -0xe0(%rbp),%rdx
mov    $0x0,%al
call   1080 <get_image_size@plt>
lea    -0xb0(%rbp),%rdi
lea    -0xd8(%rbp),%rsi
lea    -0xe8(%rbp),%rdx
mov    $0x0,%al
call   1080 <get_image_size@plt>
mov    -0xd8(%rbp),%rax
cmp    -0xd0(%rbp),%rax
je     13ef <main+0x1ef>
lea    0xc80(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xc91(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x2,%edi
call   10e0 <exit@plt>
mov    -0xe0(%rbp),%rax
movslq -0xc4(%rbp),%rcx
imul   -0xe8(%rbp),%rcx
ff
cmp    %rcx,%rax
je     1434 <main+0x234>
lea    0xc63(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xc4c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x3,%edi
call   10e0 <exit@plt>
lea    -0x60(%rbp),%rdi
mov    $0x0,%al
call   1120 <get_lsb@plt>
mov    %eax,-0xc0(%rbp)
mov    -0xd0(%rbp),%rdi
mov    -0xe0(%rbp),%rsi
mov    $0x0,%al
call   1100 <allocate_image_array@plt>
cltq
mov    %rax,-0xf0(%rbp)
mov    -0xd8(%rbp),%rdi
mov    -0xe8(%rbp),%rsi
mov    $0x0,%al
call   1100 <allocate_image_array@plt>
cltq
mov    %rax,-0xf8(%rbp)
lea    -0x60(%rbp),%rdi
mov    -0xf0(%rbp),%rsi
mov    $0x0,%al
call   10c0 <read_image_array@plt>
lea    -0xb0(%rbp),%rdi
mov    -0xf8(%rbp),%rsi
mov    $0x0,%al
call   10c0 <read_image_array@plt>
mov    -0xf0(%rbp),%rdi
mov    -0xf8(%rbp),%rsi
mov    -0xd8(%rbp),%rdx
mov    -0xe8(%rbp),%rcx
mov    -0xd0(%rbp),%r8
mov    -0xe0(%rbp),%r9
mov    -0xc0(%rbp),%r10d
mov    -0xc4(%rbp),%eax
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
mov    $0x0,%al
call   1070 <hide_image@plt>
lea    -0x60(%rbp),%rdi
mov    -0xf0(%rbp),%rsi
mov    $0x0,%al
call   1060 <write_image_array@plt>
cmpl   $0x0,-0xc8(%rbp)
je     165c <main+0x45c>
lea    0xb81(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x60(%rbp),%rdi
mov    $0x0,%al
call   10b0 <does_not_exist@plt>
cmp    $0x0,%eax
je     1541 <main+0x341>
lea    -0x60(%rbp),%rsi
lea    0xaf9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    -0x60(%rbp),%rdi
lea    -0xd0(%rbp),%rsi
lea    -0xe0(%rbp),%rdx
mov    $0x0,%al
call   1080 <get_image_size@plt>
mov    -0xd0(%rbp),%rax
mov    %rax,-0xd8(%rbp)
mov    -0xe0(%rbp),%rax
movslq -0xc4(%rbp),%rcx
cqto
idiv   %rcx
mov    %rax,-0xe8(%rbp)
lea    -0x60(%rbp),%rdi
lea    -0xb0(%rbp),%rsi
mov    -0xd8(%rbp),%rdx
mov    -0xe8(%rbp),%rcx
mov    $0x0,%al
call   10a0 <create_resized_image_file@plt>
lea    -0x60(%rbp),%rdi
mov    $0x0,%al
call   1120 <get_lsb@plt>
mov    %eax,-0xc0(%rbp)
mov    -0xd0(%rbp),%rdi
mov    -0xe0(%rbp),%rsi
mov    $0x0,%al
call   1100 <allocate_image_array@plt>
cltq
mov    %rax,-0xf0(%rbp)
mov    -0xd8(%rbp),%rdi
mov    -0xe8(%rbp),%rsi
mov    $0x0,%al
call   1100 <allocate_image_array@plt>
cltq
mov    %rax,-0xf8(%rbp)
lea    -0x60(%rbp),%rdi
mov    -0xf0(%rbp),%rsi
mov    $0x0,%al
call   10c0 <read_image_array@plt>
mov    -0xf0(%rbp),%rdi
mov    -0xf8(%rbp),%rsi
mov    -0xd8(%rbp),%rdx
mov    -0xe8(%rbp),%rcx
mov    -0xd0(%rbp),%r8
mov    -0xe0(%rbp),%r9
mov    -0xc0(%rbp),%r10d
mov    -0xc4(%rbp),%eax
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
mov    $0x0,%al
call   1050 <uncover_image@plt>
lea    -0xb0(%rbp),%rdi
mov    -0xf8(%rbp),%rsi
mov    $0x0,%al
call   1060 <write_image_array@plt>
mov    -0xf0(%rbp),%rdi
mov    -0xd0(%rbp),%rsi
mov    $0x0,%al
call   1110 <free_image_array@plt>
mov    -0xf8(%rbp),%rdi
mov    -0xd8(%rbp),%rsi
mov    $0x0,%al
call   1110 <free_image_array@plt>
mov    -0x4(%rbp),%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0xd8,%rsp
cmp    $0x4,%edi
jle    1513 <main+0x313>
mov    %rsi,%r14
mov    0x8(%rsi),%rbp
lea    0xdd8(%rip),%rsi
mov    %rbp,%rdi
call   1090 <strcmp@plt>
test   %eax,%eax
setne  %r12b
lea    0xdc6(%rip),%rsi
mov    %rbp,%rdi
call   1090 <strcmp@plt>
mov    %eax,%r15d
test   %eax,%eax
sete   %bl
or     %r12b,%bl
cmp    $0x1,%bl
jne    125e <main+0x5e>
test   %r15d,%r15d
jne    1521 <main+0x321>
mov    0x10(%r14),%rsi
lea    0x30(%rsp),%rdi
call   1030 <strcpy@plt>
mov    0x18(%r14),%rsi
lea    0x80(%rsp),%rdi
call   1030 <strcpy@plt>
mov    0x20(%r14),%rdi
xor    %eax,%eax
call   10d0 <atoi@plt>
mov    %rax,0x28(%rsp)
test   %bl,%bl
jne    13c7 <main+0x1c7>
lea    0x30(%rsp),%rdi
xor    %eax,%eax
call   10b0 <does_not_exist@plt>
test   %eax,%eax
je     12b8 <main+0xb8>
lea    0xd87(%rip),%rdi
lea    0x30(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x80(%rsp),%rdi
xor    %eax,%eax
call   10b0 <does_not_exist@plt>
test   %eax,%eax
mov    0x28(%rsp),%rbx
je     12e6 <main+0xe6>
lea    0xd5c(%rip),%rdi
lea    0x80(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x30(%rsp),%rdi
lea    0x8(%rsp),%rsi
lea    0x10(%rsp),%rdx
xor    %eax,%eax
call   1080 <get_image_size@plt>
lea    0x80(%rsp),%rdi
lea    0x18(%rsp),%rsi
lea    0x20(%rsp),%rdx
xor    %eax,%eax
call   1080 <get_image_size@plt>
mov    0x18(%rsp),%rax
cmp    0x8(%rsp),%rax
jne    1547 <main+0x347>
movslq %ebx,%rax
imul   0x20(%rsp),%rax
cmp    %rax,0x10(%rsp)
jne    156d <main+0x36d>
lea    0x30(%rsp),%r12
mov    %r12,%rdi
xor    %eax,%eax
call   1120 <get_lsb@plt>
mov    %eax,%r13d
mov    0x8(%rsp),%rdi
mov    0x10(%rsp),%rsi
xor    %eax,%eax
call   1100 <allocate_image_array@plt>
movslq %eax,%r14
mov    0x18(%rsp),%rdi
mov    0x20(%rsp),%rsi
xor    %eax,%eax
call   1100 <allocate_image_array@plt>
movslq %eax,%rbp
mov    %r12,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   10c0 <read_image_array@plt>
lea    0x80(%rsp),%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   10c0 <read_image_array@plt>
mov    0x18(%rsp),%rdx
mov    0x20(%rsp),%rcx
mov    0x8(%rsp),%r8
mov    0x10(%rsp),%r9
mov    %r14,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
push   %rbx
push   %r13
call   1070 <hide_image@plt>
add    $0x10,%rsp
mov    %r12,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1060 <write_image_array@plt>
test   %r15d,%r15d
jne    14e1 <main+0x2e1>
lea    0xcbe(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x30(%rsp),%rdi
xor    %eax,%eax
call   10b0 <does_not_exist@plt>
test   %eax,%eax
je     1401 <main+0x201>
lea    0xc3e(%rip),%rdi
lea    0x30(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x30(%rsp),%rdi
lea    0x8(%rsp),%rsi
lea    0x10(%rsp),%rdx
xor    %eax,%eax
call   1080 <get_image_size@plt>
mov    0x8(%rsp),%rcx
mov    %rcx,0x18(%rsp)
mov    0x10(%rsp),%rax
mov    0x28(%rsp),%rbx
movslq %ebx,%rsi
mov    %rax,%rdx
or     %rsi,%rdx
shr    $0x20,%rdx
je     1441 <main+0x241>
cqto
idiv   %rsi
jmp    1445 <main+0x245>
xor    %edx,%edx
div    %ebx
mov    %rax,0x20(%rsp)
lea    0x30(%rsp),%r13
lea    0x80(%rsp),%r15
mov    %r13,%rdi
mov    %r15,%rsi
mov    %rcx,%rdx
mov    %rax,%rcx
xor    %eax,%eax
call   10a0 <create_resized_image_file@plt>
mov    %r13,%rdi
xor    %eax,%eax
call   1120 <get_lsb@plt>
mov    %eax,%r12d
mov    0x8(%rsp),%rdi
mov    0x10(%rsp),%rsi
xor    %eax,%eax
call   1100 <allocate_image_array@plt>
movslq %eax,%r14
mov    0x18(%rsp),%rdi
mov    0x20(%rsp),%rsi
xor    %eax,%eax
call   1100 <allocate_image_array@plt>
movslq %eax,%rbp
mov    %r13,%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   10c0 <read_image_array@plt>
mov    0x18(%rsp),%rdx
mov    0x20(%rsp),%rcx
mov    0x8(%rsp),%r8
mov    0x10(%rsp),%r9
mov    %r14,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
push   %rbx
push   %r12
call   1050 <uncover_image@plt>
add    $0x10,%rsp
mov    %r15,%rdi
mov    %rbp,%rsi
xor    %eax,%eax
call   1060 <write_image_array@plt>
mov    0x8(%rsp),%rsi
mov    %r14,%rdi
xor    %eax,%eax
call   1110 <free_image_array@plt>
mov    0x18(%rsp),%rsi
mov    %rbp,%rdi
xor    %eax,%eax
call   1110 <free_image_array@plt>
xor    %eax,%eax
add    $0xd8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
xor    %eax,%eax
call   10f0 <stega_show_usage@plt>
xor    %edi,%edi
call   10e0 <exit@plt>
lea    0xade(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xaef(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%edi
call   10e0 <exit@plt>
lea    0xb02(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xb13(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x2,%edi
call   10e0 <exit@plt>
lea    0xb04(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xaed(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x3,%edi
call   10e0 <exit@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"-h\00"
@.str.1 = [3 x i8] c"-u\00"
@.str.2 = [31 x i8] c"\0ANiether hiding nor uncovering\00"
@.str.3 = [14 x i8] c"\0ASo, quitting\00"
@.str.4 = [29 x i8] c"\0A%s does not exist, quitting\00"
@.str.5 = [31 x i8] c"\0A\0Amlength NOT EQUAL TO clength\00"
@.str.6 = [9 x i8] c"\0AQUITING\00"
@.str.7 = [29 x i8] c"\0ACover image not wide enough\00"
@.str.8 = [15 x i8] c"\0AMAIN> Uncover\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [80 x i8]
%7 = alloca [80 x i8]
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i64
%15 = alloca i64
%16 = alloca i64
%17 = alloca i64
%18 = alloca i16**
%19 = alloca i16**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %8
store i32 0, i32* %13
%20 = load i32, i32* %4
%21 = icmp slt i32 %20, 5
br i1 %21, label %22, label %24
22: ; preds = %2
%23 = call i32 (...) @stega_show_usage()
unreachable
24: ; preds = %2
%25 = load i8**, i8*** %5
%26 = getelementptr inbounds i8*, i8** %25, i64 1
%27 = load i8*, i8** %26
%28 = call i32 @strcmp(i8* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%29 = icmp eq i32 %28, 0
br i1 %29, label %30, label %31
30: ; preds = %24
store i32 1, i32* %8
store i32 0, i32* %13
br label %31
31: ; preds = %30, %24
%32 = load i8**, i8*** %5
%33 = getelementptr inbounds i8*, i8** %32, i64 1
%34 = load i8*, i8** %33
%35 = call i32 @strcmp(i8* %34, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%36 = icmp eq i32 %35, 0
br i1 %36, label %37, label %38
37: ; preds = %31
store i32 0, i32* %8
store i32 1, i32* %13
br label %38
38: ; preds = %37, %31
%39 = load i32, i32* %8
%40 = icmp eq i32 %39, 0
br i1 %40, label %41, label %47
41: ; preds = %38
%42 = load i32, i32* %13
%43 = icmp eq i32 %42, 0
br i1 %43, label %44, label %47
44: ; preds = %41
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
unreachable
47: ; preds = %41, %38
%48 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%49 = load i8**, i8*** %5
%50 = getelementptr inbounds i8*, i8** %49, i64 2
%51 = load i8*, i8** %50
%52 = call i8* @strcpy(i8* %48, i8* %51)
%53 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%54 = load i8**, i8*** %5
%55 = getelementptr inbounds i8*, i8** %54, i64 3
%56 = load i8*, i8** %55
%57 = call i8* @strcpy(i8* %53, i8* %56)
%58 = load i8**, i8*** %5
%59 = getelementptr inbounds i8*, i8** %58, i64 4
%60 = load i8*, i8** %59
%61 = call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %60)
store i32 %61, i32* %12
%62 = load i32, i32* %8
%63 = icmp ne i32 %62, 0
br i1 %63, label %64, label %130
64: ; preds = %47
%65 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%66 = call i32 (i8*, ...) bitcast (i32 (...)* @does_not_exist to i32 (i8*, ...)*)(i8* %65)
%67 = icmp ne i32 %66, 0
br i1 %67, label %68, label %71
68: ; preds = %64
%69 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%70 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i8* %69)
br label %71
71: ; preds = %68, %64
%72 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%73 = call i32 (i8*, ...) bitcast (i32 (...)* @does_not_exist to i32 (i8*, ...)*)(i8* %72)
%74 = icmp ne i32 %73, 0
br i1 %74, label %75, label %78
75: ; preds = %71
%76 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i8* %76)
br label %78
78: ; preds = %75, %71
%79 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%80 = call i32 (i8*, i64*, i64*, ...) bitcast (i32 (...)* @get_image_size to i32 (i8*, i64*, i64*, ...)*)(i8* %79, i64* %14, i64* %16)
%81 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%82 = call i32 (i8*, i64*, i64*, ...) bitcast (i32 (...)* @get_image_size to i32 (i8*, i64*, i64*, ...)*)(i8* %81, i64* %15, i64* %17)
%83 = load i64, i64* %15
%84 = load i64, i64* %14
%85 = icmp ne i64 %83, %84
br i1 %85, label %86, label %89
86: ; preds = %78
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0))
%88 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
unreachable
89: ; preds = %78
%90 = load i64, i64* %16
%91 = load i32, i32* %12
%92 = sext i32 %91 to i64
%93 = load i64, i64* %17
%94 = mul nsw i64 %92, %93
%95 = icmp ne i64 %90, %94
br i1 %95, label %96, label %99
96: ; preds = %89
%97 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0))
%98 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
unreachable
99: ; preds = %89
%100 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%101 = call i32 (i8*, ...) bitcast (i32 (...)* @get_lsb to i32 (i8*, ...)*)(i8* %100)
store i32 %101, i32* %11
%102 = load i64, i64* %14
%103 = load i64, i64* %16
%104 = call i32 (i64, i64, ...) bitcast (i32 (...)* @allocate_image_array to i32 (i64, i64, ...)*)(i64 %102, i64 %103)
%105 = sext i32 %104 to i64
%106 = inttoptr i64 %105 to i16**
store i16** %106, i16*** %18
%107 = load i64, i64* %15
%108 = load i64, i64* %17
%109 = call i32 (i64, i64, ...) bitcast (i32 (...)* @allocate_image_array to i32 (i64, i64, ...)*)(i64 %107, i64 %108)
%110 = sext i32 %109 to i64
%111 = inttoptr i64 %110 to i16**
store i16** %111, i16*** %19
%112 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%113 = load i16**, i16*** %18
%114 = call i32 (i8*, i16**, ...) bitcast (i32 (...)* @read_image_array to i32 (i8*, i16**, ...)*)(i8* %112, i16** %113)
%115 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%116 = load i16**, i16*** %19
%117 = call i32 (i8*, i16**, ...) bitcast (i32 (...)* @read_image_array to i32 (i8*, i16**, ...)*)(i8* %115, i16** %116)
%118 = load i16**, i16*** %18
%119 = load i16**, i16*** %19
%120 = load i64, i64* %15
%121 = load i64, i64* %17
%122 = load i64, i64* %14
%123 = load i64, i64* %16
%124 = load i32, i32* %11
%125 = load i32, i32* %12
%126 = call i32 (i16**, i16**, i64, i64, i64, i64, i32, i32, ...) bitcast (i32 (...)* @hide_image to i32 (i16**, i16**, i64, i64, i64, i64, i32, i32, ...)*)(i16** %118, i16** %119, i64 %120, i64 %121, i64 %122, i64 %123, i32 %124, i32 %125)
%127 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%128 = load i16**, i16*** %18
%129 = call i32 (i8*, i16**, ...) bitcast (i32 (...)* @write_image_array to i32 (i8*, i16**, ...)*)(i8* %127, i16** %128)
br label %130
130: ; preds = %99, %47
%131 = load i32, i32* %13
%132 = icmp ne i32 %131, 0
br i1 %132, label %133, label %181
133: ; preds = %130
%134 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0))
%135 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%136 = call i32 (i8*, ...) bitcast (i32 (...)* @does_not_exist to i32 (i8*, ...)*)(i8* %135)
%137 = icmp ne i32 %136, 0
br i1 %137, label %138, label %141
138: ; preds = %133
%139 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%140 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i8* %139)
br label %141
141: ; preds = %138, %133
%142 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%143 = call i32 (i8*, i64*, i64*, ...) bitcast (i32 (...)* @get_image_size to i32 (i8*, i64*, i64*, ...)*)(i8* %142, i64* %14, i64* %16)
%144 = load i64, i64* %14
store i64 %144, i64* %15
%145 = load i64, i64* %16
%146 = load i32, i32* %12
%147 = sext i32 %146 to i64
%148 = sdiv i64 %145, %147
store i64 %148, i64* %17
%149 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%150 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%151 = load i64, i64* %15
%152 = load i64, i64* %17
%153 = call i32 (i8*, i8*, i64, i64, ...) bitcast (i32 (...)* @create_resized_image_file to i32 (i8*, i8*, i64, i64, ...)*)(i8* %149, i8* %150, i64 %151, i64 %152)
%154 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%155 = call i32 (i8*, ...) bitcast (i32 (...)* @get_lsb to i32 (i8*, ...)*)(i8* %154)
store i32 %155, i32* %11
%156 = load i64, i64* %14
%157 = load i64, i64* %16
%158 = call i32 (i64, i64, ...) bitcast (i32 (...)* @allocate_image_array to i32 (i64, i64, ...)*)(i64 %156, i64 %157)
%159 = sext i32 %158 to i64
%160 = inttoptr i64 %159 to i16**
store i16** %160, i16*** %18
%161 = load i64, i64* %15
%162 = load i64, i64* %17
%163 = call i32 (i64, i64, ...) bitcast (i32 (...)* @allocate_image_array to i32 (i64, i64, ...)*)(i64 %161, i64 %162)
%164 = sext i32 %163 to i64
%165 = inttoptr i64 %164 to i16**
store i16** %165, i16*** %19
%166 = getelementptr inbounds [80 x i8], [80 x i8]* %6, i64 0, i64 0
%167 = load i16**, i16*** %18
%168 = call i32 (i8*, i16**, ...) bitcast (i32 (...)* @read_image_array to i32 (i8*, i16**, ...)*)(i8* %166, i16** %167)
%169 = load i16**, i16*** %18
%170 = load i16**, i16*** %19
%171 = load i64, i64* %15
%172 = load i64, i64* %17
%173 = load i64, i64* %14
%174 = load i64, i64* %16
%175 = load i32, i32* %11
%176 = load i32, i32* %12
%177 = call i32 (i16**, i16**, i64, i64, i64, i64, i32, i32, ...) bitcast (i32 (...)* @uncover_image to i32 (i16**, i16**, i64, i64, i64, i64, i32, i32, ...)*)(i16** %169, i16** %170, i64 %171, i64 %172, i64 %173, i64 %174, i32 %175, i32 %176)
%178 = getelementptr inbounds [80 x i8], [80 x i8]* %7, i64 0, i64 0
%179 = load i16**, i16*** %19
%180 = call i32 (i8*, i16**, ...) bitcast (i32 (...)* @write_image_array to i32 (i8*, i16**, ...)*)(i8* %178, i16** %179)
br label %181
181: ; preds = %141, %130
%182 = load i16**, i16*** %18
%183 = load i64, i64* %14
%184 = call i32 (i16**, i64, ...) bitcast (i32 (...)* @free_image_array to i32 (i16**, i64, ...)*)(i16** %182, i64 %183)
%185 = load i16**, i16*** %19
%186 = load i64, i64* %15
%187 = call i32 (i16**, i64, ...) bitcast (i32 (...)* @free_image_array to i32 (i16**, i64, ...)*)(i16** %185, i64 %186)
%188 = load i32, i32* %3
ret i32 %188
}

LLVM IR (-O2):
@.str = [3 x i8] c"-h\00"
@.str.1 = [3 x i8] c"-u\00"
@.str.2 = [31 x i8] c"\0ANiether hiding nor uncovering\00"
@.str.3 = [14 x i8] c"\0ASo, quitting\00"
@.str.4 = [29 x i8] c"\0A%s does not exist, quitting\00"
@.str.5 = [31 x i8] c"\0A\0Amlength NOT EQUAL TO clength\00"
@.str.6 = [9 x i8] c"\0AQUITING\00"
@.str.7 = [29 x i8] c"\0ACover image not wide enough\00"
@.str.8 = [15 x i8] c"\0AMAIN> Uncover\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [80 x i8]
%4 = alloca [80 x i8]
%5 = alloca i64
%6 = alloca i64
%7 = alloca i64
%8 = alloca i64
%9 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%10 = getelementptr inbounds [80 x i8], [80 x i8]* %4, i64 0, i64 0
%11 = bitcast i64* %5 to i8*
%12 = bitcast i64* %6 to i8*
%13 = bitcast i64* %7 to i8*
%14 = bitcast i64* %8 to i8*
%15 = icmp slt i32 %0, 5
br i1 %15, label %16, label %18
16: ; preds = %2
%17 = tail call i32 (...) @stega_show_usage()
tail call void @exit(i32 0)
unreachable
18: ; preds = %2
%19 = getelementptr inbounds i8*, i8** %1, i64 1
%20 = load i8*, i8** %19
%21 = tail call i32 @strcmp(i8* dereferenceable(1) %20, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%22 = icmp ne i32 %21, 0
%23 = tail call i32 @strcmp(i8* dereferenceable(1) %20, i8* dereferenceable(3) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%24 = icmp eq i32 %23, 0
%25 = xor i1 %24, true
%26 = select i1 %24, i1 true, i1 %22
%27 = and i1 %26, %25
br i1 %27, label %28, label %31
28: ; preds = %18
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0))
tail call void @exit(i32 1)
unreachable
31: ; preds = %18
%32 = getelementptr inbounds i8*, i8** %1, i64 2
%33 = load i8*, i8** %32
%34 = call i8* @strcpy(i8* %9, i8* dereferenceable(1) %33)
%35 = getelementptr inbounds i8*, i8** %1, i64 3
%36 = load i8*, i8** %35
%37 = call i8* @strcpy(i8* %10, i8* dereferenceable(1) %36)
%38 = getelementptr inbounds i8*, i8** %1, i64 4
%39 = load i8*, i8** %38
%40 = call i32 (i8*, ...) bitcast (i32 (...)* @atoi to i32 (i8*, ...)*)(i8* %39)
br i1 %26, label %89, label %41
41: ; preds = %31
%42 = call i32 (i8*, ...) bitcast (i32 (...)* @does_not_exist to i32 (i8*, ...)*)(i8* %9)
%43 = icmp eq i32 %42, 0
br i1 %43, label %46, label %44
44: ; preds = %41
%45 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i8* %9)
br label %46
46: ; preds = %44, %41
%47 = call i32 (i8*, ...) bitcast (i32 (...)* @does_not_exist to i32 (i8*, ...)*)(i8* %10)
%48 = icmp eq i32 %47, 0
br i1 %48, label %51, label %49
49: ; preds = %46
%50 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i8* %10)
br label %51
51: ; preds = %49, %46
%52 = call i32 (i8*, i64*, i64*, ...) bitcast (i32 (...)* @get_image_size to i32 (i8*, i64*, i64*, ...)*)(i8* %9, i64* %5, i64* %7)
%53 = call i32 (i8*, i64*, i64*, ...) bitcast (i32 (...)* @get_image_size to i32 (i8*, i64*, i64*, ...)*)(i8* %10, i64* %6, i64* %8)
%54 = load i64, i64* %6
%55 = load i64, i64* %5
%56 = icmp eq i64 %54, %55
br i1 %56, label %60, label %57
57: ; preds = %51
%58 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0))
%59 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
unreachable
60: ; preds = %51
%61 = load i64, i64* %7
%62 = sext i32 %40 to i64
%63 = load i64, i64* %8
%64 = mul nsw i64 %63, %62
%65 = icmp eq i64 %61, %64
br i1 %65, label %69, label %66
66: ; preds = %60
%67 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.7, i64 0, i64 0))
%68 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.6, i64 0, i64 0))
unreachable
69: ; preds = %60
%70 = call i32 (i8*, ...) bitcast (i32 (...)* @get_lsb to i32 (i8*, ...)*)(i8* %9)
%71 = load i64, i64* %5
%72 = load i64, i64* %7
%73 = call i32 (i64, i64, ...) bitcast (i32 (...)* @allocate_image_array to i32 (i64, i64, ...)*)(i64 %71, i64 %72)
%74 = sext i32 %73 to i64
%75 = inttoptr i64 %74 to i16**
%76 = load i64, i64* %6
%77 = load i64, i64* %8
%78 = call i32 (i64, i64, ...) bitcast (i32 (...)* @allocate_image_array to i32 (i64, i64, ...)*)(i64 %76, i64 %77)
%79 = sext i32 %78 to i64
%80 = inttoptr i64 %79 to i16**
%81 = call i32 (i8*, i16**, ...) bitcast (i32 (...)* @read_image_array to i32 (i8*, i16**, ...)*)(i8* %9, i16** %75)
%82 = call i32 (i8*, i16**, ...) bitcast (i32 (...)* @read_image_array to i32 (i8*, i16**, ...)*)(i8* %10, i16** %80)
%83 = load i64, i64* %6
%84 = load i64, i64* %8
%85 = load i64, i64* %5
%86 = load i64, i64* %7
%87 = call i32 (i16**, i16**, i64, i64, i64, i64, i32, i32, ...) bitcast (i32 (...)* @hide_image to i32 (i16**, i16**, i64, i64, i64, i64, i32, i32, ...)*)(i16** %75, i16** %80, i64 %83, i64 %84, i64 %85, i64 %86, i32 %70, i32 %40)
%88 = call i32 (i8*, i16**, ...) bitcast (i32 (...)* @write_image_array to i32 (i8*, i16**, ...)*)(i8* %9, i16** %75)
br label %89
89: ; preds = %69, %31
%90 = phi i16** [ %75, %69 ], [ undef, %31 ]
%91 = phi i16** [ %80, %69 ], [ undef, %31 ]
br i1 %24, label %92, label %123
92: ; preds = %89
%93 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.8, i64 0, i64 0))
%94 = call i32 (i8*, ...) bitcast (i32 (...)* @does_not_exist to i32 (i8*, ...)*)(i8* %9)
%95 = icmp eq i32 %94, 0
br i1 %95, label %98, label %96
96: ; preds = %92
%97 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str.4, i64 0, i64 0), i8* %9)
br label %98
98: ; preds = %96, %92
%99 = call i32 (i8*, i64*, i64*, ...) bitcast (i32 (...)* @get_image_size to i32 (i8*, i64*, i64*, ...)*)(i8* %9, i64* %5, i64* %7)
%100 = load i64, i64* %5
store i64 %100, i64* %6
%101 = load i64, i64* %7
%102 = sext i32 %40 to i64
%103 = sdiv i64 %101, %102
store i64 %103, i64* %8
%104 = call i32 (i8*, i8*, i64, i64, ...) bitcast (i32 (...)* @create_resized_image_file to i32 (i8*, i8*, i64, i64, ...)*)(i8* %9, i8* %10, i64 %100, i64 %103)
%105 = call i32 (i8*, ...) bitcast (i32 (...)* @get_lsb to i32 (i8*, ...)*)(i8* %9)
%106 = load i64, i64* %5
%107 = load i64, i64* %7
%108 = call i32 (i64, i64, ...) bitcast (i32 (...)* @allocate_image_array to i32 (i64, i64, ...)*)(i64 %106, i64 %107)
%109 = sext i32 %108 to i64
%110 = inttoptr i64 %109 to i16**
%111 = load i64, i64* %6
%112 = load i64, i64* %8
%113 = call i32 (i64, i64, ...) bitcast (i32 (...)* @allocate_image_array to i32 (i64, i64, ...)*)(i64 %111, i64 %112)
%114 = sext i32 %113 to i64
%115 = inttoptr i64 %114 to i16**
%116 = call i32 (i8*, i16**, ...) bitcast (i32 (...)* @read_image_array to i32 (i8*, i16**, ...)*)(i8* %9, i16** %110)
%117 = load i64, i64* %6
%118 = load i64, i64* %8
%119 = load i64, i64* %5
%120 = load i64, i64* %7
%121 = call i32 (i16**, i16**, i64, i64, i64, i64, i32, i32, ...) bitcast (i32 (...)* @uncover_image to i32 (i16**, i16**, i64, i64, i64, i64, i32, i32, ...)*)(i16** %110, i16** %115, i64 %117, i64 %118, i64 %119, i64 %120, i32 %105, i32 %40)
%122 = call i32 (i8*, i16**, ...) bitcast (i32 (...)* @write_image_array to i32 (i8*, i16**, ...)*)(i8* %10, i16** %115)
br label %123
123: ; preds = %98, %89
%124 = phi i16** [ %110, %98 ], [ %90, %89 ]
%125 = phi i16** [ %115, %98 ], [ %91, %89 ]
%126 = load i64, i64* %5
%127 = call i32 (i16**, i64, ...) bitcast (i32 (...)* @free_image_array to i32 (i16**, i64, ...)*)(i16** %124, i64 %126)
%128 = load i64, i64* %6
%129 = call i32 (i16**, i64, ...) bitcast (i32 (...)* @free_image_array to i32 (i16**, i64, ...)*)(i16** %125, i64 %128)
ret i32 0
}