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

/* Variables and functions */
int /*<<< orphan*/ min_max(int *, int *, int **, int **);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  int values[] = {4, 8, 15, 16, 23, 42};
  int size = sizeof(values) / sizeof(int);
  int *smallest;
  int *largest;
  min_max(values, values + size, &smallest, &largest);
  printf("Smallest: %d \n", *smallest);
  printf("Largest: %d \n", *largest);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xec3(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xec0(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xebd(%rip),%rax
mov    %rax,-0x20(%rbp)
movl   $0x6,-0x34(%rbp)
lea    -0x30(%rbp),%rdi
lea    -0x30(%rbp),%rsi
movslq -0x34(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    -0x40(%rbp),%rdx
lea    -0x48(%rbp),%rcx
call   1040 <min_max@plt>
mov    -0x40(%rbp),%rax
mov    (%rax),%esi
lea    0xe8d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x48(%rbp),%rax
mov    (%rax),%esi
lea    0xe8a(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
mov    0xee5(%rip),%rax
mov    %rax,0x20(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0x28(%rsp),%rsi
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rdx
mov    %rsp,%rcx
call   1040 <min_max@plt>
mov    0x8(%rsp),%rax
mov    (%rax),%esi
lea    0xeb7(%rip),%rdi
call   1030 <printf@plt>
mov    (%rsp),%rax
mov    (%rax),%esi
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.values = [6 x i32] [i32 4, i32 8, i32 15, i32 16, i32 23, i32 42]
@.str = [15 x i8] c"Smallest: %d \0A\00"
@.str.1 = [14 x i8] c"Largest: %d \0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [6 x i32]
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = bitcast [6 x i32]* %6 to i8*
store i32 6, i32* %7
%11 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 0
%12 = getelementptr inbounds [6 x i32], [6 x i32]* %6, i64 0, i64 0
%13 = load i32, i32* %7
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i32, i32* %12, i64 %14
%16 = call i32 @min_max(i32* %11, i32* %15, i32** %8, i32** %9)
%17 = load i32*, i32** %8
%18 = load i32, i32* %17
%19 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = load i32*, i32** %9
%21 = load i32, i32* %20
%22 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %21)
ret i32 0
}

LLVM IR (-O2):
@__const.main.values = [6 x i32] [i32 4, i32 8, i32 15, i32 16, i32 23, i32 42]
@.str = [15 x i8] c"Smallest: %d \0A\00"
@.str.1 = [14 x i8] c"Largest: %d \0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [6 x i32]
%4 = alloca i32*
%5 = alloca i32*
%6 = bitcast [6 x i32]* %3 to i8*
%7 = bitcast i32** %4 to i8*
%8 = bitcast i32** %5 to i8*
%9 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 0
%10 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 6
%11 = call i32 @min_max(i32* %9, i32* %10, i32** %4, i32** %5)
%12 = load i32*, i32** %4
%13 = load i32, i32* %12
%14 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = load i32*, i32** %5
%16 = load i32, i32* %15
%17 = call i32 @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i32 %16)
ret i32 0
}