#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 i;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void print_array(int N, float *arr) {
  int i, j;
  for (j = N; j >= 1; j--) {
    for (i = 1; i <= N; i++)
      printf("% f ", arr[((i) + (N + 2) * (j))]);
    printf("\n");
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<print_array>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x1,-0x18(%rbp)
jl     1199 <print_array+0x89>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jg     117d <print_array+0x6d>
mov    -0x10(%rbp),%rax
mov    -0x14(%rbp),%ecx
mov    -0x4(%rbp),%edx
add    $0x2,%edx
imul   -0x18(%rbp),%edx
add    %edx,%ecx
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe98(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1136 <print_array+0x26>
lea    0xe81(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x18(%rbp)
jmp    1125 <print_array+0x15>
lea    0xe65(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_array>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
test   %edi,%edi
jle    11a6 <print_array+0x86>
mov    %edi,%r12d
mov    %edi,%r15d
lea    0x2(%r15),%rax
add    $0x1,%r12d
imul   %r15,%rax
lea    (%rsi,%rax,4),%rbx
lea    0x8(,%r15,4),%r13
neg    %r13
lea    0xea9(%rip),%r14
nopw   0x0(%rax,%rax,1)
mov    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
nop
movss  (%rbx,%rbp,4),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
add    $0x1,%rbp
cmp    %rbp,%r12
jne    1170 <print_array+0x50>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    -0x1(%r15),%rax
add    %r13,%rbx
cmp    $0x1,%r15
mov    %rax,%r15
jg     1160 <print_array+0x40>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

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

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