#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*/ cbcDecrypt(int *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
void main() {
  char stringkey[33];
  printf("ENTER 32 bit key\n");
  scanf("%s", stringkey);
  int initialVector[32];
  int i;
  for (i = 0; i < 32; i++) {
    if (stringkey[i] == '1')
      initialVector[i] = 1;
    else if (stringkey[i] == '0')
      initialVector[i] = 0;
  }
  cbcDecrypt(initialVector);
  printf("Output written to file 'decryptionOutput.txt'\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
lea    0xebe(%rip),%rdi
call   1040 <printf@plt>
lea    -0x30(%rbp),%rsi
lea    0xec0(%rip),%rdi
call   1050 <scanf@plt>
movl   $0x0,-0xb4(%rbp)
cmpl   $0x20,-0xb4(%rbp)
jge    11df <main+0xaf>
movslq -0xb4(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
cmp    $0x31,%eax
jne    119a <main+0x6a>
movslq -0xb4(%rbp),%rax
movl   $0x1,-0xb0(%rbp,%rax,4)
jmp    11c6 <main+0x96>
movslq -0xb4(%rbp),%rax
movsbl -0x30(%rbp,%rax,1),%eax
cmp    $0x30,%eax
jne    11c1 <main+0x91>
movslq -0xb4(%rbp),%rax
movl   $0x0,-0xb0(%rbp,%rax,4)
jmp    11c6 <main+0x96>
jmp    11cb <main+0x9b>
mov    -0xb4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xb4(%rbp)
jmp    1161 <main+0x31>
lea    -0xb0(%rbp),%rdi
call   1030 <cbcDecrypt@plt>
lea    0xe23(%rip),%rdi
call   1040 <printf@plt>
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0xb8,%rsp
lea    0xec5(%rip),%rdi
call   1040 <puts@plt>
lea    0xeb6(%rip),%rdi
mov    %rsp,%rsi
call   1050 <scanf@plt>
xor    %eax,%eax
jmp    1173 <main+0x43>
cs nopw 0x0(%rax,%rax,1)
mov    $0x1,%ecx
mov    %ecx,0x34(%rsp,%rax,4)
add    $0x2,%rax
cmp    $0x20,%rax
je     11ac <main+0x7c>
movzbl (%rsp,%rax,1),%ecx
cmp    $0x31,%cl
je     1190 <main+0x60>
cmp    $0x30,%cl
jne    1199 <main+0x69>
xor    %ecx,%ecx
jmp    1195 <main+0x65>
cs nopw 0x0(%rax,%rax,1)
nop
mov    $0x1,%ecx
mov    %ecx,0x30(%rsp,%rax,4)
movzbl 0x1(%rsp,%rax,1),%ecx
cmp    $0x31,%cl
je     1160 <main+0x30>
cmp    $0x30,%cl
jne    1169 <main+0x39>
xor    %ecx,%ecx
jmp    1165 <main+0x35>
lea    0x30(%rsp),%rdi
call   1030 <cbcDecrypt@plt>
lea    0xe57(%rip),%rdi
call   1040 <puts@plt>
add    $0xb8,%rsp
ret

LLVM IR (-O0):
@.str = [18 x i8] c"ENTER 32 bit key\0A\00"
@.str.1 = [3 x i8] c"%s\00"
@.str.2 = [47 x i8] c"Output written to file 'decryptionOutput.txt'\0A\00"
define void @main() {
%1 = alloca [33 x i8]
%2 = alloca [32 x i32]
%3 = alloca i32
%4 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%5 = getelementptr inbounds [33 x i8], [33 x i8]* %1, i64 0, i64 0
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %5)
store i32 0, i32* %3
br label %7
7: ; preds = %34, %0
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 32
br i1 %9, label %10, label %37
10: ; preds = %7
%11 = load i32, i32* %3
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [33 x i8], [33 x i8]* %1, i64 0, i64 %12
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 49
br i1 %16, label %17, label %21
17: ; preds = %10
%18 = load i32, i32* %3
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [32 x i32], [32 x i32]* %2, i64 0, i64 %19
store i32 1, i32* %20
br label %33
21: ; preds = %10
%22 = load i32, i32* %3
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [33 x i8], [33 x i8]* %1, i64 0, i64 %23
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 48
br i1 %27, label %28, label %32
28: ; preds = %21
%29 = load i32, i32* %3
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [32 x i32], [32 x i32]* %2, i64 0, i64 %30
store i32 0, i32* %31
br label %32
32: ; preds = %28, %21
br label %33
33: ; preds = %32, %17
br label %34
34: ; preds = %33
%35 = load i32, i32* %3
%36 = add nsw i32 %35, 1
store i32 %36, i32* %3
br label %7
37: ; preds = %7
%38 = getelementptr inbounds [32 x i32], [32 x i32]* %2, i64 0, i64 0
%39 = call i32 @cbcDecrypt(i32* %38)
%40 = call i32 @printf(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%s\00"
@str = [17 x i8] c"ENTER 32 bit key\00"
@str.3 = [46 x i8] c"Output written to file 'decryptionOutput.txt'\00"
define void @main() {
%1 = alloca [33 x i8]
%2 = alloca [32 x i32]
%3 = getelementptr inbounds [33 x i8], [33 x i8]* %1, i64 0, i64 0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%6 = bitcast [32 x i32]* %2 to i8*
br label %7
7: ; preds = %23, %0
%8 = phi i64 [ 0, %0 ], [ %24, %23 ]
%9 = getelementptr inbounds [33 x i8], [33 x i8]* %1, i64 0, i64 %8
%10 = load i8, i8* %9
switch i8 %10, label %15 [
i8 49, label %12
i8 48, label %11
]
11: ; preds = %7
br label %12
12: ; preds = %7, %11
%13 = phi i32 [ 0, %11 ], [ 1, %7 ]
%14 = getelementptr inbounds [32 x i32], [32 x i32]* %2, i64 0, i64 %8
store i32 %13, i32* %14
br label %15
15: ; preds = %12, %7
%16 = or i64 %8, 1
%17 = getelementptr inbounds [33 x i8], [33 x i8]* %1, i64 0, i64 %16
%18 = load i8, i8* %17
switch i8 %18, label %23 [
i8 49, label %20
i8 48, label %19
]
19: ; preds = %15
br label %20
20: ; preds = %19, %15
%21 = phi i32 [ 0, %19 ], [ 1, %15 ]
%22 = getelementptr inbounds [32 x i32], [32 x i32]* %2, i64 0, i64 %16
store i32 %21, i32* %22
br label %23
23: ; preds = %20, %15
%24 = add nuw nsw i64 %8, 2
%25 = icmp eq i64 %24, 32
br i1 %25, label %26, label %7
26: ; preds = %23
%27 = getelementptr inbounds [32 x i32], [32 x i32]* %2, i64 0, i64 0
%28 = call i32 @cbcDecrypt(i32* %27)
%29 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([46 x i8], [46 x i8]* @str.3, i64 0, i64 0))
ret void
}