#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 /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ show_cipher_info(char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ test_aes_cbc_dec();
int /*<<< orphan*/ test_aes_xts_enc();
int /*<<< orphan*/ test_sha256();
int main(void) {
  if (!test_sha256()) {
    fprintf(stderr, "SHA256 test failed.\n");
    return 1;
  }
  if (!test_aes_xts_enc()) {
    fprintf(stderr, "AES-XTS encryption test failed.\n");
    return 1;
  }
  if (!test_aes_cbc_dec()) {
    fprintf(stderr, "AES-CBC decryption test failed.\n");
    return 1;
  }
  if (!show_cipher_info("sha256")) {
    fprintf(stderr, "Failed to show information about sha256.\n");
    return 1;
  }
  if (!show_cipher_info("xts(aes)")) {
    fprintf(stderr, "Failed to show information about xts(aes).\n");
    return 1;
  }
  if (!show_cipher_info("ccm(aes)")) {
    fprintf(stderr, "Failed to show information about ccm(aes).\n");
    return 1;
  }
  if (!show_cipher_info("stdrng")) {
    fprintf(stderr, "Failed to show information about stdrng.\n");
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x0,%al
call   1060 <test_sha256@plt>
cmp    $0x0,%eax
jne    1190 <main+0x40>
mov    0x2e6a(%rip),%rax
mov    (%rax),%edi
lea    0xe81(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    12d1 <main+0x181>
mov    $0x0,%al
call   1030 <test_aes_xts_enc@plt>
cmp    $0x0,%eax
jne    11c1 <main+0x71>
mov    0x2e39(%rip),%rax
mov    (%rax),%edi
lea    0xe65(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    12d1 <main+0x181>
mov    $0x0,%al
call   1040 <test_aes_cbc_dec@plt>
cmp    $0x0,%eax
jne    11f2 <main+0xa2>
mov    0x2e08(%rip),%rax
mov    (%rax),%edi
lea    0xe55(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    12d1 <main+0x181>
lea    0xe5e(%rip),%rdi
call   1070 <show_cipher_info@plt>
cmp    $0x0,%eax
jne    1228 <main+0xd8>
mov    0x2dd2(%rip),%rax
mov    (%rax),%edi
lea    0xe47(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    12d1 <main+0x181>
lea    0xe59(%rip),%rdi
call   1070 <show_cipher_info@plt>
cmp    $0x0,%eax
jne    125e <main+0x10e>
mov    0x2d9c(%rip),%rax
mov    (%rax),%edi
lea    0xe44(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    12d1 <main+0x181>
lea    0xe58(%rip),%rdi
call   1070 <show_cipher_info@plt>
cmp    $0x0,%eax
jne    1294 <main+0x144>
mov    0x2d66(%rip),%rax
mov    (%rax),%edi
lea    0xe43(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    12d1 <main+0x181>
lea    0xe57(%rip),%rdi
call   1070 <show_cipher_info@plt>
cmp    $0x0,%eax
jne    12ca <main+0x17a>
mov    0x2d30(%rip),%rax
mov    (%rax),%edi
lea    0xe40(%rip),%rsi
call   1050 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    12d1 <main+0x181>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1060 <test_sha256@plt>
test   %eax,%eax
je     11bf <main+0x6f>
xor    %eax,%eax
call   1030 <test_aes_xts_enc@plt>
test   %eax,%eax
je     11c8 <main+0x78>
xor    %eax,%eax
call   1040 <test_aes_cbc_dec@plt>
test   %eax,%eax
je     11d1 <main+0x81>
lea    0xede(%rip),%rdi
call   1070 <show_cipher_info@plt>
test   %eax,%eax
je     11da <main+0x8a>
lea    0xeff(%rip),%rdi
call   1070 <show_cipher_info@plt>
test   %eax,%eax
je     11e3 <main+0x93>
lea    0xf24(%rip),%rdi
call   1070 <show_cipher_info@plt>
test   %eax,%eax
je     11ec <main+0x9c>
lea    0xf49(%rip),%rdi
call   1070 <show_cipher_info@plt>
mov    %eax,%ecx
xor    %eax,%eax
test   %ecx,%ecx
jne    1206 <main+0xb6>
lea    0xf3c(%rip),%rsi
jmp    11f3 <main+0xa3>
lea    0xe3a(%rip),%rsi
jmp    11f3 <main+0xa3>
lea    0xe46(%rip),%rsi
jmp    11f3 <main+0xa3>
lea    0xe5e(%rip),%rsi
jmp    11f3 <main+0xa3>
lea    0xe7d(%rip),%rsi
jmp    11f3 <main+0xa3>
lea    0xea7(%rip),%rsi
jmp    11f3 <main+0xa3>
lea    0xed3(%rip),%rsi
mov    0x2de6(%rip),%rax
mov    (%rax),%edi
call   1050 <fprintf@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
@stderr = global i32 0
@.str = [21 x i8] c"SHA256 test failed.\0A\00"
@.str.1 = [33 x i8] c"AES-XTS encryption test failed.\0A\00"
@.str.2 = [33 x i8] c"AES-CBC decryption test failed.\0A\00"
@.str.3 = [7 x i8] c"sha256\00"
@.str.4 = [42 x i8] c"Failed to show information about sha256.\0A\00"
@.str.5 = [9 x i8] c"xts(aes)\00"
@.str.6 = [44 x i8] c"Failed to show information about xts(aes).\0A\00"
@.str.7 = [9 x i8] c"ccm(aes)\00"
@.str.8 = [44 x i8] c"Failed to show information about ccm(aes).\0A\00"
@.str.9 = [7 x i8] c"stdrng\00"
@.str.10 = [42 x i8] c"Failed to show information about stdrng.\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 (...) @test_sha256()
%3 = icmp ne i32 %2, 0
br i1 %3, label %7, label %4
4: ; preds = %0
%5 = load i32, i32* @stderr
%6 = call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %1
br label %44
7: ; preds = %0
%8 = call i32 (...) @test_aes_xts_enc()
%9 = icmp ne i32 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %7
%11 = load i32, i32* @stderr
%12 = call i32 @fprintf(i32 %11, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %1
br label %44
13: ; preds = %7
%14 = call i32 (...) @test_aes_cbc_dec()
%15 = icmp ne i32 %14, 0
br i1 %15, label %19, label %16
16: ; preds = %13
%17 = load i32, i32* @stderr
%18 = call i32 @fprintf(i32 %17, i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %1
br label %44
19: ; preds = %13
%20 = call i32 @show_cipher_info(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%21 = icmp ne i32 %20, 0
br i1 %21, label %25, label %22
22: ; preds = %19
%23 = load i32, i32* @stderr
%24 = call i32 @fprintf(i32 %23, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0))
store i32 1, i32* %1
br label %44
25: ; preds = %19
%26 = call i32 @show_cipher_info(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
%27 = icmp ne i32 %26, 0
br i1 %27, label %31, label %28
28: ; preds = %25
%29 = load i32, i32* @stderr
%30 = call i32 @fprintf(i32 %29, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.6, i64 0, i64 0))
store i32 1, i32* %1
br label %44
31: ; preds = %25
%32 = call i32 @show_cipher_info(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
%33 = icmp ne i32 %32, 0
br i1 %33, label %37, label %34
34: ; preds = %31
%35 = load i32, i32* @stderr
%36 = call i32 @fprintf(i32 %35, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.8, i64 0, i64 0))
store i32 1, i32* %1
br label %44
37: ; preds = %31
%38 = call i32 @show_cipher_info(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
%39 = icmp ne i32 %38, 0
br i1 %39, label %43, label %40
40: ; preds = %37
%41 = load i32, i32* @stderr
%42 = call i32 @fprintf(i32 %41, i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.10, i64 0, i64 0))
store i32 1, i32* %1
br label %44
43: ; preds = %37
store i32 0, i32* %1
br label %44
44: ; preds = %43, %40, %34, %28, %22, %16, %10, %4
%45 = load i32, i32* %1
ret i32 %45
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [21 x i8] c"SHA256 test failed.\0A\00"
@.str.1 = [33 x i8] c"AES-XTS encryption test failed.\0A\00"
@.str.2 = [33 x i8] c"AES-CBC decryption test failed.\0A\00"
@.str.3 = [7 x i8] c"sha256\00"
@.str.4 = [42 x i8] c"Failed to show information about sha256.\0A\00"
@.str.5 = [9 x i8] c"xts(aes)\00"
@.str.6 = [44 x i8] c"Failed to show information about xts(aes).\0A\00"
@.str.7 = [9 x i8] c"ccm(aes)\00"
@.str.8 = [44 x i8] c"Failed to show information about ccm(aes).\0A\00"
@.str.9 = [7 x i8] c"stdrng\00"
@.str.10 = [42 x i8] c"Failed to show information about stdrng.\0A\00"
define i32 @main() {
%1 = tail call i32 (...) @test_sha256()
%2 = icmp eq i32 %1, 0
br i1 %2, label %21, label %3
3: ; preds = %0
%4 = tail call i32 (...) @test_aes_xts_enc()
%5 = icmp eq i32 %4, 0
br i1 %5, label %21, label %6
6: ; preds = %3
%7 = tail call i32 (...) @test_aes_cbc_dec()
%8 = icmp eq i32 %7, 0
br i1 %8, label %21, label %9
9: ; preds = %6
%10 = tail call i32 @show_cipher_info(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0))
%11 = icmp eq i32 %10, 0
br i1 %11, label %21, label %12
12: ; preds = %9
%13 = tail call i32 @show_cipher_info(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.5, i64 0, i64 0))
%14 = icmp eq i32 %13, 0
br i1 %14, label %21, label %15
15: ; preds = %12
%16 = tail call i32 @show_cipher_info(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.7, i64 0, i64 0))
%17 = icmp eq i32 %16, 0
br i1 %17, label %21, label %18
18: ; preds = %15
%19 = tail call i32 @show_cipher_info(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.9, i64 0, i64 0))
%20 = icmp eq i32 %19, 0
br i1 %20, label %21, label %25
21: ; preds = %18, %15, %12, %9, %6, %3, %0
%22 = phi i8* [ getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), %0 ], [ getelementptr inbounds ([33 x i8], [33 x i8]* @.str.1, i64 0, i64 0), %3 ], [ getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), %6 ], [ getelementptr inbounds ([42 x i8], [42 x i8]* @.str.4, i64 0, i64 0), %9 ], [ getelementptr inbounds ([44 x i8], [44 x i8]* @.str.6, i64 0, i64 0), %12 ], [ getelementptr inbounds ([44 x i8], [44 x i8]* @.str.8, i64 0, i64 0), %15 ], [ getelementptr inbounds ([42 x i8], [42 x i8]* @.str.10, i64 0, i64 0), %18 ]
%23 = load i32, i32* @stderr
%24 = tail call i32 @fprintf(i32 %23, i8* %22)
br label %25
25: ; preds = %21, %18
%26 = phi i32 [ 0, %18 ], [ 1, %21 ]
ret i32 %26
}