#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*/ printf(char *, ...);
double median(double *begin, double *end) {
  printf("end = %p\n", end);
  printf("begin = %p\n", begin);
  printf("end - begin = %ld\n", end - begin);
  return 7.5;
}


x86 assembly (clang, -O0):
<median>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xed5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rax
sub    %rax,%rsi
sar    $0x3,%rsi
lea    0xec4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movsd  0xe97(%rip),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<median>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
lea    0xee7(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xee3(%rip),%rdi
mov    %r14,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
sub    %r14,%rbx
sar    $0x3,%rbx
lea    0xed7(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
movsd  0xea7(%rip),%xmm0
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [10 x i8] c"end = %p\0A\00"
@.str.1 = [12 x i8] c"begin = %p\0A\00"
@.str.2 = [19 x i8] c"end - begin = %ld\0A\00"
define double @median(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
store double* %0, double** %3
store double* %1, double** %4
%5 = load double*, double** %4
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double* %5)
%7 = load double*, double** %3
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), double* %7)
%9 = load double*, double** %4
%10 = load double*, double** %3
%11 = ptrtoint double* %9 to i64
%12 = ptrtoint double* %10 to i64
%13 = sub i64 %11, %12
%14 = sdiv exact i64 %13, 8
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i64 %14)
ret double 7.500000e+00
}

LLVM IR (-O2):
@.str = [10 x i8] c"end = %p\0A\00"
@.str.1 = [12 x i8] c"begin = %p\0A\00"
@.str.2 = [19 x i8] c"end - begin = %ld\0A\00"
define double @median(double* %0, double* %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), double* %1)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0), double* %0)
%5 = ptrtoint double* %1 to i64
%6 = ptrtoint double* %0 to i64
%7 = sub i64 %5, %6
%8 = ashr exact i64 %7, 3
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i64 %8)
ret double 7.500000e+00
}