#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 array_print(double *a, int n) {
  int k;
  for (k = 0; k < n - 1; ++k) {
    if (k % 100 == 0 && k != 0)
      printf("\n\\");
    printf("%f, ", a[k]);
  }
  printf("%f\n", a[k]);
}


x86 assembly (clang, -O0):
<array_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    118c <array_print+0x7c>
mov    -0x10(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1163 <array_print+0x53>
cmpl   $0x0,-0x10(%rbp)
je     1163 <array_print+0x53>
lea    0xea4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe8c(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <array_print+0x16>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe68(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<array_print>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%r13
xor    %eax,%eax
cmp    $0x2,%esi
jl     119f <array_print+0x8f>
add    $0xffffffff,%esi
mov    %esi,%eax
mov    %rax,(%rsp)
lea    0x0(,%rax,8),%rbx
lea    0xec6(%rip),%r15
xor    %ebp,%ebp
xor    %r12d,%r12d
xor    %r14d,%r14d
jmp    1171 <array_print+0x61>
nopw   0x0(%rax,%rax,1)
movsd  0x0(%r13,%r14,1),%xmm0
mov    %r15,%rdi
mov    $0x1,%al
call   1030 <printf@plt>
add    $0x8,%r14
add    $0xffffffff,%r12d
add    $0x1,%ebp
cmp    %r14,%rbx
je     119b <array_print+0x8b>
test   %r14,%r14
je     1150 <array_print+0x40>
mov    %ebp,%eax
imul   $0x51eb851f,%rax,%rax
shr    $0x25,%rax
imul   $0x64,%eax,%eax
add    %r12d,%eax
jne    1150 <array_print+0x40>
lea    0xe6e(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1150 <array_print+0x40>
mov    (%rsp),%rax
movsd  0x0(%r13,%rax,8),%xmm0
lea    0xe5b(%rip),%rdi
mov    $0x1,%al
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [3 x i8] c"\0A\\\00"
@.str.1 = [5 x i8] c"%f, \00"
@.str.2 = [4 x i8] c"%f\0A\00"
define void @array_print(double* nocapture %0, i32 %1) {
%3 = add i32 %1, -1
%4 = icmp sgt i32 %1, 1
br i1 %4, label %5, label %24
5: ; preds = %2
%6 = zext i32 %3 to i64
br label %7
7: ; preds = %5, %16
%8 = phi i64 [ 0, %5 ], [ %20, %16 ]
%9 = trunc i64 %8 to i32
%10 = urem i32 %9, 100
%11 = icmp eq i32 %10, 0
%12 = icmp ne i64 %8, 0
%13 = and i1 %12, %11
br i1 %13, label %14, label %16
14: ; preds = %7
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
br label %16
16: ; preds = %14, %7
%17 = getelementptr inbounds double, double* %0, i64 %8
%18 = load double, double* %17
%19 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), double %18)
%20 = add nuw nsw i64 %8, 1
%21 = icmp eq i64 %20, %6
br i1 %21, label %22, label %7
22: ; preds = %16
%23 = zext i32 %3 to i64
br label %24
24: ; preds = %2, %22
%25 = phi i64 [ %23, %22 ], [ 0, %2 ]
%26 = getelementptr inbounds double, double* %0, i64 %25
%27 = load double, double* %26
%28 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), double %27)
ret void
}