#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 */
unsigned char gmul(unsigned char, int);
void inv_mix_column(unsigned char *r) {
  unsigned char a[4];
  unsigned char c;
  for (c = 0; c < 4; c++) {
    a[c] = r[c];
  }
  r[0] = gmul(a[0], 14) ^ gmul(a[3], 9) ^ gmul(a[2], 13) ^ gmul(a[1], 11);
  r[1] = gmul(a[1], 14) ^ gmul(a[0], 9) ^ gmul(a[3], 13) ^ gmul(a[2], 11);
  r[2] = gmul(a[2], 14) ^ gmul(a[1], 9) ^ gmul(a[0], 13) ^ gmul(a[3], 11);
  r[3] = gmul(a[3], 14) ^ gmul(a[2], 9) ^ gmul(a[1], 13) ^ gmul(a[0], 11);
}


x86 assembly (clang, -O0):
<inv_mix_column>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
movb   $0x0,-0xd(%rbp)
movzbl -0xd(%rbp),%eax
cmp    $0x4,%eax
jge    114d <inv_mix_column+0x3d>
mov    -0x8(%rbp),%rax
movzbl -0xd(%rbp),%ecx
mov    (%rax,%rcx,1),%cl
movzbl -0xd(%rbp),%eax
mov    %cl,-0xc(%rbp,%rax,1)
mov    -0xd(%rbp),%al
add    $0x1,%al
mov    %al,-0xd(%rbp)
jmp    1120 <inv_mix_column+0x10>
mov    $0xe,%esi
movzbl -0xc(%rbp),%edi
call   1030 <gmul@plt>
movzbl %al,%eax
mov    %eax,-0x40(%rbp)
mov    $0x9,%esi
movzbl -0x9(%rbp),%edi
call   1030 <gmul@plt>
mov    %al,%cl
mov    -0x40(%rbp),%eax
movzbl %cl,%ecx
xor    %ecx,%eax
mov    %eax,-0x3c(%rbp)
mov    $0xd,%esi
movzbl -0xa(%rbp),%edi
call   1030 <gmul@plt>
mov    %al,%cl
mov    -0x3c(%rbp),%eax
movzbl %cl,%ecx
xor    %ecx,%eax
mov    %eax,-0x38(%rbp)
mov    $0xb,%esi
movzbl -0xb(%rbp),%edi
call   1030 <gmul@plt>
mov    %al,%cl
mov    -0x38(%rbp),%eax
movzbl %cl,%ecx
xor    %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    $0xe,%esi
movzbl -0xb(%rbp),%edi
call   1030 <gmul@plt>
movzbl %al,%eax
mov    %eax,-0x34(%rbp)
mov    $0x9,%esi
movzbl -0xc(%rbp),%edi
call   1030 <gmul@plt>
mov    %al,%cl
mov    -0x34(%rbp),%eax
movzbl %cl,%ecx
xor    %ecx,%eax
mov    %eax,-0x30(%rbp)
mov    $0xd,%esi
movzbl -0x9(%rbp),%edi
call   1030 <gmul@plt>
mov    %al,%cl
mov    -0x30(%rbp),%eax
movzbl %cl,%ecx
xor    %ecx,%eax
mov    %eax,-0x2c(%rbp)
mov    $0xb,%esi
movzbl -0xa(%rbp),%edi
call   1030 <gmul@plt>
mov    %al,%cl
mov    -0x2c(%rbp),%eax
movzbl %cl,%ecx
xor    %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x1(%rax)
mov    $0xe,%esi
movzbl -0xa(%rbp),%edi
call   1030 <gmul@plt>
movzbl %al,%eax
mov    %eax,-0x28(%rbp)
mov    $0x9,%esi
movzbl -0xb(%rbp),%edi
call   1030 <gmul@plt>
mov    %al,%cl
mov    -0x28(%rbp),%eax
movzbl %cl,%ecx
xor    %ecx,%eax
mov    %eax,-0x24(%rbp)
mov    $0xd,%esi
movzbl -0xc(%rbp),%edi
call   1030 <gmul@plt>
mov    %al,%cl
mov    -0x24(%rbp),%eax
movzbl %cl,%ecx
xor    %ecx,%eax
mov    %eax,-0x20(%rbp)
mov    $0xb,%esi
movzbl -0x9(%rbp),%edi
call   1030 <gmul@plt>
mov    %al,%cl
mov    -0x20(%rbp),%eax
movzbl %cl,%ecx
xor    %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x2(%rax)
mov    $0xe,%esi
movzbl -0x9(%rbp),%edi
call   1030 <gmul@plt>
movzbl %al,%eax
mov    %eax,-0x1c(%rbp)
mov    $0x9,%esi
movzbl -0xa(%rbp),%edi
call   1030 <gmul@plt>
mov    %al,%cl
mov    -0x1c(%rbp),%eax
movzbl %cl,%ecx
xor    %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    $0xd,%esi
movzbl -0xb(%rbp),%edi
call   1030 <gmul@plt>
mov    %al,%cl
mov    -0x18(%rbp),%eax
movzbl %cl,%ecx
xor    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    $0xb,%esi
movzbl -0xc(%rbp),%edi
call   1030 <gmul@plt>
mov    %al,%cl
mov    -0x14(%rbp),%eax
movzbl %cl,%ecx
xor    %ecx,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x3(%rax)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inv_mix_column>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rdi,%r13
movzbl (%rdi),%edi
mov    %edi,0x10(%rsp)
movzbl 0x1(%r13),%r15d
movzbl 0x2(%r13),%ebp
movzbl 0x3(%r13),%ebx
mov    %ebx,0x14(%rsp)
mov    $0xe,%esi
call   1030 <gmul@plt>
mov    %eax,%r12d
mov    %ebx,%edi
mov    $0x9,%esi
call   1030 <gmul@plt>
mov    %eax,%r14d
xor    %r12b,%r14b
mov    %ebp,%edi
mov    %ebp,%r12d
mov    $0xd,%esi
call   1030 <gmul@plt>
mov    %eax,%ebx
mov    %r15d,0xc(%rsp)
mov    %r15d,%edi
mov    $0xb,%esi
call   1030 <gmul@plt>
xor    %bl,%al
xor    %r14b,%al
mov    %al,0x0(%r13)
mov    %r15d,%edi
mov    $0xe,%esi
call   1030 <gmul@plt>
mov    %eax,%r14d
mov    0x10(%rsp),%r15d
mov    %r15d,%edi
mov    $0x9,%esi
call   1030 <gmul@plt>
mov    %eax,%ebx
xor    %r14b,%bl
mov    0x14(%rsp),%ebp
mov    %ebp,%edi
mov    $0xd,%esi
call   1030 <gmul@plt>
mov    %eax,%r14d
mov    %r12d,%edi
mov    $0xb,%esi
call   1030 <gmul@plt>
xor    %r14b,%al
xor    %bl,%al
mov    %al,0x1(%r13)
mov    %r12d,%edi
mov    $0xe,%esi
call   1030 <gmul@plt>
mov    %eax,%r14d
mov    0xc(%rsp),%edi
mov    $0x9,%esi
call   1030 <gmul@plt>
mov    %eax,%ebx
xor    %r14b,%bl
mov    %r15d,%edi
mov    $0xd,%esi
call   1030 <gmul@plt>
mov    %eax,%r14d
mov    %ebp,%edi
mov    $0xb,%esi
call   1030 <gmul@plt>
xor    %r14b,%al
xor    %bl,%al
mov    %al,0x2(%r13)
mov    %ebp,%edi
mov    $0xe,%esi
call   1030 <gmul@plt>
mov    %eax,%r14d
mov    %r12d,%edi
mov    $0x9,%esi
call   1030 <gmul@plt>
mov    %eax,%ebx
xor    %r14b,%bl
mov    0xc(%rsp),%edi
mov    $0xd,%esi
call   1030 <gmul@plt>
mov    %eax,%r14d
mov    %r15d,%edi
mov    $0xb,%esi
call   1030 <gmul@plt>
xor    %r14b,%al
xor    %bl,%al
mov    %al,0x3(%r13)
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @inv_mix_column(i8* %0) {
%2 = alloca i8*
%3 = alloca [4 x i8]
%4 = alloca i8
store i8* %0, i8** %2
store i8 0, i8* %4
br label %5
5: ; preds = %18, %1
%6 = load i8, i8* %4
%7 = zext i8 %6 to i32
%8 = icmp slt i32 %7, 4
br i1 %8, label %9, label %21
9: ; preds = %5
%10 = load i8*, i8** %2
%11 = load i8, i8* %4
%12 = zext i8 %11 to i64
%13 = getelementptr inbounds i8, i8* %10, i64 %12
%14 = load i8, i8* %13
%15 = load i8, i8* %4
%16 = zext i8 %15 to i64
%17 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 %16
store i8 %14, i8* %17
br label %18
18: ; preds = %9
%19 = load i8, i8* %4
%20 = add i8 %19, 1
store i8 %20, i8* %4
br label %5
21: ; preds = %5
%22 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%23 = load i8, i8* %22
%24 = call zeroext i8 @gmul(i8 zeroext %23, i32 14)
%25 = zext i8 %24 to i32
%26 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 3
%27 = load i8, i8* %26
%28 = call zeroext i8 @gmul(i8 zeroext %27, i32 9)
%29 = zext i8 %28 to i32
%30 = xor i32 %25, %29
%31 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 2
%32 = load i8, i8* %31
%33 = call zeroext i8 @gmul(i8 zeroext %32, i32 13)
%34 = zext i8 %33 to i32
%35 = xor i32 %30, %34
%36 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 1
%37 = load i8, i8* %36
%38 = call zeroext i8 @gmul(i8 zeroext %37, i32 11)
%39 = zext i8 %38 to i32
%40 = xor i32 %35, %39
%41 = trunc i32 %40 to i8
%42 = load i8*, i8** %2
%43 = getelementptr inbounds i8, i8* %42, i64 0
store i8 %41, i8* %43
%44 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 1
%45 = load i8, i8* %44
%46 = call zeroext i8 @gmul(i8 zeroext %45, i32 14)
%47 = zext i8 %46 to i32
%48 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%49 = load i8, i8* %48
%50 = call zeroext i8 @gmul(i8 zeroext %49, i32 9)
%51 = zext i8 %50 to i32
%52 = xor i32 %47, %51
%53 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 3
%54 = load i8, i8* %53
%55 = call zeroext i8 @gmul(i8 zeroext %54, i32 13)
%56 = zext i8 %55 to i32
%57 = xor i32 %52, %56
%58 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 2
%59 = load i8, i8* %58
%60 = call zeroext i8 @gmul(i8 zeroext %59, i32 11)
%61 = zext i8 %60 to i32
%62 = xor i32 %57, %61
%63 = trunc i32 %62 to i8
%64 = load i8*, i8** %2
%65 = getelementptr inbounds i8, i8* %64, i64 1
store i8 %63, i8* %65
%66 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 2
%67 = load i8, i8* %66
%68 = call zeroext i8 @gmul(i8 zeroext %67, i32 14)
%69 = zext i8 %68 to i32
%70 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 1
%71 = load i8, i8* %70
%72 = call zeroext i8 @gmul(i8 zeroext %71, i32 9)
%73 = zext i8 %72 to i32
%74 = xor i32 %69, %73
%75 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%76 = load i8, i8* %75
%77 = call zeroext i8 @gmul(i8 zeroext %76, i32 13)
%78 = zext i8 %77 to i32
%79 = xor i32 %74, %78
%80 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 3
%81 = load i8, i8* %80
%82 = call zeroext i8 @gmul(i8 zeroext %81, i32 11)
%83 = zext i8 %82 to i32
%84 = xor i32 %79, %83
%85 = trunc i32 %84 to i8
%86 = load i8*, i8** %2
%87 = getelementptr inbounds i8, i8* %86, i64 2
store i8 %85, i8* %87
%88 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 3
%89 = load i8, i8* %88
%90 = call zeroext i8 @gmul(i8 zeroext %89, i32 14)
%91 = zext i8 %90 to i32
%92 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 2
%93 = load i8, i8* %92
%94 = call zeroext i8 @gmul(i8 zeroext %93, i32 9)
%95 = zext i8 %94 to i32
%96 = xor i32 %91, %95
%97 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 1
%98 = load i8, i8* %97
%99 = call zeroext i8 @gmul(i8 zeroext %98, i32 13)
%100 = zext i8 %99 to i32
%101 = xor i32 %96, %100
%102 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%103 = load i8, i8* %102
%104 = call zeroext i8 @gmul(i8 zeroext %103, i32 11)
%105 = zext i8 %104 to i32
%106 = xor i32 %101, %105
%107 = trunc i32 %106 to i8
%108 = load i8*, i8** %2
%109 = getelementptr inbounds i8, i8* %108, i64 3
store i8 %107, i8* %109
ret void
}

