#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*/ InvMixColumn(unsigned char *);
int /*<<< orphan*/ InvShiftRows(unsigned char *);
int /*<<< orphan*/ InvSubBytesAndXOR(unsigned char *, unsigned char *, int);
int /*<<< orphan*/ XORBytes(unsigned char *, unsigned char *, int);
void InvCipher(unsigned char *block, unsigned char *expandedKey) {
  unsigned char i, j;
  unsigned char round = 10 - 1;
  expandedKey += 16 * 10;
  XORBytes(block, expandedKey, 16);
  expandedKey -= 16;
  do {
    InvShiftRows(block);
    InvSubBytesAndXOR(block, expandedKey, 16);
    expandedKey -= 16;
    for (i = 4, j = 0; i > 0; i--, j += 4)
      InvMixColumn(block + j);
  } while (--round);
  InvShiftRows(block);
  InvSubBytesAndXOR(block, expandedKey, 16);
}


x86 assembly (clang, -O0):
<InvCipher>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movb   $0x9,-0x13(%rbp)
mov    -0x10(%rbp),%rax
add    $0xa0,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x10,%edx
call   1040 <XORBytes@plt>
mov    -0x10(%rbp),%rax
add    $0xfffffffffffffff0,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <InvShiftRows@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x10,%edx
call   1060 <InvSubBytesAndXOR@plt>
mov    -0x10(%rbp),%rax
add    $0xfffffffffffffff0,%rax
mov    %rax,-0x10(%rbp)
movb   $0x4,-0x11(%rbp)
movb   $0x0,-0x12(%rbp)
movzbl -0x11(%rbp),%eax
cmp    $0x0,%eax
jle    11e5 <InvCipher+0xa5>
mov    -0x8(%rbp),%rdi
movzbl -0x12(%rbp),%eax
cltq
add    %rax,%rdi
call   1050 <InvMixColumn@plt>
mov    -0x11(%rbp),%al
add    $0xff,%al
mov    %al,-0x11(%rbp)
movzbl -0x12(%rbp),%eax
add    $0x4,%eax
mov    %al,-0x12(%rbp)
jmp    11af <InvCipher+0x6f>
jmp    11ea <InvCipher+0xaa>
mov    -0x13(%rbp),%al
add    $0xff,%al
mov    %al,-0x13(%rbp)
cmp    $0x0,%al
jne    1180 <InvCipher+0x40>
mov    -0x8(%rbp),%rdi
call   1030 <InvShiftRows@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    $0x10,%edx
call   1060 <InvSubBytesAndXOR@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<InvCipher>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
add    $0xa0,%rsi
mov    $0x10,%edx
call   1040 <XORBytes@plt>
lea    0x90(%r14),%r15
mov    %rbx,%rdi
call   1030 <InvShiftRows@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    $0x10,%edx
call   1060 <InvSubBytesAndXOR@plt>
mov    %rbx,%rdi
call   1050 <InvMixColumn@plt>
lea    0x4(%rbx),%r15
mov    %r15,%rdi
call   1050 <InvMixColumn@plt>
lea    0x8(%rbx),%r12
mov    %r12,%rdi
call   1050 <InvMixColumn@plt>
lea    0xc(%rbx),%r13
mov    %r13,%rdi
call   1050 <InvMixColumn@plt>
lea    0x80(%r14),%rbp
mov    %rbx,%rdi
call   1030 <InvShiftRows@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    $0x10,%edx
call   1060 <InvSubBytesAndXOR@plt>
mov    %rbx,%rdi
call   1050 <InvMixColumn@plt>
mov    %r15,%rdi
call   1050 <InvMixColumn@plt>
mov    %r12,%rdi
call   1050 <InvMixColumn@plt>
mov    %r13,%rdi
call   1050 <InvMixColumn@plt>
lea    0x70(%r14),%rbp
mov    %rbx,%rdi
call   1030 <InvShiftRows@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    $0x10,%edx
call   1060 <InvSubBytesAndXOR@plt>
mov    %rbx,%rdi
call   1050 <InvMixColumn@plt>
mov    %r15,%rdi
call   1050 <InvMixColumn@plt>
mov    %r12,%rdi
call   1050 <InvMixColumn@plt>
mov    %r13,%rdi
call   1050 <InvMixColumn@plt>
lea    0x60(%r14),%rbp
mov    %rbx,%rdi
call   1030 <InvShiftRows@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    $0x10,%edx
call   1060 <InvSubBytesAndXOR@plt>
mov    %rbx,%rdi
call   1050 <InvMixColumn@plt>
mov    %r15,%rdi
call   1050 <InvMixColumn@plt>
mov    %r12,%rdi
call   1050 <InvMixColumn@plt>
mov    %r13,%rdi
call   1050 <InvMixColumn@plt>
lea    0x50(%r14),%rbp
mov    %rbx,%rdi
call   1030 <InvShiftRows@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    $0x10,%edx
call   1060 <InvSubBytesAndXOR@plt>
mov    %rbx,%rdi
call   1050 <InvMixColumn@plt>
mov    %r15,%rdi
call   1050 <InvMixColumn@plt>
mov    %r12,%rdi
call   1050 <InvMixColumn@plt>
mov    %r13,%rdi
call   1050 <InvMixColumn@plt>
lea    0x40(%r14),%rbp
mov    %rbx,%rdi
call   1030 <InvShiftRows@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    $0x10,%edx
call   1060 <InvSubBytesAndXOR@plt>
mov    %rbx,%rdi
call   1050 <InvMixColumn@plt>
mov    %r15,%rdi
call   1050 <InvMixColumn@plt>
mov    %r12,%rdi
call   1050 <InvMixColumn@plt>
mov    %r13,%rdi
call   1050 <InvMixColumn@plt>
lea    0x30(%r14),%rbp
mov    %rbx,%rdi
call   1030 <InvShiftRows@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    $0x10,%edx
call   1060 <InvSubBytesAndXOR@plt>
mov    %rbx,%rdi
call   1050 <InvMixColumn@plt>
mov    %r15,%rdi
call   1050 <InvMixColumn@plt>
mov    %r12,%rdi
call   1050 <InvMixColumn@plt>
mov    %r13,%rdi
call   1050 <InvMixColumn@plt>
lea    0x20(%r14),%rbp
mov    %rbx,%rdi
call   1030 <InvShiftRows@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    $0x10,%edx
call   1060 <InvSubBytesAndXOR@plt>
mov    %rbx,%rdi
call   1050 <InvMixColumn@plt>
mov    %r15,%rdi
call   1050 <InvMixColumn@plt>
mov    %r12,%rdi
call   1050 <InvMixColumn@plt>
mov    %r13,%rdi
call   1050 <InvMixColumn@plt>
lea    0x10(%r14),%rbp
mov    %rbx,%rdi
call   1030 <InvShiftRows@plt>
mov    %rbx,%rdi
mov    %rbp,%rsi
mov    $0x10,%edx
call   1060 <InvSubBytesAndXOR@plt>
mov    %rbx,%rdi
call   1050 <InvMixColumn@plt>
mov    %r15,%rdi
call   1050 <InvMixColumn@plt>
mov    %r12,%rdi
call   1050 <InvMixColumn@plt>
mov    %r13,%rdi
call   1050 <InvMixColumn@plt>
mov    %rbx,%rdi
call   1030 <InvShiftRows@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
mov    $0x10,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <InvSubBytesAndXOR@plt>

