#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 galois_multiplication(unsigned char, int);
void mixColumn(unsigned char *column) {
  unsigned char cpy[4];
  int i;
  for (i = 0; i < 4; i++) {
    cpy[i] = column[i];
  }
  column[0] =
      galois_multiplication(cpy[0], 2) ^ galois_multiplication(cpy[3], 1) ^
      galois_multiplication(cpy[2], 1) ^ galois_multiplication(cpy[1], 3);
  column[1] =
      galois_multiplication(cpy[1], 2) ^ galois_multiplication(cpy[0], 1) ^
      galois_multiplication(cpy[3], 1) ^ galois_multiplication(cpy[2], 3);
  column[2] =
      galois_multiplication(cpy[2], 2) ^ galois_multiplication(cpy[1], 1) ^
      galois_multiplication(cpy[0], 1) ^ galois_multiplication(cpy[3], 3);
  column[3] =
      galois_multiplication(cpy[3], 2) ^ galois_multiplication(cpy[2], 1) ^
      galois_multiplication(cpy[1], 1) ^ galois_multiplication(cpy[0], 3);
}


x86 assembly (clang, -O0):
<mixColumn>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x4,-0x10(%rbp)
jge    114e <mixColumn+0x3e>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,1),%cl
movslq -0x10(%rbp),%rax
mov    %cl,-0xc(%rbp,%rax,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1123 <mixColumn+0x13>
mov    $0x2,%esi
movzbl -0xc(%rbp),%edi
call   1030 <galois_multiplication@plt>
movzbl %al,%eax
mov    %eax,-0x40(%rbp)
mov    $0x1,%esi
movzbl -0x9(%rbp),%edi
call   1030 <galois_multiplication@plt>
mov    %al,%cl
mov    -0x40(%rbp),%eax
movzbl %cl,%ecx
xor    %ecx,%eax
mov    %eax,-0x3c(%rbp)
mov    $0x1,%esi
movzbl -0xa(%rbp),%edi
call   1030 <galois_multiplication@plt>
mov    %al,%cl
mov    -0x3c(%rbp),%eax
movzbl %cl,%ecx
xor    %ecx,%eax
mov    %eax,-0x38(%rbp)
mov    $0x3,%esi
movzbl -0xb(%rbp),%edi
call   1030 <galois_multiplication@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    $0x2,%esi
movzbl -0xb(%rbp),%edi
call   1030 <galois_multiplication@plt>
movzbl %al,%eax
mov    %eax,-0x34(%rbp)
mov    $0x1,%esi
movzbl -0xc(%rbp),%edi
call   1030 <galois_multiplication@plt>
mov    %al,%cl
mov    -0x34(%rbp),%eax
movzbl %cl,%ecx
xor    %ecx,%eax
mov    %eax,-0x30(%rbp)
mov    $0x1,%esi
movzbl -0x9(%rbp),%edi
call   1030 <galois_multiplication@plt>
mov    %al,%cl
mov    -0x30(%rbp),%eax
movzbl %cl,%ecx
xor    %ecx,%eax
mov    %eax,-0x2c(%rbp)
mov    $0x3,%esi
movzbl -0xa(%rbp),%edi
call   1030 <galois_multiplication@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    $0x2,%esi
movzbl -0xa(%rbp),%edi
call   1030 <galois_multiplication@plt>
movzbl %al,%eax
mov    %eax,-0x28(%rbp)
mov    $0x1,%esi
movzbl -0xb(%rbp),%edi
call   1030 <galois_multiplication@plt>
mov    %al,%cl
mov    -0x28(%rbp),%eax
movzbl %cl,%ecx
xor    %ecx,%eax
mov    %eax,-0x24(%rbp)
mov    $0x1,%esi
movzbl -0xc(%rbp),%edi
call   1030 <galois_multiplication@plt>
mov    %al,%cl
mov    -0x24(%rbp),%eax
movzbl %cl,%ecx
xor    %ecx,%eax
mov    %eax,-0x20(%rbp)
mov    $0x3,%esi
movzbl -0x9(%rbp),%edi
call   1030 <galois_multiplication@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    $0x2,%esi
movzbl -0x9(%rbp),%edi
call   1030 <galois_multiplication@plt>
movzbl %al,%eax
mov    %eax,-0x1c(%rbp)
mov    $0x1,%esi
movzbl -0xa(%rbp),%edi
call   1030 <galois_multiplication@plt>
mov    %al,%cl
mov    -0x1c(%rbp),%eax
movzbl %cl,%ecx
xor    %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    $0x1,%esi
movzbl -0xb(%rbp),%edi
call   1030 <galois_multiplication@plt>
mov    %al,%cl
mov    -0x18(%rbp),%eax
movzbl %cl,%ecx
xor    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    $0x3,%esi
movzbl -0xc(%rbp),%edi
call   1030 <galois_multiplication@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):
<mixColumn>:
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    $0x2,%esi
call   1030 <galois_multiplication@plt>
mov    %eax,%r12d
mov    %ebx,%edi
mov    $0x1,%esi
call   1030 <galois_multiplication@plt>
mov    %eax,%r14d
xor    %r12b,%r14b
mov    %ebp,%edi
mov    %ebp,%r12d
mov    $0x1,%esi
call   1030 <galois_multiplication@plt>
mov    %eax,%ebx
mov    %r15d,0xc(%rsp)
mov    %r15d,%edi
mov    $0x3,%esi
call   1030 <galois_multiplication@plt>
xor    %bl,%al
xor    %r14b,%al
mov    %al,0x0(%r13)
mov    %r15d,%edi
mov    $0x2,%esi
call   1030 <galois_multiplication@plt>
mov    %eax,%r14d
mov    0x10(%rsp),%r15d
mov    %r15d,%edi
mov    $0x1,%esi
call   1030 <galois_multiplication@plt>
mov    %eax,%ebx
xor    %r14b,%bl
mov    0x14(%rsp),%ebp
mov    %ebp,%edi
mov    $0x1,%esi
call   1030 <galois_multiplication@plt>
mov    %eax,%r14d
mov    %r12d,%edi
mov    $0x3,%esi
call   1030 <galois_multiplication@plt>
xor    %r14b,%al
xor    %bl,%al
mov    %al,0x1(%r13)
mov    %r12d,%edi
mov    $0x2,%esi
call   1030 <galois_multiplication@plt>
mov    %eax,%r14d
mov    0xc(%rsp),%edi
mov    $0x1,%esi
call   1030 <galois_multiplication@plt>
mov    %eax,%ebx
xor    %r14b,%bl
mov    %r15d,%edi
mov    $0x1,%esi
call   1030 <galois_multiplication@plt>
mov    %eax,%r14d
mov    %ebp,%edi
mov    $0x3,%esi
call   1030 <galois_multiplication@plt>
xor    %r14b,%al
xor    %bl,%al
mov    %al,0x2(%r13)
mov    %ebp,%edi
mov    $0x2,%esi
call   1030 <galois_multiplication@plt>
mov    %eax,%r14d
mov    %r12d,%edi
mov    $0x1,%esi
call   1030 <galois_multiplication@plt>
mov    %eax,%ebx
xor    %r14b,%bl
mov    0xc(%rsp),%edi
mov    $0x1,%esi
call   1030 <galois_multiplication@plt>
mov    %eax,%r14d
mov    %r15d,%edi
mov    $0x3,%esi
call   1030 <galois_multiplication@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 @mixColumn(i8* %0) {
%2 = alloca i8*
%3 = alloca [4 x i8]
%4 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %4
br label %5
5: ; preds = %17, %1
%6 = load i32, i32* %4
%7 = icmp slt i32 %6, 4
br i1 %7, label %8, label %20
8: ; preds = %5
%9 = load i8*, i8** %2
%10 = load i32, i32* %4
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %9, i64 %11
%13 = load i8, i8* %12
%14 = load i32, i32* %4
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 %15
store i8 %13, i8* %16
br label %17
17: ; preds = %8
%18 = load i32, i32* %4
%19 = add nsw i32 %18, 1
store i32 %19, i32* %4
br label %5
20: ; preds = %5
%21 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%22 = load i8, i8* %21
%23 = call zeroext i8 @galois_multiplication(i8 zeroext %22, i32 2)
%24 = zext i8 %23 to i32
%25 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 3
%26 = load i8, i8* %25
%27 = call zeroext i8 @galois_multiplication(i8 zeroext %26, i32 1)
%28 = zext i8 %27 to i32
%29 = xor i32 %24, %28
%30 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 2
%31 = load i8, i8* %30
%32 = call zeroext i8 @galois_multiplication(i8 zeroext %31, i32 1)
%33 = zext i8 %32 to i32
%34 = xor i32 %29, %33
%35 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 1
%36 = load i8, i8* %35
%37 = call zeroext i8 @galois_multiplication(i8 zeroext %36, i32 3)
%38 = zext i8 %37 to i32
%39 = xor i32 %34, %38
%40 = trunc i32 %39 to i8
%41 = load i8*, i8** %2
%42 = getelementptr inbounds i8, i8* %41, i64 0
store i8 %40, i8* %42
%43 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 1
%44 = load i8, i8* %43
%45 = call zeroext i8 @galois_multiplication(i8 zeroext %44, i32 2)
%46 = zext i8 %45 to i32
%47 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%48 = load i8, i8* %47
%49 = call zeroext i8 @galois_multiplication(i8 zeroext %48, i32 1)
%50 = zext i8 %49 to i32
%51 = xor i32 %46, %50
%52 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 3
%53 = load i8, i8* %52
%54 = call zeroext i8 @galois_multiplication(i8 zeroext %53, i32 1)
%55 = zext i8 %54 to i32
%56 = xor i32 %51, %55
%57 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 2
%58 = load i8, i8* %57
%59 = call zeroext i8 @galois_multiplication(i8 zeroext %58, i32 3)
%60 = zext i8 %59 to i32
%61 = xor i32 %56, %60
%62 = trunc i32 %61 to i8
%63 = load i8*, i8** %2
%64 = getelementptr inbounds i8, i8* %63, i64 1
store i8 %62, i8* %64
%65 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 2
%66 = load i8, i8* %65
%67 = call zeroext i8 @galois_multiplication(i8 zeroext %66, i32 2)
%68 = zext i8 %67 to i32
%69 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 1
%70 = load i8, i8* %69
%71 = call zeroext i8 @galois_multiplication(i8 zeroext %70, i32 1)
%72 = zext i8 %71 to i32
%73 = xor i32 %68, %72
%74 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%75 = load i8, i8* %74
%76 = call zeroext i8 @galois_multiplication(i8 zeroext %75, i32 1)
%77 = zext i8 %76 to i32
%78 = xor i32 %73, %77
%79 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 3
%80 = load i8, i8* %79
%81 = call zeroext i8 @galois_multiplication(i8 zeroext %80, i32 3)
%82 = zext i8 %81 to i32
%83 = xor i32 %78, %82
%84 = trunc i32 %83 to i8
%85 = load i8*, i8** %2
%86 = getelementptr inbounds i8, i8* %85, i64 2
store i8 %84, i8* %86
%87 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 3
%88 = load i8, i8* %87
%89 = call zeroext i8 @galois_multiplication(i8 zeroext %88, i32 2)
%90 = zext i8 %89 to i32
%91 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 2
%92 = load i8, i8* %91
%93 = call zeroext i8 @galois_multiplication(i8 zeroext %92, i32 1)
%94 = zext i8 %93 to i32
%95 = xor i32 %90, %94
%96 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 1
%97 = load i8, i8* %96
%98 = call zeroext i8 @galois_multiplication(i8 zeroext %97, i32 1)
%99 = zext i8 %98 to i32
%100 = xor i32 %95, %99
%101 = getelementptr inbounds [4 x i8], [4 x i8]* %3, i64 0, i64 0
%102 = load i8, i8* %101
%103 = call zeroext i8 @galois_multiplication(i8 zeroext %102, i32 3)
%104 = zext i8 %103 to i32
%105 = xor i32 %100, %104
%106 = trunc i32 %105 to i8
%107 = load i8*, i8** %2
%108 = getelementptr inbounds i8, i8* %107, i64 3
store i8 %106, i8* %108
ret void
}

