#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 rcon(unsigned char);
int /*<<< orphan*/ rotate(unsigned char *);
unsigned char sbox(unsigned char);
void schedule_core(unsigned char *in, unsigned char i) {
  unsigned char a;
  rotate(in);
  for (a = 0; a < 4; a++)
    in[a] = sbox(in[a]);
  in[0] ^= rcon(i);
}


x86 assembly (clang, -O0):
<schedule_core>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %sil,%al
mov    %rdi,-0x8(%rbp)
mov    %al,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <rotate@plt>
movb   $0x0,-0xa(%rbp)
movzbl -0xa(%rbp),%eax
cmp    $0x4,%eax
jge    1187 <schedule_core+0x57>
mov    -0x8(%rbp),%rax
movzbl -0xa(%rbp),%ecx
movzbl (%rax,%rcx,1),%edi
call   1040 <sbox@plt>
mov    %al,%dl
mov    -0x8(%rbp),%rax
movzbl -0xa(%rbp),%ecx
mov    %dl,(%rax,%rcx,1)
mov    -0xa(%rbp),%al
add    $0x1,%al
mov    %al,-0xa(%rbp)
jmp    114f <schedule_core+0x1f>
movzbl -0x9(%rbp),%edi
call   1050 <rcon@plt>
movzbl %al,%edx
mov    -0x8(%rbp),%rax
movzbl (%rax),%ecx
xor    %edx,%ecx
mov    %cl,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<schedule_core>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
call   1030 <rotate@plt>
movzbl (%rbx),%edi
call   1040 <sbox@plt>
mov    %al,(%rbx)
movzbl 0x1(%rbx),%edi
call   1040 <sbox@plt>
mov    %al,0x1(%rbx)
movzbl 0x2(%rbx),%edi
call   1040 <sbox@plt>
mov    %al,0x2(%rbx)
movzbl 0x3(%rbx),%edi
call   1040 <sbox@plt>
mov    %al,0x3(%rbx)
mov    %ebp,%edi
call   1050 <rcon@plt>
xor    %al,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @schedule_core(i8* %0, i8 zeroext %1) {
%3 = alloca i8*
%4 = alloca i8
%5 = alloca i8
store i8* %0, i8** %3
store i8 %1, i8* %4
%6 = load i8*, i8** %3
%7 = call i32 @rotate(i8* %6)
store i8 0, i8* %5
br label %8
8: ; preds = %23, %2
%9 = load i8, i8* %5
%10 = zext i8 %9 to i32
%11 = icmp slt i32 %10, 4
br i1 %11, label %12, label %26
12: ; preds = %8
%13 = load i8*, i8** %3
%14 = load i8, i8* %5
%15 = zext i8 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
%17 = load i8, i8* %16
%18 = call zeroext i8 @sbox(i8 zeroext %17)
%19 = load i8*, i8** %3
%20 = load i8, i8* %5
%21 = zext i8 %20 to i64
%22 = getelementptr inbounds i8, i8* %19, i64 %21
store i8 %18, i8* %22
br label %23
23: ; preds = %12
%24 = load i8, i8* %5
%25 = add i8 %24, 1
store i8 %25, i8* %5
br label %8
26: ; preds = %8
%27 = load i8, i8* %4
%28 = call zeroext i8 @rcon(i8 zeroext %27)
%29 = zext i8 %28 to i32
%30 = load i8*, i8** %3
%31 = getelementptr inbounds i8, i8* %30, i64 0
%32 = load i8, i8* %31
%33 = zext i8 %32 to i32
%34 = xor i32 %33, %29
%35 = trunc i32 %34 to i8
store i8 %35, i8* %31
ret void
}

LLVM IR (-O2):
define void @schedule_core(i8* %0, i8 zeroext %1) {
%3 = tail call i32 @rotate(i8* %0)
%4 = load i8, i8* %0
%5 = tail call zeroext i8 @sbox(i8 zeroext %4)
store i8 %5, i8* %0
%6 = getelementptr inbounds i8, i8* %0, i64 1
%7 = load i8, i8* %6
%8 = tail call zeroext i8 @sbox(i8 zeroext %7)
store i8 %8, i8* %6
%9 = getelementptr inbounds i8, i8* %0, i64 2
%10 = load i8, i8* %9
%11 = tail call zeroext i8 @sbox(i8 zeroext %10)
store i8 %11, i8* %9
%12 = getelementptr inbounds i8, i8* %0, i64 3
%13 = load i8, i8* %12
%14 = tail call zeroext i8 @sbox(i8 zeroext %13)
store i8 %14, i8* %12
%15 = tail call zeroext i8 @rcon(i8 zeroext %1)
%16 = load i8, i8* %0
%17 = xor i8 %16, %15
store i8 %17, i8* %0
ret void
}