#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 aes_test_mode_cbc(int);
int aes_test_mode_cfb128(int);
int aes_test_mode_ecb(int);
int aes_self_test(int verbose) {
  int ret;
  ret = aes_test_mode_ecb(verbose);
  if (ret != 0)
    return (ret);
  ret = aes_test_mode_cbc(verbose);
  if (ret != 0)
    return (ret);
  ret = aes_test_mode_cfb128(verbose);
  if (ret != 0)
    return (ret);
  return (0);
}


x86 assembly (clang, -O0):
<aes_self_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    -0x8(%rbp),%edi
call   1040 <aes_test_mode_ecb@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     115b <aes_self_test+0x2b>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11a2 <aes_self_test+0x72>
mov    -0x8(%rbp),%edi
call   1050 <aes_test_mode_cbc@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     117b <aes_self_test+0x4b>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11a2 <aes_self_test+0x72>
mov    -0x8(%rbp),%edi
call   1030 <aes_test_mode_cfb128@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     119b <aes_self_test+0x6b>
mov    -0xc(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    11a2 <aes_self_test+0x72>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<aes_self_test>:
push   %rbx
mov    %edi,%ebx
call   1040 <aes_test_mode_ecb@plt>
test   %eax,%eax
jne    1147 <aes_self_test+0x17>
mov    %ebx,%edi
call   1050 <aes_test_mode_cbc@plt>
test   %eax,%eax
je     1149 <aes_self_test+0x19>
pop    %rbx
ret
mov    %ebx,%edi
pop    %rbx
jmp    1030 <aes_test_mode_cfb128@plt>

LLVM IR (-O0):
define i32 @aes_self_test(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
%5 = load i32, i32* %3
%6 = call i32 @aes_test_mode_ecb(i32 %5)
store i32 %6, i32* %4
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %1
%10 = load i32, i32* %4
store i32 %10, i32* %2
br label %26
11: ; preds = %1
%12 = load i32, i32* %3
%13 = call i32 @aes_test_mode_cbc(i32 %12)
store i32 %13, i32* %4
%14 = load i32, i32* %4
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %11
%17 = load i32, i32* %4
store i32 %17, i32* %2
br label %26
18: ; preds = %11
%19 = load i32, i32* %3
%20 = call i32 @aes_test_mode_cfb128(i32 %19)
store i32 %20, i32* %4
%21 = load i32, i32* %4
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %18
%24 = load i32, i32* %4
store i32 %24, i32* %2
br label %26
25: ; preds = %18
store i32 0, i32* %2
br label %26
26: ; preds = %25, %23, %16, %9
%27 = load i32, i32* %2
ret i32 %27
}

LLVM IR (-O2):
define i32 @aes_self_test(i32 %0) {
%2 = tail call i32 @aes_test_mode_ecb(i32 %0)
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %9
4: ; preds = %1
%5 = tail call i32 @aes_test_mode_cbc(i32 %0)
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %9
7: ; preds = %4
%8 = tail call i32 @aes_test_mode_cfb128(i32 %0)
br label %9
9: ; preds = %7, %4, %1
%10 = phi i32 [ %2, %1 ], [ %5, %4 ], [ %8, %7 ]
ret i32 %10
}