LLVM IR (-O2):
define void @inv_mix_column(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = getelementptr inbounds i8, i8* %0, i64 1
%4 = load i8, i8* %3
%5 = getelementptr inbounds i8, i8* %0, i64 2
%6 = load i8, i8* %5
%7 = getelementptr inbounds i8, i8* %0, i64 3
%8 = load i8, i8* %7
%9 = tail call zeroext i8 @gmul(i8 zeroext %2, i32 14)
%10 = tail call zeroext i8 @gmul(i8 zeroext %8, i32 9)
%11 = xor i8 %10, %9
%12 = tail call zeroext i8 @gmul(i8 zeroext %6, i32 13)
%13 = xor i8 %11, %12
%14 = tail call zeroext i8 @gmul(i8 zeroext %4, i32 11)
%15 = xor i8 %13, %14
store i8 %15, i8* %0
%16 = tail call zeroext i8 @gmul(i8 zeroext %4, i32 14)
%17 = tail call zeroext i8 @gmul(i8 zeroext %2, i32 9)
%18 = xor i8 %17, %16
%19 = tail call zeroext i8 @gmul(i8 zeroext %8, i32 13)
%20 = xor i8 %18, %19
%21 = tail call zeroext i8 @gmul(i8 zeroext %6, i32 11)
%22 = xor i8 %20, %21
store i8 %22, i8* %3
%23 = tail call zeroext i8 @gmul(i8 zeroext %6, i32 14)
%24 = tail call zeroext i8 @gmul(i8 zeroext %4, i32 9)
%25 = xor i8 %24, %23
%26 = tail call zeroext i8 @gmul(i8 zeroext %2, i32 13)
%27 = xor i8 %25, %26
%28 = tail call zeroext i8 @gmul(i8 zeroext %8, i32 11)
%29 = xor i8 %27, %28
store i8 %29, i8* %5
%30 = tail call zeroext i8 @gmul(i8 zeroext %8, i32 14)
%31 = tail call zeroext i8 @gmul(i8 zeroext %6, i32 9)
%32 = xor i8 %31, %30
%33 = tail call zeroext i8 @gmul(i8 zeroext %4, i32 13)
%34 = xor i8 %32, %33
%35 = tail call zeroext i8 @gmul(i8 zeroext %2, i32 11)
%36 = xor i8 %34, %35
store i8 %36, i8* %7
ret void
}