#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*/ a;

/* Variables and functions */
int bogoSort(char *, char *, int);
int /*<<< orphan*/ printf(char *, int, char *);
int /*<<< orphan*/ srand(int /*<<< orphan*/);
int /*<<< orphan*/ time(int /*<<< orphan*/ *);
int main(void) {
  srand(time(NULL));
  char a[] = "lolhe", b[] = "hello";
  int num = bogoSort(a, b, sizeof(a) / sizeof(a[0]));
  printf("Number of iterations: %d\n%s", num, a);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
mov    0xea2(%rip),%eax
mov    %eax,-0x6(%rbp)
mov    0xe9c(%rip),%ax
mov    %ax,-0x2(%rbp)
mov    0xe94(%rip),%eax
mov    %eax,-0xc(%rbp)
mov    0xe8e(%rip),%ax
mov    %ax,-0x8(%rbp)
lea    -0x6(%rbp),%rdi
lea    -0xc(%rbp),%rsi
mov    $0x6,%edx
call   1030 <bogoSort@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    -0x6(%rbp),%rdx
lea    0xe69(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1050 <srand@plt>
movw   $0x65,0xc(%rsp)
movl   $0x686c6f6c,0x8(%rsp)
68
movw   $0x6f,0x4(%rsp)
movl   $0x6c6c6568,(%rsp)
lea    0x8(%rsp),%rbx
mov    %rsp,%rsi
mov    %rbx,%rdi
mov    $0x6,%edx
call   1030 <bogoSort@plt>
lea    0xe80(%rip),%rdi
mov    %eax,%esi
mov    %rbx,%rdx
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.a = [6 x i8] c"lolhe\00"
@__const.main.b = [6 x i8] c"hello\00"
@.str = [28 x i8] c"Number of iterations: %d\0A%s\00"
define i32 @main() {
%1 = alloca [6 x i8]
%2 = alloca [6 x i8]
%3 = alloca i32
%4 = call i32 @time(i32* null)
%5 = call i32 @srand(i32 %4)
%6 = bitcast [6 x i8]* %1 to i8*
%7 = bitcast [6 x i8]* %2 to i8*
%8 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 0
%9 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%10 = call i32 @bogoSort(i8* %8, i8* %9, i32 6)
store i32 %10, i32* %3
%11 = load i32, i32* %3
%12 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 0
%13 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %11, i8* %12)
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [6 x i8] c"lolhe\00"
@__const.main.b = [6 x i8] c"hello\00"
@.str = [28 x i8] c"Number of iterations: %d\0A%s\00"
define i32 @main() {
%1 = alloca [6 x i8]
%2 = alloca [6 x i8]
%3 = tail call i32 @time(i32* null)
%4 = tail call i32 @srand(i32 %3)
%5 = getelementptr inbounds [6 x i8], [6 x i8]* %1, i64 0, i64 0
%6 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%7 = call i32 @bogoSort(i8* %5, i8* %6, i32 6)
%8 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %7, i8* %5)
ret i32 0
}