#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 int /*<<< orphan*/ CAMELLIA_KEY;

/* Variables and functions */
int const CAMELLIA_DECRYPT;
int const CAMELLIA_ENCRYPT;
int /*<<< orphan*/ Camellia_decrypt(unsigned char const *, unsigned char *,
                                    int /*<<< orphan*/ const *);
int /*<<< orphan*/ Camellia_encrypt(unsigned char const *, unsigned char *,
                                    int /*<<< orphan*/ const *);
int /*<<< orphan*/ assert(int);
void Camellia_ecb_encrypt(const unsigned char *in, unsigned char *out,
                          const CAMELLIA_KEY *key, const int enc) {
  assert(in && out && key);
  assert((CAMELLIA_ENCRYPT == enc) || (CAMELLIA_DECRYPT == enc));
  if (CAMELLIA_ENCRYPT == enc)
    Camellia_encrypt(in, out, key);
  else
    Camellia_decrypt(in, out, key);
}


x86 assembly (clang, -O0):
<Camellia_ecb_encrypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
xor    %eax,%eax
cmpq   $0x0,-0x8(%rbp)
mov    %al,-0x1d(%rbp)
je     1172 <Camellia_ecb_encrypt+0x42>
xor    %eax,%eax
cmpq   $0x0,-0x10(%rbp)
mov    %al,-0x1d(%rbp)
je     1172 <Camellia_ecb_encrypt+0x42>
cmpq   $0x0,-0x18(%rbp)
setne  %al
mov    %al,-0x1d(%rbp)
mov    -0x1d(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    0x2e62(%rip),%rax
mov    (%rax),%ecx
mov    $0x1,%al
cmp    -0x1c(%rbp),%ecx
mov    %al,-0x1e(%rbp)
je     11a8 <Camellia_ecb_encrypt+0x78>
mov    0x2e43(%rip),%rax
mov    (%rax),%eax
cmp    -0x1c(%rbp),%eax
sete   %al
mov    %al,-0x1e(%rbp)
mov    -0x1e(%rbp),%al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    0x2e2c(%rip),%rax
mov    (%rax),%eax
cmp    -0x1c(%rbp),%eax
jne    11dd <Camellia_ecb_encrypt+0xad>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1050 <Camellia_encrypt@plt>
jmp    11ee <Camellia_ecb_encrypt+0xbe>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <Camellia_decrypt@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Camellia_ecb_encrypt>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %ecx,%ebp
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
test   %rdi,%rdi
setne  %al
test   %rsi,%rsi
setne  %cl
and    %al,%cl
test   %rdx,%rdx
setne  %al
and    %cl,%al
movzbl %al,%edi
call   1040 <assert@plt>
xor    %edi,%edi
test   %ebp,%ebp
sete   %dil
call   1040 <assert@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
add    $0x8,%rsp
test   %ebp,%ebp
je     1189 <Camellia_ecb_encrypt+0x59>
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <Camellia_decrypt@plt>
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <Camellia_encrypt@plt>

LLVM IR (-O0):
@CAMELLIA_ENCRYPT = constant i32 0
@CAMELLIA_DECRYPT = constant i32 0
define void @Camellia_ecb_encrypt(i8* %0, i8* %1, i32* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32*
%8 = alloca i32
store i8* %0, i8** %5
store i8* %1, i8** %6
store i32* %2, i32** %7
store i32 %3, i32* %8
%9 = load i8*, i8** %5
%10 = icmp ne i8* %9, null
br i1 %10, label %11, label %17
11: ; preds = %4
%12 = load i8*, i8** %6
%13 = icmp ne i8* %12, null
br i1 %13, label %14, label %17
14: ; preds = %11
%15 = load i32*, i32** %7
%16 = icmp ne i32* %15, null
br label %17
17: ; preds = %14, %11, %4
%18 = phi i1 [ false, %11 ], [ false, %4 ], [ %16, %14 ]
%19 = zext i1 %18 to i32
%20 = call i32 @assert(i32 %19)
%21 = load i32, i32* @CAMELLIA_ENCRYPT
%22 = load i32, i32* %8
%23 = icmp eq i32 %21, %22
br i1 %23, label %28, label %24
24: ; preds = %17
%25 = load i32, i32* @CAMELLIA_DECRYPT
%26 = load i32, i32* %8
%27 = icmp eq i32 %25, %26
br label %28
28: ; preds = %24, %17
%29 = phi i1 [ true, %17 ], [ %27, %24 ]
%30 = zext i1 %29 to i32
%31 = call i32 @assert(i32 %30)
%32 = load i32, i32* @CAMELLIA_ENCRYPT
%33 = load i32, i32* %8
%34 = icmp eq i32 %32, %33
br i1 %34, label %35, label %40
35: ; preds = %28
%36 = load i8*, i8** %5
%37 = load i8*, i8** %6
%38 = load i32*, i32** %7
%39 = call i32 @Camellia_encrypt(i8* %36, i8* %37, i32* %38)
br label %45
40: ; preds = %28
%41 = load i8*, i8** %5
%42 = load i8*, i8** %6
%43 = load i32*, i32** %7
%44 = call i32 @Camellia_decrypt(i8* %41, i8* %42, i32* %43)
br label %45
45: ; preds = %40, %35
ret void
}

LLVM IR (-O2):
@CAMELLIA_ENCRYPT = constant i32 0
@CAMELLIA_DECRYPT = constant i32 0
define void @Camellia_ecb_encrypt(i8* %0, i8* %1, i32* %2, i32 %3) {
%5 = icmp ne i8* %0, null
%6 = icmp ne i8* %1, null
%7 = and i1 %5, %6
%8 = icmp ne i32* %2, null
%9 = and i1 %7, %8
%10 = zext i1 %9 to i32
%11 = tail call i32 @assert(i32 %10)
%12 = icmp eq i32 %3, 0
%13 = zext i1 %12 to i32
%14 = tail call i32 @assert(i32 %13)
br i1 %12, label %15, label %17
15: ; preds = %4
%16 = tail call i32 @Camellia_encrypt(i8* %0, i8* %1, i32* %2)
br label %19
17: ; preds = %4
%18 = tail call i32 @Camellia_decrypt(i8* %0, i8* %1, i32* %2)
br label %19
19: ; preds = %17, %15
ret void
}