#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 */
typedef size_t uint8_t;

/* Variables and functions */
size_t rj_sbox(size_t);
void aes_subBytes(uint8_t *buf) {
  register uint8_t i = 16;
  while (i--)
    buf[i] = rj_sbox(buf[i]);
}


x86 assembly (clang, -O0):
<aes_subBytes>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x10,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,-0x10(%rbp)
cmp    $0x0,%rax
je     1162 <aes_subBytes+0x52>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <rj_sbox@plt>
mov    %rax,%rdx
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %rdx,(%rax,%rcx,8)
jmp    1124 <aes_subBytes+0x14>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aes_subBytes>:
push   %rbx
mov    %rdi,%rbx
mov    0x78(%rdi),%rdi
call   1030 <rj_sbox@plt>
mov    %rax,0x78(%rbx)
mov    0x70(%rbx),%rdi
call   1030 <rj_sbox@plt>
mov    %rax,0x70(%rbx)
mov    0x68(%rbx),%rdi
call   1030 <rj_sbox@plt>
mov    %rax,0x68(%rbx)
mov    0x60(%rbx),%rdi
call   1030 <rj_sbox@plt>
mov    %rax,0x60(%rbx)
mov    0x58(%rbx),%rdi
call   1030 <rj_sbox@plt>
mov    %rax,0x58(%rbx)
mov    0x50(%rbx),%rdi
call   1030 <rj_sbox@plt>
mov    %rax,0x50(%rbx)
mov    0x48(%rbx),%rdi
call   1030 <rj_sbox@plt>
mov    %rax,0x48(%rbx)
mov    0x40(%rbx),%rdi
call   1030 <rj_sbox@plt>
mov    %rax,0x40(%rbx)
mov    0x38(%rbx),%rdi
call   1030 <rj_sbox@plt>
mov    %rax,0x38(%rbx)
mov    0x30(%rbx),%rdi
call   1030 <rj_sbox@plt>
mov    %rax,0x30(%rbx)
mov    0x28(%rbx),%rdi
call   1030 <rj_sbox@plt>
mov    %rax,0x28(%rbx)
mov    0x20(%rbx),%rdi
call   1030 <rj_sbox@plt>
mov    %rax,0x20(%rbx)
mov    0x18(%rbx),%rdi
call   1030 <rj_sbox@plt>
mov    %rax,0x18(%rbx)
mov    0x10(%rbx),%rdi
call   1030 <rj_sbox@plt>
mov    %rax,0x10(%rbx)
mov    0x8(%rbx),%rdi
call   1030 <rj_sbox@plt>
mov    %rax,0x8(%rbx)
mov    (%rbx),%rdi
call   1030 <rj_sbox@plt>
mov    %rax,(%rbx)
pop    %rbx
ret

LLVM IR (-O0):
define void @aes_subBytes(i64* %0) {
%2 = alloca i64*
%3 = alloca i64
store i64* %0, i64** %2
store i64 16, i64* %3
br label %4
4: ; preds = %8, %1
%5 = load i64, i64* %3
%6 = add i64 %5, -1
store i64 %6, i64* %3
%7 = icmp ne i64 %5, 0
br i1 %7, label %8, label %17
8: ; preds = %4
%9 = load i64*, i64** %2
%10 = load i64, i64* %3
%11 = getelementptr inbounds i64, i64* %9, i64 %10
%12 = load i64, i64* %11
%13 = call i64 @rj_sbox(i64 %12)
%14 = load i64*, i64** %2
%15 = load i64, i64* %3
%16 = getelementptr inbounds i64, i64* %14, i64 %15
store i64 %13, i64* %16
br label %4
17: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @aes_subBytes(i64* nocapture %0) {
%2 = getelementptr inbounds i64, i64* %0, i64 15
%3 = load i64, i64* %2
%4 = tail call i64 @rj_sbox(i64 %3)
store i64 %4, i64* %2
%5 = getelementptr inbounds i64, i64* %0, i64 14
%6 = load i64, i64* %5
%7 = tail call i64 @rj_sbox(i64 %6)
store i64 %7, i64* %5
%8 = getelementptr inbounds i64, i64* %0, i64 13
%9 = load i64, i64* %8
%10 = tail call i64 @rj_sbox(i64 %9)
store i64 %10, i64* %8
%11 = getelementptr inbounds i64, i64* %0, i64 12
%12 = load i64, i64* %11
%13 = tail call i64 @rj_sbox(i64 %12)
store i64 %13, i64* %11
%14 = getelementptr inbounds i64, i64* %0, i64 11
%15 = load i64, i64* %14
%16 = tail call i64 @rj_sbox(i64 %15)
store i64 %16, i64* %14
%17 = getelementptr inbounds i64, i64* %0, i64 10
%18 = load i64, i64* %17
%19 = tail call i64 @rj_sbox(i64 %18)
store i64 %19, i64* %17
%20 = getelementptr inbounds i64, i64* %0, i64 9
%21 = load i64, i64* %20
%22 = tail call i64 @rj_sbox(i64 %21)
store i64 %22, i64* %20
%23 = getelementptr inbounds i64, i64* %0, i64 8
%24 = load i64, i64* %23
%25 = tail call i64 @rj_sbox(i64 %24)
store i64 %25, i64* %23
%26 = getelementptr inbounds i64, i64* %0, i64 7
%27 = load i64, i64* %26
%28 = tail call i64 @rj_sbox(i64 %27)
store i64 %28, i64* %26
%29 = getelementptr inbounds i64, i64* %0, i64 6
%30 = load i64, i64* %29
%31 = tail call i64 @rj_sbox(i64 %30)
store i64 %31, i64* %29
%32 = getelementptr inbounds i64, i64* %0, i64 5
%33 = load i64, i64* %32
%34 = tail call i64 @rj_sbox(i64 %33)
store i64 %34, i64* %32
%35 = getelementptr inbounds i64, i64* %0, i64 4
%36 = load i64, i64* %35
%37 = tail call i64 @rj_sbox(i64 %36)
store i64 %37, i64* %35
%38 = getelementptr inbounds i64, i64* %0, i64 3
%39 = load i64, i64* %38
%40 = tail call i64 @rj_sbox(i64 %39)
store i64 %40, i64* %38
%41 = getelementptr inbounds i64, i64* %0, i64 2
%42 = load i64, i64* %41
%43 = tail call i64 @rj_sbox(i64 %42)
store i64 %43, i64* %41
%44 = getelementptr inbounds i64, i64* %0, i64 1
%45 = load i64, i64* %44
%46 = tail call i64 @rj_sbox(i64 %45)
store i64 %46, i64* %44
%47 = load i64, i64* %0
%48 = tail call i64 @rj_sbox(i64 %47)
store i64 %48, i64* %0
ret void
}