LLVM IR (-O2):
define void @mixColumn(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 @galois_multiplication(i8 zeroext %2, i32 2)
%10 = tail call zeroext i8 @galois_multiplication(i8 zeroext %8, i32 1)
%11 = xor i8 %10, %9
%12 = tail call zeroext i8 @galois_multiplication(i8 zeroext %6, i32 1)
%13 = xor i8 %11, %12
%14 = tail call zeroext i8 @galois_multiplication(i8 zeroext %4, i32 3)
%15 = xor i8 %13, %14
store i8 %15, i8* %0
%16 = tail call zeroext i8 @galois_multiplication(i8 zeroext %4, i32 2)
%17 = tail call zeroext i8 @galois_multiplication(i8 zeroext %2, i32 1)
%18 = xor i8 %17, %16
%19 = tail call zeroext i8 @galois_multiplication(i8 zeroext %8, i32 1)
%20 = xor i8 %18, %19
%21 = tail call zeroext i8 @galois_multiplication(i8 zeroext %6, i32 3)
%22 = xor i8 %20, %21
store i8 %22, i8* %3
%23 = tail call zeroext i8 @galois_multiplication(i8 zeroext %6, i32 2)
%24 = tail call zeroext i8 @galois_multiplication(i8 zeroext %4, i32 1)
%25 = xor i8 %24, %23
%26 = tail call zeroext i8 @galois_multiplication(i8 zeroext %2, i32 1)
%27 = xor i8 %25, %26
%28 = tail call zeroext i8 @galois_multiplication(i8 zeroext %8, i32 3)
%29 = xor i8 %27, %28
store i8 %29, i8* %5
%30 = tail call zeroext i8 @galois_multiplication(i8 zeroext %8, i32 2)
%31 = tail call zeroext i8 @galois_multiplication(i8 zeroext %6, i32 1)
%32 = xor i8 %31, %30
%33 = tail call zeroext i8 @galois_multiplication(i8 zeroext %4, i32 1)
%34 = xor i8 %32, %33
%35 = tail call zeroext i8 @galois_multiplication(i8 zeroext %2, i32 3)
%36 = xor i8 %34, %35
store i8 %36, i8* %7
ret void
}