void random_int_permutation(const int size, int *iarray, int *oarray) {
  int i, j = 0;
  int pos;
  if (!iarray || !oarray) {
    printf("FATAL ERROR: %s\nin %s at \"%s\" line %d\n",
           ("NULL pointer to int array passed."), __PRETTY_FUNCTION__,
           "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
           "2022-01-22/02-19-57/repos/versionzero/gaul/refs/heads/master/util/"
           "random_util.c",
           832);
    fflush(((void *)0));
    abort();
  };
  for (i = size - 1; i > 0; i--) {
    pos = random_int(i);
    oarray[j++] = iarray[pos];
    iarray[pos] = iarray[i];
  }
  oarray[j] = iarray[0];
  return;
}


x86 assembly (clang, -O0):
<random_int_permutation>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x20(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1170 <random_int_permutation+0x30>
cmpq   $0x0,-0x18(%rbp)
jne    11a9 <random_int_permutation+0x69>
lea    0xe89(%rip),%rdi
lea    0xea9(%rip),%rsi
lea    0xec4(%rip),%rdx
lea    0xef2(%rip),%rcx
mov    $0x340,%r8d
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
mov    %eax,%edi
mov    $0x0,%al
call   1050 <fflush@plt>
call   1030 <abort@plt>
mov    -0x4(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jle    120d <random_int_permutation+0xcd>
mov    -0x1c(%rbp),%edi
mov    $0x0,%al
call   1060 <random_int@plt>
mov    %eax,-0x24(%rbp)
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x18(%rbp),%rax
mov    -0x20(%rbp),%ecx
mov    %ecx,%esi
add    $0x1,%esi
mov    %esi,-0x20(%rbp)
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
jmp    11b2 <random_int_permutation+0x72>
mov    -0x10(%rbp),%rax
mov    (%rax),%edx
mov    -0x18(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    %edx,(%rax,%rcx,4)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<random_int_permutation>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %rsi,%rsi
je     11c7 <random_int_permutation+0x87>
mov    %rdx,%r14
test   %rdx,%rdx
je     11c7 <random_int_permutation+0x87>
mov    %rsi,%r12
mov    %edi,%r15d
cmp    $0x2,%edi
jl     11ad <random_int_permutation+0x6d>
mov    %r15d,%r13d
add    $0xffffffff,%r15d
add    $0xffffffffffffffff,%r13
mov    %r15,%rbx
mov    %r14,%rbp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %ebx,%edi
xor    %eax,%eax
call   1060 <random_int@plt>
cltq
mov    (%r12,%rax,4),%ecx
mov    %ecx,0x0(%rbp)
mov    %r13d,%ecx
mov    (%r12,%rcx,4),%ecx
mov    %ecx,(%r12,%rax,4)
add    $0x4,%rbp
add    $0xffffffffffffffff,%r13
add    $0xffffffffffffffff,%rbx
jne    1180 <random_int_permutation+0x40>
jmp    11b0 <random_int_permutation+0x70>
xor    %r15d,%r15d
mov    (%r12),%eax
mov    %eax,(%r14,%r15,4)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret
lea    0xe32(%rip),%rdi
lea    0xe52(%rip),%rsi
lea    0xe6d(%rip),%rdx
lea    0xe9b(%rip),%rcx
mov    $0x340,%r8d
xor    %eax,%eax
call   1040 <printf@plt>
xor    %edi,%edi
xor    %eax,%eax
call   1050 <fflush@plt>
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [39 x i8] c"FATAL ERROR: %s\0Ain %s at \22%s\22 line %d\0A\00"
@.str.1 = [34 x i8] c"NULL pointer to int array passed.\00"
@__PRETTY_FUNCTION__.random_int_permutation = [53 x i8] c"void random_int_permutation(const int, int *, int *)\00"
@.str.2 = [144 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/versionzero/gaul/refs/heads/master/util/random_util.c\00"
define void @random_int_permutation(i32 %0, i32* %1, i32* %2) {
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %4
store i32* %1, i32** %5
store i32* %2, i32** %6
store i32 0, i32* %8
%10 = load i32*, i32** %5
%11 = icmp ne i32* %10, null
br i1 %11, label %12, label %15
12: ; preds = %3
%13 = load i32*, i32** %6
%14 = icmp ne i32* %13, null
br i1 %14, label %18, label %15
15: ; preds = %12, %3
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([53 x i8], [53 x i8]* @__PRETTY_FUNCTION__.random_int_permutation, i64 0, i64 0), i8* getelementptr inbounds ([144 x i8], [144 x i8]* @.str.2, i64 0, i64 0), i32 832)
%17 = call i32 (i8*, ...) bitcast (i32 (...)* @fflush to i32 (i8*, ...)*)(i8* null)
unreachable
18: ; preds = %12
%19 = load i32, i32* %4
%20 = sub nsw i32 %19, 1
store i32 %20, i32* %7
br label %21
21: ; preds = %46, %18
%22 = load i32, i32* %7
%23 = icmp sgt i32 %22, 0
br i1 %23, label %24, label %49
24: ; preds = %21
%25 = load i32, i32* %7
%26 = call i32 (i32, ...) bitcast (i32 (...)* @random_int to i32 (i32, ...)*)(i32 %25)
store i32 %26, i32* %9
%27 = load i32*, i32** %5
%28 = load i32, i32* %9
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i32, i32* %27, i64 %29
%31 = load i32, i32* %30
%32 = load i32*, i32** %6
%33 = load i32, i32* %8
%34 = add nsw i32 %33, 1
store i32 %34, i32* %8
%35 = sext i32 %33 to i64
%36 = getelementptr inbounds i32, i32* %32, i64 %35
store i32 %31, i32* %36
%37 = load i32*, i32** %5
%38 = load i32, i32* %7
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i32, i32* %37, i64 %39
%41 = load i32, i32* %40
%42 = load i32*, i32** %5
%43 = load i32, i32* %9
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i32, i32* %42, i64 %44
store i32 %41, i32* %45
br label %46
46: ; preds = %24
%47 = load i32, i32* %7
%48 = add nsw i32 %47, -1
store i32 %48, i32* %7
br label %21
49: ; preds = %21
%50 = load i32*, i32** %5
%51 = getelementptr inbounds i32, i32* %50, i64 0
%52 = load i32, i32* %51
%53 = load i32*, i32** %6
%54 = load i32, i32* %8
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds i32, i32* %53, i64 %55
store i32 %52, i32* %56
ret void
}

LLVM IR (-O2):
@.str = [39 x i8] c"FATAL ERROR: %s\0Ain %s at \22%s\22 line %d\0A\00"
@.str.1 = [34 x i8] c"NULL pointer to int array passed.\00"
@__PRETTY_FUNCTION__.random_int_permutation = [53 x i8] c"void random_int_permutation(const int, int *, int *)\00"
@.str.2 = [144 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/versionzero/gaul/refs/heads/master/util/random_util.c\00"
define void @random_int_permutation(i32 %0, i32* %1, i32* writeonly %2) {
%4 = icmp ne i32* %1, null
%5 = icmp ne i32* %2, null
%6 = and i1 %4, %5
br i1 %6, label %7, label %13
7: ; preds = %3
%8 = icmp sgt i32 %0, 1
br i1 %8, label %9, label %33
9: ; preds = %7
%10 = zext i32 %0 to i64
%11 = add nsw i32 %0, -1
%12 = zext i32 %11 to i64
br label %16
13: ; preds = %3
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([53 x i8], [53 x i8]* @__PRETTY_FUNCTION__.random_int_permutation, i64 0, i64 0), i8* getelementptr inbounds ([144 x i8], [144 x i8]* @.str.2, i64 0, i64 0), i32 832)
%15 = tail call i32 (i8*, ...) bitcast (i32 (...)* @fflush to i32 (i8*, ...)*)(i8* null)
tail call void @abort()
unreachable
16: ; preds = %9, %16
%17 = phi i64 [ 0, %9 ], [ %25, %16 ]
%18 = phi i64 [ %10, %9 ], [ %19, %16 ]
%19 = add nsw i64 %18, -1
%20 = trunc i64 %19 to i32
%21 = tail call i32 (i32, ...) bitcast (i32 (...)* @random_int to i32 (i32, ...)*)(i32 %20)
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i32, i32* %1, i64 %22
%24 = load i32, i32* %23
%25 = add nuw nsw i64 %17, 1
%26 = getelementptr inbounds i32, i32* %2, i64 %17
store i32 %24, i32* %26
%27 = and i64 %19, 4294967295
%28 = getelementptr inbounds i32, i32* %1, i64 %27
%29 = load i32, i32* %28
store i32 %29, i32* %23
%30 = icmp eq i64 %25, %12
br i1 %30, label %31, label %16
31: ; preds = %16
%32 = zext i32 %11 to i64
br label %33
33: ; preds = %7, %31
%34 = phi i64 [ %32, %31 ], [ 0, %7 ]
%35 = load i32, i32* %1
%36 = getelementptr inbounds i32, i32* %2, i64 %34
store i32 %35, i32* %36
ret void
}