#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 *, ...);
void show(const double *begin, const double *end) {
  printf("{");
  while (begin < end) {
    printf("%lf", *begin);
    ++begin;
    if (begin < end)
      printf(", ");
  }
  printf("}\n");
}


x86 assembly (clang, -O0):
<show>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xed9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    117f <show+0x6f>
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
lea    0xeb7(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    117a <show+0x6a>
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    112e <show+0x1e>
lea    0xe83(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
mov    $0x7b,%edi
call   1030 <putchar@plt>
cmp    %r14,%rbx
jae    11a1 <show+0x71>
movsd  (%rbx),%xmm0
lea    0xea8(%rip),%rdi
mov    $0x1,%al
call   1050 <printf@plt>
add    $0x8,%rbx
cmp    %r14,%rbx
jae    11a1 <show+0x71>
lea    0xe95(%rip),%r15
lea    0xe8a(%rip),%r12
cs nopw 0x0(%rax,%rax,1)
mov    %r15,%rdi
xor    %eax,%eax
call   1050 <printf@plt>
movsd  (%rbx),%xmm0
mov    %r12,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
add    $0x8,%rbx
cmp    %r14,%rbx
jb     1180 <show+0x50>
lea    0xe5f(%rip),%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1040 <puts@plt>

LLVM IR (-O0):
@.str = [2 x i8] c"{\00"
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [3 x i8] c", \00"
@.str.3 = [3 x i8] c"}\0A\00"
define void @show(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
store double* %0, double** %3
store double* %1, double** %4
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %21, %2
%7 = load double*, double** %3
%8 = load double*, double** %4
%9 = icmp ult double* %7, %8
br i1 %9, label %10, label %22
10: ; preds = %6
%11 = load double*, double** %3
%12 = load double, double* %11
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %12)
%14 = load double*, double** %3
%15 = getelementptr inbounds double, double* %14, i32 1
store double* %15, double** %3
%16 = load double*, double** %3
%17 = load double*, double** %4
%18 = icmp ult double* %16, %17
br i1 %18, label %19, label %21
19: ; preds = %10
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
br label %21
21: ; preds = %19, %10
br label %6
22: ; preds = %6
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%lf\00"
@.str.2 = [3 x i8] c", \00"
@str = [2 x i8] c"}\00"
define void @show(double* %0, double* readnone %1) {
%3 = tail call i32 @putchar(i32 123)
%4 = icmp ult double* %0, %1
br i1 %4, label %5, label %17
5: ; preds = %2
%6 = load double, double* %0
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %6)
%8 = getelementptr inbounds double, double* %0, i64 1
%9 = icmp ult double* %8, %1
br i1 %9, label %10, label %17
10: ; preds = %5, %10
%11 = phi double* [ %15, %10 ], [ %8, %5 ]
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0))
%13 = load double, double* %11
%14 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %13)
%15 = getelementptr inbounds double, double* %11, i64 1
%16 = icmp ult double* %15, %1
br i1 %16, label %10, label %17
17: ; preds = %10, %5, %2
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([2 x i8], [2 x i8]* @str, i64 0, i64 0))
ret void
}