LLVM IR (-O0):
define void @InvCipher(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8
%6 = alloca i8
%7 = alloca i8
store i8* %0, i8** %3
store i8* %1, i8** %4
store i8 9, i8* %7
%8 = load i8*, i8** %4
%9 = getelementptr inbounds i8, i8* %8, i64 160
store i8* %9, i8** %4
%10 = load i8*, i8** %3
%11 = load i8*, i8** %4
%12 = call i32 @XORBytes(i8* %10, i8* %11, i32 16)
%13 = load i8*, i8** %4
%14 = getelementptr inbounds i8, i8* %13, i64 -16
store i8* %14, i8** %4
br label %15
15: ; preds = %42, %2
%16 = load i8*, i8** %3
%17 = call i32 @InvShiftRows(i8* %16)
%18 = load i8*, i8** %3
%19 = load i8*, i8** %4
%20 = call i32 @InvSubBytesAndXOR(i8* %18, i8* %19, i32 16)
%21 = load i8*, i8** %4
%22 = getelementptr inbounds i8, i8* %21, i64 -16
store i8* %22, i8** %4
store i8 4, i8* %5
store i8 0, i8* %6
br label %23
23: ; preds = %34, %15
%24 = load i8, i8* %5
%25 = zext i8 %24 to i32
%26 = icmp sgt i32 %25, 0
br i1 %26, label %27, label %41
27: ; preds = %23
%28 = load i8*, i8** %3
%29 = load i8, i8* %6
%30 = zext i8 %29 to i32
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8, i8* %28, i64 %31
%33 = call i32 @InvMixColumn(i8* %32)
br label %34
34: ; preds = %27
%35 = load i8, i8* %5
%36 = add i8 %35, -1
store i8 %36, i8* %5
%37 = load i8, i8* %6
%38 = zext i8 %37 to i32
%39 = add nsw i32 %38, 4
%40 = trunc i32 %39 to i8
store i8 %40, i8* %6
br label %23
41: ; preds = %23
br label %42
42: ; preds = %41
%43 = load i8, i8* %7
%44 = add i8 %43, -1
store i8 %44, i8* %7
%45 = icmp ne i8 %44, 0
br i1 %45, label %15, label %46
46: ; preds = %42
%47 = load i8*, i8** %3
%48 = call i32 @InvShiftRows(i8* %47)
%49 = load i8*, i8** %3
%50 = load i8*, i8** %4
%51 = call i32 @InvSubBytesAndXOR(i8* %49, i8* %50, i32 16)
ret void
}

