#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*/ exit(int);
int /*<<< orphan*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
char *randomtest();
int showtest(char *);
int /*<<< orphan*/ stderr;
main(int argc, char *argv[]) {
  char *thistest;
  if (argc > 1)
    exit(showtest(argv[1]));
  thistest = randomtest();
  if (thistest == NULL)
    exit(-1);
  fprintf(stderr, "Selected test text is '%s'\n", thistest);
  fflush(stderr);
  exit(showtest(thistest));
}


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   $0x1,-0x8(%rbp)
jle    1184 <main+0x34>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <showtest@plt>
mov    %eax,%edi
call   1070 <exit@plt>
mov    $0x0,%al
call   1030 <randomtest@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x0,-0x18(%rbp)
jne    11a4 <main+0x54>
mov    $0xffffffff,%edi
call   1070 <exit@plt>
mov    0x2e35(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xe48(%rip),%rsi
call   1040 <fprintf@plt>
mov    0x2e1c(%rip),%rax
mov    (%rax),%edi
call   1060 <fflush@plt>
mov    -0x18(%rbp),%rdi
call   1050 <showtest@plt>
mov    %eax,%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
cmp    $0x2,%edi
jl     115f <main+0xf>
mov    0x8(%rsi),%rdi
jmp    119c <main+0x4c>
xor    %eax,%eax
call   1030 <randomtest@plt>
test   %rax,%rax
jne    1175 <main+0x25>
mov    $0xffffffff,%edi
call   1070 <exit@plt>
mov    %rax,%rbx
mov    0x2e61(%rip),%r14
mov    (%r14),%edi
lea    0xe77(%rip),%rsi
mov    %rax,%rdx
call   1040 <fprintf@plt>
mov    (%r14),%edi
call   1060 <fflush@plt>
mov    %rbx,%rdi
call   1050 <showtest@plt>
mov    %eax,%edi
call   1070 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [28 x i8] c"Selected test text is '%s'\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = load i32, i32* %4
%8 = icmp sgt i32 %7, 1
br i1 %8, label %9, label %15
9: ; preds = %2
%10 = load i8**, i8*** %5
%11 = getelementptr inbounds i8*, i8** %10, i64 1
%12 = load i8*, i8** %11
%13 = call i32 @showtest(i8* %12)
%14 = call i32 @exit(i32 %13)
unreachable
15: ; preds = %2
%16 = call i8* (...) @randomtest()
store i8* %16, i8** %6
%17 = load i8*, i8** %6
%18 = icmp eq i8* %17, null
br i1 %18, label %19, label %21
19: ; preds = %15
%20 = call i32 @exit(i32 -1)
unreachable
21: ; preds = %15
%22 = load i32, i32* @stderr
%23 = load i8*, i8** %6
%24 = call i32 @fprintf(i32 %22, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %23)
%25 = load i32, i32* @stderr
%26 = call i32 @fflush(i32 %25)
%27 = load i8*, i8** %6
%28 = call i32 @showtest(i8* %27)
%29 = call i32 @exit(i32 %28)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [28 x i8] c"Selected test text is '%s'\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1
br i1 %3, label %4, label %9
4: ; preds = %2
%5 = getelementptr inbounds i8*, i8** %1, i64 1
%6 = load i8*, i8** %5
%7 = tail call i32 @showtest(i8* %6)
%8 = tail call i32 @exit(i32 %7)
unreachable
9: ; preds = %2
%10 = tail call i8* (...) @randomtest()
%11 = icmp eq i8* %10, null
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = tail call i32 @exit(i32 -1)
unreachable
14: ; preds = %9
%15 = load i32, i32* @stderr
%16 = tail call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i8* %10)
%17 = load i32, i32* @stderr
%18 = tail call i32 @fflush(i32 %17)
%19 = tail call i32 @showtest(i8* %10)
%20 = tail call i32 @exit(i32 %19)
unreachable
}