#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 ppMem(double *mem, int len) {
  int i;
  printf("MEM1:\n");
  for (i = 0; i < len; i = i + 4) {
    printf("%lf, %lf, %lf, %lf\n", mem[i], mem[i + 1], mem[i + 2], mem[i + 3]);
    mem[i] = 0;
    mem[i + 1] = 0;
    mem[i + 2] = 0;
    mem[i + 3] = 0;
  }
}


x86 assembly (clang, -O0):
<ppMem>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    0xeda(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11ee <ppMem+0xde>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm1
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm2
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
movsd  (%rax,%rcx,8),%xmm3
lea    0xe7d(%rip),%rdi
mov    $0x4,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
add    $0x1,%ecx
movslq %ecx,%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
add    $0x2,%ecx
movslq %ecx,%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
xorps  %xmm0,%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x10(%rbp),%eax
add    $0x4,%eax
mov    %eax,-0x10(%rbp)
jmp    1134 <ppMem+0x24>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ppMem>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%r15d
mov    %rdi,%rbx
lea    0xee0(%rip),%rdi
call   1030 <puts@plt>
test   %r15d,%r15d
jle    1186 <ppMem+0x66>
xor    %ebp,%ebp
lea    0xeb9(%rip),%r14
nopw   0x0(%rax,%rax,1)
movsd  (%rbx,%rbp,8),%xmm0
movsd  0x8(%rbx,%rbp,8),%xmm1
movsd  0x10(%rbx,%rbp,8),%xmm2
movsd  0x18(%rbx,%rbp,8),%xmm3
mov    %r14,%rdi
mov    $0x4,%al
call   1040 <printf@plt>
xorps  %xmm0,%xmm0
movups %xmm0,(%rbx,%rbp,8)
movups %xmm0,0x10(%rbx,%rbp,8)
add    $0x4,%rbp
cmp    %r15d,%ebp
jl     1150 <ppMem+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [7 x i8] c"MEM1:\0A\00"
@.str.1 = [20 x i8] c"%lf, %lf, %lf, %lf\0A\00"
define void @ppMem(double* %0, i32 %1) {
%3 = alloca double*
%4 = alloca i32
%5 = alloca i32
store double* %0, double** %3
store i32 %1, i32* %4
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %5
br label %7
7: ; preds = %55, %2
%8 = load i32, i32* %5
%9 = load i32, i32* %4
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %58
11: ; preds = %7
%12 = load double*, double** %3
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds double, double* %12, i64 %14
%16 = load double, double* %15
%17 = load double*, double** %3
%18 = load i32, i32* %5
%19 = add nsw i32 %18, 1
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds double, double* %17, i64 %20
%22 = load double, double* %21
%23 = load double*, double** %3
%24 = load i32, i32* %5
%25 = add nsw i32 %24, 2
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds double, double* %23, i64 %26
%28 = load double, double* %27
%29 = load double*, double** %3
%30 = load i32, i32* %5
%31 = add nsw i32 %30, 3
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds double, double* %29, i64 %32
%34 = load double, double* %33
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), double %16, double %22, double %28, double %34)
%36 = load double*, double** %3
%37 = load i32, i32* %5
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds double, double* %36, i64 %38
store double 0.000000e+00, double* %39
%40 = load double*, double** %3
%41 = load i32, i32* %5
%42 = add nsw i32 %41, 1
%43 = sext i32 %42 to i64
%44 = getelementptr inbounds double, double* %40, i64 %43
store double 0.000000e+00, double* %44
%45 = load double*, double** %3
%46 = load i32, i32* %5
%47 = add nsw i32 %46, 2
%48 = sext i32 %47 to i64
%49 = getelementptr inbounds double, double* %45, i64 %48
store double 0.000000e+00, double* %49
%50 = load double*, double** %3
%51 = load i32, i32* %5
%52 = add nsw i32 %51, 3
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds double, double* %50, i64 %53
store double 0.000000e+00, double* %54
br label %55
55: ; preds = %11
%56 = load i32, i32* %5
%57 = add nsw i32 %56, 4
store i32 %57, i32* %5
br label %7
58: ; preds = %7
ret void
}

LLVM IR (-O2):
@.str.1 = [20 x i8] c"%lf, %lf, %lf, %lf\0A\00"
@str = [6 x i8] c"MEM1:\00"
define void @ppMem(double* nocapture %0, i32 %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%4 = icmp sgt i32 %1, 0
br i1 %4, label %5, label %24
5: ; preds = %2, %5
%6 = phi i64 [ %21, %5 ], [ 0, %2 ]
%7 = getelementptr inbounds double, double* %0, i64 %6
%8 = load double, double* %7
%9 = or i64 %6, 1
%10 = getelementptr inbounds double, double* %0, i64 %9
%11 = load double, double* %10
%12 = or i64 %6, 2
%13 = getelementptr inbounds double, double* %0, i64 %12
%14 = load double, double* %13
%15 = or i64 %6, 3
%16 = getelementptr inbounds double, double* %0, i64 %15
%17 = load double, double* %16
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str.1, i64 0, i64 0), double %8, double %11, double %14, double %17)
%19 = bitcast double* %7 to <2 x double>*
store <2 x double> zeroinitializer, <2 x double>* %19
%20 = bitcast double* %13 to <2 x double>*
store <2 x double> zeroinitializer, <2 x double>* %20
%21 = add nuw i64 %6, 4
%22 = trunc i64 %21 to i32
%23 = icmp slt i32 %22, %1
br i1 %23, label %5, label %24
24: ; preds = %5, %2
ret void
}