#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*/ mixColumn(unsigned char *);
void mixColumns(unsigned char buf[]) {
  int i, j;
  unsigned char col[4];
  for (i = 0; i < 4; i++) {
    for (j = 0; j < 4; j++) {
      col[j] = buf[4 * j + i];
    }
    mixColumn(col);
    for (j = 0; j < 4; j++) {
      buf[4 * j + i] = col[j];
    }
  }
  return;
}


x86 assembly (clang, -O0):
<mixColumns>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x4,-0xc(%rbp)
jge    11bd <mixColumns+0xad>
movl   $0x0,-0x10(%rbp)
cmpl   $0x4,-0x10(%rbp)
jge    1167 <mixColumns+0x57>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
shl    $0x2,%ecx
add    -0xc(%rbp),%ecx
movslq %ecx,%rcx
mov    (%rax,%rcx,1),%cl
movslq -0x10(%rbp),%rax
mov    %cl,-0x14(%rbp,%rax,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1134 <mixColumns+0x24>
lea    -0x14(%rbp),%rdi
call   1030 <mixColumn@plt>
movl   $0x0,-0x10(%rbp)
cmpl   $0x4,-0x10(%rbp)
jge    11aa <mixColumns+0x9a>
movslq -0x10(%rbp),%rax
mov    -0x14(%rbp,%rax,1),%dl
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
shl    $0x2,%ecx
add    -0xc(%rbp),%ecx
movslq %ecx,%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1177 <mixColumns+0x67>
jmp    11af <mixColumns+0x9f>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <mixColumns+0x13>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mixColumns>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%al
mov    %al,0x4(%rsp)
mov    0x4(%rdi),%al
mov    %al,0x5(%rsp)
mov    0x8(%rdi),%al
mov    %al,0x6(%rsp)
mov    0xc(%rdi),%al
mov    %al,0x7(%rsp)
lea    0x4(%rsp),%r14
mov    %r14,%rdi
call   1030 <mixColumn@plt>
mov    0x4(%rsp),%al
mov    %al,(%rbx)
mov    0x5(%rsp),%al
mov    %al,0x4(%rbx)
mov    0x6(%rsp),%al
mov    %al,0x8(%rbx)
mov    0x7(%rsp),%al
mov    %al,0xc(%rbx)
mov    0x1(%rbx),%al
mov    %al,0x4(%rsp)
mov    0x5(%rbx),%al
mov    %al,0x5(%rsp)
mov    0x9(%rbx),%al
mov    %al,0x6(%rsp)
mov    0xd(%rbx),%al
mov    %al,0x7(%rsp)
mov    %r14,%rdi
call   1030 <mixColumn@plt>
mov    0x4(%rsp),%al
mov    %al,0x1(%rbx)
mov    0x5(%rsp),%al
mov    %al,0x5(%rbx)
mov    0x6(%rsp),%al
mov    %al,0x9(%rbx)
mov    0x7(%rsp),%al
mov    %al,0xd(%rbx)
mov    0x2(%rbx),%al
mov    %al,0x4(%rsp)
mov    0x6(%rbx),%al
mov    %al,0x5(%rsp)
mov    0xa(%rbx),%al
mov    %al,0x6(%rsp)
mov    0xe(%rbx),%al
mov    %al,0x7(%rsp)
mov    %r14,%rdi
call   1030 <mixColumn@plt>
mov    0x4(%rsp),%al
mov    %al,0x2(%rbx)
mov    0x5(%rsp),%al
mov    %al,0x6(%rbx)
mov    0x6(%rsp),%al
mov    %al,0xa(%rbx)
mov    0x7(%rsp),%al
mov    %al,0xe(%rbx)
mov    0x3(%rbx),%al
mov    %al,0x4(%rsp)
mov    0x7(%rbx),%al
mov    %al,0x5(%rsp)
mov    0xb(%rbx),%al
mov    %al,0x6(%rsp)
mov    0xf(%rbx),%al
mov    %al,0x7(%rsp)
mov    %r14,%rdi
call   1030 <mixColumn@plt>
mov    0x4(%rsp),%al
mov    %al,0x3(%rbx)
mov    0x5(%rsp),%al
mov    %al,0x7(%rbx)
mov    0x6(%rsp),%al
mov    %al,0xb(%rbx)
mov    0x7(%rsp),%al
mov    %al,0xf(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
define void @mixColumns(i8* nocapture %0) {
%2 = alloca [4 x i8]
%3 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 0
%4 = load i8, i8* %0
store i8 %4, i8* %3
%5 = getelementptr inbounds i8, i8* %0, i64 4
%6 = load i8, i8* %5
%7 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 1
store i8 %6, i8* %7
%8 = getelementptr inbounds i8, i8* %0, i64 8
%9 = load i8, i8* %8
%10 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 2
store i8 %9, i8* %10
%11 = getelementptr inbounds i8, i8* %0, i64 12
%12 = load i8, i8* %11
%13 = getelementptr inbounds [4 x i8], [4 x i8]* %2, i64 0, i64 3
store i8 %12, i8* %13
%14 = call i32 @mixColumn(i8* %3)
%15 = load i8, i8* %3
store i8 %15, i8* %0
%16 = load i8, i8* %7
store i8 %16, i8* %5
%17 = load i8, i8* %10
store i8 %17, i8* %8
%18 = load i8, i8* %13
store i8 %18, i8* %11
%19 = getelementptr inbounds i8, i8* %0, i64 1
%20 = load i8, i8* %19
store i8 %20, i8* %3
%21 = getelementptr inbounds i8, i8* %0, i64 5
%22 = load i8, i8* %21
store i8 %22, i8* %7
%23 = getelementptr inbounds i8, i8* %0, i64 9
%24 = load i8, i8* %23
store i8 %24, i8* %10
%25 = getelementptr inbounds i8, i8* %0, i64 13
%26 = load i8, i8* %25
store i8 %26, i8* %13
%27 = call i32 @mixColumn(i8* %3)
%28 = load i8, i8* %3
store i8 %28, i8* %19
%29 = load i8, i8* %7
store i8 %29, i8* %21
%30 = load i8, i8* %10
store i8 %30, i8* %23
%31 = load i8, i8* %13
store i8 %31, i8* %25
%32 = getelementptr inbounds i8, i8* %0, i64 2
%33 = load i8, i8* %32
store i8 %33, i8* %3
%34 = getelementptr inbounds i8, i8* %0, i64 6
%35 = load i8, i8* %34
store i8 %35, i8* %7
%36 = getelementptr inbounds i8, i8* %0, i64 10
%37 = load i8, i8* %36
store i8 %37, i8* %10
%38 = getelementptr inbounds i8, i8* %0, i64 14
%39 = load i8, i8* %38
store i8 %39, i8* %13
%40 = call i32 @mixColumn(i8* %3)
%41 = load i8, i8* %3
store i8 %41, i8* %32
%42 = load i8, i8* %7
store i8 %42, i8* %34
%43 = load i8, i8* %10
store i8 %43, i8* %36
%44 = load i8, i8* %13
store i8 %44, i8* %38
%45 = getelementptr inbounds i8, i8* %0, i64 3
%46 = load i8, i8* %45
store i8 %46, i8* %3
%47 = getelementptr inbounds i8, i8* %0, i64 7
%48 = load i8, i8* %47
store i8 %48, i8* %7
%49 = getelementptr inbounds i8, i8* %0, i64 11
%50 = load i8, i8* %49
store i8 %50, i8* %10
%51 = getelementptr inbounds i8, i8* %0, i64 15
%52 = load i8, i8* %51
store i8 %52, i8* %13
%53 = call i32 @mixColumn(i8* %3)
%54 = load i8, i8* %3
store i8 %54, i8* %45
%55 = load i8, i8* %7
store i8 %55, i8* %47
%56 = load i8, i8* %10
store i8 %56, i8* %49
%57 = load i8, i8* %13
store i8 %57, i8* %51
ret void
}