#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*/ min_max(int *, int, int *, int *);
int /*<<< orphan*/ printf(char *, int, ...);
int rand();
int /*<<< orphan*/ srand(unsigned int);
scalar_t__ time(int /*<<< orphan*/ *);
void main() {
  srand((unsigned)time(NULL));
  int array[3], max = 0, min = 0, i;
  for (i = 0; i < 3; i++)
    array[i] = rand() % 10;
  for (i = 0; i < 3; i++)
    printf("%d ", array[i]);
  min_max(array, 3, &min, &max);
  printf("\nmin: %d \nmax: %d", min, max);
  return;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
xor    %eax,%eax
mov    %eax,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
cmpl   $0x3,-0x18(%rbp)
jge    11ac <main+0x5c>
mov    $0x0,%al
call   1070 <rand@plt>
mov    $0xa,%ecx
cltd
idiv   %ecx
movslq -0x18(%rbp),%rax
mov    %edx,-0xc(%rbp,%rax,4)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    117d <main+0x2d>
movl   $0x0,-0x18(%rbp)
cmpl   $0x3,-0x18(%rbp)
jge    11e1 <main+0x91>
movslq -0x18(%rbp),%rax
mov    -0xc(%rbp,%rax,4),%esi
lea    0xe34(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11b3 <main+0x63>
lea    -0xc(%rbp),%rdi
mov    $0x3,%esi
lea    -0x14(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1050 <min_max@plt>
mov    -0x14(%rbp),%esi
mov    -0x10(%rbp),%edx
lea    0xe00(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
xor    %edi,%edi
call   1060 <time@plt>
mov    %eax,%edi
call   1040 <srand@plt>
movl   $0x0,0x8(%rsp)
movl   $0x0,0x4(%rsp)
xor    %eax,%eax
call   1070 <rand@plt>
movslq %eax,%r14
imul   $0x66666667,%r14,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%r14d
mov    %r14d,0xc(%rsp)
xor    %eax,%eax
call   1070 <rand@plt>
movslq %eax,%r15
imul   $0x66666667,%r15,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%r15d
mov    %r15d,0x10(%rsp)
xor    %eax,%eax
call   1070 <rand@plt>
movslq %eax,%rbx
imul   $0x66666667,%rbx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x22,%rax
add    %ecx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%ebx
mov    %ebx,0x14(%rsp)
lea    0xe01(%rip),%r12
mov    %r12,%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %r12,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xc(%rsp),%rdi
lea    0x4(%rsp),%rdx
lea    0x8(%rsp),%rcx
mov    $0x3,%esi
call   1050 <min_max@plt>
mov    0x4(%rsp),%esi
mov    0x8(%rsp),%edx
lea    0xdb7(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%d \00"
@.str.1 = [18 x i8] c"\0Amin: %d \0Amax: %d\00"
define void @main() {
%1 = alloca [3 x i32]
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = call i64 @time(i32* null)
%6 = trunc i64 %5 to i32
%7 = call i32 @srand(i32 %6)
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
br label %8
8: ; preds = %17, %0
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 3
br i1 %10, label %11, label %20
11: ; preds = %8
%12 = call i32 (...) @rand()
%13 = srem i32 %12, 10
%14 = load i32, i32* %4
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 %15
store i32 %13, i32* %16
br label %17
17: ; preds = %11
%18 = load i32, i32* %4
%19 = add nsw i32 %18, 1
store i32 %19, i32* %4
br label %8
20: ; preds = %8
store i32 0, i32* %4
br label %21
21: ; preds = %30, %20
%22 = load i32, i32* %4
%23 = icmp slt i32 %22, 3
br i1 %23, label %24, label %33
24: ; preds = %21
%25 = load i32, i32* %4
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 %26
%28 = load i32, i32* %27
%29 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %28)
br label %30
30: ; preds = %24
%31 = load i32, i32* %4
%32 = add nsw i32 %31, 1
store i32 %32, i32* %4
br label %21
33: ; preds = %21
%34 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%35 = call i32 @min_max(i32* %34, i32 3, i32* %3, i32* %2)
%36 = load i32, i32* %3
%37 = load i32, i32* %2
%38 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %36, i32 %37)
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"%d \00"
@.str.1 = [18 x i8] c"\0Amin: %d \0Amax: %d\00"
define void @main() {
%1 = alloca [3 x i32]
%2 = alloca i32
%3 = alloca i32
%4 = tail call i64 @time(i32* null)
%5 = trunc i64 %4 to i32
%6 = tail call i32 @srand(i32 %5)
%7 = bitcast [3 x i32]* %1 to i8*
%8 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%9 = bitcast i32* %3 to i8*
store i32 0, i32* %3
%10 = tail call i32 (...) @rand()
%11 = srem i32 %10, 10
%12 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
store i32 %11, i32* %12
%13 = tail call i32 (...) @rand()
%14 = srem i32 %13, 10
%15 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 1
store i32 %14, i32* %15
%16 = tail call i32 (...) @rand()
%17 = srem i32 %16, 10
%18 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 2
store i32 %17, i32* %18
%19 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
%20 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %14)
%21 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %17)
%22 = call i32 @min_max(i32* %12, i32 3, i32* %3, i32* %2)
%23 = load i32, i32* %3
%24 = load i32, i32* %2
%25 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %23, i32 %24)
ret void
}