#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 atoi(char *);
scalar_t__ check_arb(int const);
scalar_t__ check_arf(int const);
scalar_t__ check_cb(int const);
scalar_t__ check_cf(int const);
scalar_t__ check_rb(int const);
scalar_t__ check_rf(int const);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(int argc, char **argv) {
  if (argc != 2) {
    fprintf(stderr, "%s <log2n>\n", argv[0]);
    exit(-1);
  }
  const int n = 1 << atoi(argv[1]);
  srand(time(NULL));
  printf("complex  forward   : %s\n", check_cf(n) ? "OK" : "NG");
  printf("complex  backward  : %s\n", check_cb(n) ? "OK" : "NG");
  printf("real     forward   : %s\n", check_rf(n) ? "OK" : "NG");
  printf("real     backward  : %s\n", check_rb(n) ? "OK" : "NG");
  printf("real alt forward   : %s\n", check_arf(n) ? "OK" : "NG");
  printf("real alt backward  : %s\n", check_arb(n) ? "OK" : "NG");
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1206 <main+0x46>
mov    0x2df9(%rip),%rax
mov    (%rax),%edi
mov    -0x10(%rbp),%rax
mov    (%rax),%rdx
lea    0xe09(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0xffffffff,%edi
call   10e0 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   10d0 <atoi@plt>
mov    %eax,%ecx
mov    $0x1,%eax
shl    %cl,%eax
mov    %eax,-0x14(%rbp)
xor    %eax,%eax
mov    %eax,%edi
call   10b0 <time@plt>
mov    %eax,%edi
call   1070 <srand@plt>
mov    -0x14(%rbp),%edi
call   10c0 <check_cf@plt>
mov    %rax,%rcx
lea    0xde7(%rip),%rsi
lea    0xddd(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rsi
lea    0xdb5(%rip),%rdi
call   1060 <printf@plt>
mov    -0x14(%rbp),%edi
call   1050 <check_cb@plt>
mov    %rax,%rcx
lea    0xdba(%rip),%rsi
lea    0xdb0(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rsi
lea    0xda7(%rip),%rdi
call   1060 <printf@plt>
mov    -0x14(%rbp),%edi
call   1080 <check_rf@plt>
mov    %rax,%rcx
lea    0xd8d(%rip),%rsi
lea    0xd83(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rsi
lea    0xd93(%rip),%rdi
call   1060 <printf@plt>
mov    -0x14(%rbp),%edi
call   1090 <check_rb@plt>
mov    %rax,%rcx
lea    0xd60(%rip),%rsi
lea    0xd56(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rsi
lea    0xd7f(%rip),%rdi
call   1060 <printf@plt>
mov    -0x14(%rbp),%edi
call   1040 <check_arf@plt>
mov    %rax,%rcx
lea    0xd33(%rip),%rsi
lea    0xd29(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rsi
lea    0xd6b(%rip),%rdi
call   1060 <printf@plt>
mov    -0x14(%rbp),%edi
call   1030 <check_arb@plt>
mov    %rax,%rcx
lea    0xd06(%rip),%rsi
lea    0xcfc(%rip),%rax
cmp    $0x0,%rcx
cmovne %rax,%rsi
lea    0xd57(%rip),%rdi
call   1060 <printf@plt>
xor    %edi,%edi
call   10e0 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
cmp    $0x2,%edi
jne    12b0 <main+0xf0>
mov    0x8(%rsi),%rdi
call   10d0 <atoi@plt>
mov    $0x1,%ebp
mov    %eax,%ecx
shl    %cl,%ebp
xor    %edi,%edi
call   10b0 <time@plt>
mov    %eax,%edi
call   1070 <srand@plt>
mov    %ebp,%edi
call   10c0 <check_cf@plt>
test   %rax,%rax
lea    0xe2a(%rip),%r14
lea    0xe20(%rip),%rbx
mov    %rbx,%rsi
cmove  %r14,%rsi
lea    0xdf9(%rip),%rdi
call   1060 <printf@plt>
mov    %ebp,%edi
call   1050 <check_cb@plt>
test   %rax,%rax
mov    %rbx,%rsi
cmove  %r14,%rsi
lea    0xdfb(%rip),%rdi
call   1060 <printf@plt>
mov    %ebp,%edi
call   1080 <check_rf@plt>
test   %rax,%rax
mov    %rbx,%rsi
cmove  %r14,%rsi
lea    0xdf7(%rip),%rdi
call   1060 <printf@plt>
mov    %ebp,%edi
call   1090 <check_rb@plt>
test   %rax,%rax
mov    %rbx,%rsi
cmove  %r14,%rsi
lea    0xdf3(%rip),%rdi
call   1060 <printf@plt>
mov    %ebp,%edi
call   1040 <check_arf@plt>
test   %rax,%rax
mov    %rbx,%rsi
cmove  %r14,%rsi
lea    0xdef(%rip),%rdi
call   1060 <printf@plt>
mov    %ebp,%edi
call   1030 <check_arb@plt>
test   %rax,%rax
cmove  %r14,%rbx
lea    0xdee(%rip),%rdi
mov    %rbx,%rsi
call   1060 <printf@plt>
xor    %edi,%edi
call   10e0 <exit@plt>
mov    0x2d29(%rip),%rax
mov    (%rax),%edi
mov    (%rsi),%rdx
lea    0xd3d(%rip),%rsi
call   10a0 <fprintf@plt>
mov    $0xffffffff,%edi
call   10e0 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [12 x i8] c"%s <log2n>\0A\00"
@.str.1 = [25 x i8] c"complex forward : %s\0A\00"
@.str.2 = [3 x i8] c"OK\00"
@.str.3 = [3 x i8] c"NG\00"
@.str.4 = [25 x i8] c"complex backward : %s\0A\00"
@.str.5 = [25 x i8] c"real forward : %s\0A\00"
@.str.6 = [25 x i8] c"real backward : %s\0A\00"
@.str.7 = [25 x i8] c"real alt forward : %s\0A\00"
@.str.8 = [25 x i8] c"real alt backward : %s\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp ne i32 %7, 2
br i1 %8, label %9, label %16
9: ; preds = %2
%10 = load i32, i32* @stderr
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 0
%13 = load i8*, i8** %12
%14 = call i32 @fprintf(i32 %10, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = call i32 @exit(i32 -1)
unreachable
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i32 @atoi(i8* %19)
%21 = shl i32 1, %20
store i32 %21, i32* %6
%22 = call i32 @time(i32* null)
%23 = call i32 @srand(i32 %22)
%24 = load i32, i32* %6
%25 = call i64 @check_cf(i32 %24)
%26 = icmp ne i64 %25, 0
%27 = zext i1 %26 to i64
%28 = select i1 %26, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0)
%29 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %28)
%30 = load i32, i32* %6
%31 = call i64 @check_cb(i32 %30)
%32 = icmp ne i64 %31, 0
%33 = zext i1 %32 to i64
%34 = select i1 %32, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0)
%35 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i8* %34)
%36 = load i32, i32* %6
%37 = call i64 @check_rf(i32 %36)
%38 = icmp ne i64 %37, 0
%39 = zext i1 %38 to i64
%40 = select i1 %38, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0)
%41 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i8* %40)
%42 = load i32, i32* %6
%43 = call i64 @check_rb(i32 %42)
%44 = icmp ne i64 %43, 0
%45 = zext i1 %44 to i64
%46 = select i1 %44, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0)
%47 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0), i8* %46)
%48 = load i32, i32* %6
%49 = call i64 @check_arf(i32 %48)
%50 = icmp ne i64 %49, 0
%51 = zext i1 %50 to i64
%52 = select i1 %50, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0)
%53 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i8* %52)
%54 = load i32, i32* %6
%55 = call i64 @check_arb(i32 %54)
%56 = icmp ne i64 %55, 0
%57 = zext i1 %56 to i64
%58 = select i1 %56, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0)
%59 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), i8* %58)
%60 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [12 x i8] c"%s <log2n>\0A\00"
@.str.1 = [25 x i8] c"complex forward : %s\0A\00"
@.str.2 = [3 x i8] c"OK\00"
@.str.3 = [3 x i8] c"NG\00"
@.str.4 = [25 x i8] c"complex backward : %s\0A\00"
@.str.5 = [25 x i8] c"real forward : %s\0A\00"
@.str.6 = [25 x i8] c"real backward : %s\0A\00"
@.str.7 = [25 x i8] c"real alt forward : %s\0A\00"
@.str.8 = [25 x i8] c"real alt backward : %s\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %9, label %4
4: ; preds = %2
%5 = load i32, i32* @stderr
%6 = load i8*, i8** %1
%7 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* %6)
%8 = tail call i32 @exit(i32 -1)
unreachable
9: ; preds = %2
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = tail call i32 @atoi(i8* %11)
%13 = shl nuw i32 1, %12
%14 = tail call i32 @time(i32* null)
%15 = tail call i32 @srand(i32 %14)
%16 = tail call i64 @check_cf(i32 %13)
%17 = icmp eq i64 %16, 0
%18 = select i1 %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%19 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0), i8* %18)
%20 = tail call i64 @check_cb(i32 %13)
%21 = icmp eq i64 %20, 0
%22 = select i1 %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%23 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.4, i64 0, i64 0), i8* %22)
%24 = tail call i64 @check_rf(i32 %13)
%25 = icmp eq i64 %24, 0
%26 = select i1 %25, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%27 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.5, i64 0, i64 0), i8* %26)
%28 = tail call i64 @check_rb(i32 %13)
%29 = icmp eq i64 %28, 0
%30 = select i1 %29, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%31 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.6, i64 0, i64 0), i8* %30)
%32 = tail call i64 @check_arf(i32 %13)
%33 = icmp eq i64 %32, 0
%34 = select i1 %33, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%35 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.7, i64 0, i64 0), i8* %34)
%36 = tail call i64 @check_arb(i32 %13)
%37 = icmp eq i64 %36, 0
%38 = select i1 %37, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%39 = tail call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.8, i64 0, i64 0), i8* %38)
%40 = tail call i32 @exit(i32 0)
unreachable
}