#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 rj_sbox_inv(unsigned char);
void aes_subBytes_inv(unsigned char *buf) {
  register unsigned char i = 16;
  while (i--)
    buf[i] = rj_sbox_inv(buf[i]);
}


x86 assembly (clang, -O0):
<aes_subBytes_inv>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movb   $0x10,-0x9(%rbp)
mov    -0x9(%rbp),%al
mov    %al,%cl
add    $0xff,%cl
mov    %cl,-0x9(%rbp)
cmp    $0x0,%al
je     1156 <aes_subBytes_inv+0x46>
mov    -0x8(%rbp),%rax
movzbl -0x9(%rbp),%ecx
movzbl (%rax,%rcx,1),%edi
call   1030 <rj_sbox_inv@plt>
mov    %al,%dl
mov    -0x8(%rbp),%rax
movzbl -0x9(%rbp),%ecx
mov    %dl,(%rax,%rcx,1)
jmp    1120 <aes_subBytes_inv+0x10>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aes_subBytes_inv>:
push   %rbx
mov    %rdi,%rbx
movzbl 0xf(%rdi),%edi
call   1030 <rj_sbox_inv@plt>
mov    %al,0xf(%rbx)
movzbl 0xe(%rbx),%edi
call   1030 <rj_sbox_inv@plt>
mov    %al,0xe(%rbx)
movzbl 0xd(%rbx),%edi
call   1030 <rj_sbox_inv@plt>
mov    %al,0xd(%rbx)
movzbl 0xc(%rbx),%edi
call   1030 <rj_sbox_inv@plt>
mov    %al,0xc(%rbx)
movzbl 0xb(%rbx),%edi
call   1030 <rj_sbox_inv@plt>
mov    %al,0xb(%rbx)
movzbl 0xa(%rbx),%edi
call   1030 <rj_sbox_inv@plt>
mov    %al,0xa(%rbx)
movzbl 0x9(%rbx),%edi
call   1030 <rj_sbox_inv@plt>
mov    %al,0x9(%rbx)
movzbl 0x8(%rbx),%edi
call   1030 <rj_sbox_inv@plt>
mov    %al,0x8(%rbx)
movzbl 0x7(%rbx),%edi
call   1030 <rj_sbox_inv@plt>
mov    %al,0x7(%rbx)
movzbl 0x6(%rbx),%edi
call   1030 <rj_sbox_inv@plt>
mov    %al,0x6(%rbx)
movzbl 0x5(%rbx),%edi
call   1030 <rj_sbox_inv@plt>
mov    %al,0x5(%rbx)
movzbl 0x4(%rbx),%edi
call   1030 <rj_sbox_inv@plt>
mov    %al,0x4(%rbx)
movzbl 0x3(%rbx),%edi
call   1030 <rj_sbox_inv@plt>
mov    %al,0x3(%rbx)
movzbl 0x2(%rbx),%edi
call   1030 <rj_sbox_inv@plt>
mov    %al,0x2(%rbx)
movzbl 0x1(%rbx),%edi
call   1030 <rj_sbox_inv@plt>
mov    %al,0x1(%rbx)
movzbl (%rbx),%edi
call   1030 <rj_sbox_inv@plt>
mov    %al,(%rbx)
pop    %rbx
ret

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

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