LLVM IR (-O2):
define void @InvCipher(i8* %0, i8* %1) {
%3 = getelementptr inbounds i8, i8* %1, i64 160
%4 = tail call i32 @XORBytes(i8* %0, i8* %3, i32 16)
%5 = getelementptr inbounds i8, i8* %1, i64 144
%6 = tail call i32 @InvShiftRows(i8* %0)
%7 = tail call i32 @InvSubBytesAndXOR(i8* %0, i8* %5, i32 16)
%8 = tail call i32 @InvMixColumn(i8* %0)
%9 = getelementptr inbounds i8, i8* %0, i64 4
%10 = tail call i32 @InvMixColumn(i8* %9)
%11 = getelementptr inbounds i8, i8* %0, i64 8
%12 = tail call i32 @InvMixColumn(i8* %11)
%13 = getelementptr inbounds i8, i8* %0, i64 12
%14 = tail call i32 @InvMixColumn(i8* %13)
%15 = getelementptr inbounds i8, i8* %1, i64 128
%16 = tail call i32 @InvShiftRows(i8* %0)
%17 = tail call i32 @InvSubBytesAndXOR(i8* %0, i8* %15, i32 16)
%18 = tail call i32 @InvMixColumn(i8* %0)
%19 = tail call i32 @InvMixColumn(i8* %9)
%20 = tail call i32 @InvMixColumn(i8* %11)
%21 = tail call i32 @InvMixColumn(i8* %13)
%22 = getelementptr inbounds i8, i8* %1, i64 112
%23 = tail call i32 @InvShiftRows(i8* %0)
%24 = tail call i32 @InvSubBytesAndXOR(i8* %0, i8* %22, i32 16)
%25 = tail call i32 @InvMixColumn(i8* %0)
%26 = tail call i32 @InvMixColumn(i8* %9)
%27 = tail call i32 @InvMixColumn(i8* %11)
%28 = tail call i32 @InvMixColumn(i8* %13)
%29 = getelementptr inbounds i8, i8* %1, i64 96
%30 = tail call i32 @InvShiftRows(i8* %0)
%31 = tail call i32 @InvSubBytesAndXOR(i8* %0, i8* %29, i32 16)
%32 = tail call i32 @InvMixColumn(i8* %0)
%33 = tail call i32 @InvMixColumn(i8* %9)
%34 = tail call i32 @InvMixColumn(i8* %11)
%35 = tail call i32 @InvMixColumn(i8* %13)
%36 = getelementptr inbounds i8, i8* %1, i64 80
%37 = tail call i32 @InvShiftRows(i8* %0)
%38 = tail call i32 @InvSubBytesAndXOR(i8* %0, i8* %36, i32 16)
%39 = tail call i32 @InvMixColumn(i8* %0)
%40 = tail call i32 @InvMixColumn(i8* %9)
%41 = tail call i32 @InvMixColumn(i8* %11)
%42 = tail call i32 @InvMixColumn(i8* %13)
%43 = getelementptr inbounds i8, i8* %1, i64 64
%44 = tail call i32 @InvShiftRows(i8* %0)
%45 = tail call i32 @InvSubBytesAndXOR(i8* %0, i8* %43, i32 16)
%46 = tail call i32 @InvMixColumn(i8* %0)
%47 = tail call i32 @InvMixColumn(i8* %9)
%48 = tail call i32 @InvMixColumn(i8* %11)
%49 = tail call i32 @InvMixColumn(i8* %13)
%50 = getelementptr inbounds i8, i8* %1, i64 48
%51 = tail call i32 @InvShiftRows(i8* %0)
%52 = tail call i32 @InvSubBytesAndXOR(i8* %0, i8* %50, i32 16)
%53 = tail call i32 @InvMixColumn(i8* %0)
%54 = tail call i32 @InvMixColumn(i8* %9)
%55 = tail call i32 @InvMixColumn(i8* %11)
%56 = tail call i32 @InvMixColumn(i8* %13)
%57 = getelementptr inbounds i8, i8* %1, i64 32
%58 = tail call i32 @InvShiftRows(i8* %0)
%59 = tail call i32 @InvSubBytesAndXOR(i8* %0, i8* %57, i32 16)
%60 = tail call i32 @InvMixColumn(i8* %0)
%61 = tail call i32 @InvMixColumn(i8* %9)
%62 = tail call i32 @InvMixColumn(i8* %11)
%63 = tail call i32 @InvMixColumn(i8* %13)
%64 = getelementptr inbounds i8, i8* %1, i64 16
%65 = tail call i32 @InvShiftRows(i8* %0)
%66 = tail call i32 @InvSubBytesAndXOR(i8* %0, i8* %64, i32 16)
%67 = tail call i32 @InvMixColumn(i8* %0)
%68 = tail call i32 @InvMixColumn(i8* %9)
%69 = tail call i32 @InvMixColumn(i8* %11)
%70 = tail call i32 @InvMixColumn(i8* %13)
%71 = tail call i32 @InvShiftRows(i8* %0)
%72 = tail call i32 @InvSubBytesAndXOR(i8* %0, i8* %1, i32 16)
ret void
}