#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 *, float);
void teste1(int m, int n, float t1[m][n]) {
  for (int i = 0; i < 8; i++)
    printf("%f\t", t1[i % 4][i / 4]);
}


x86 assembly (clang, -O0):
<teste1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %rdx,-0x10(%rbp)
mov    -0x8(%rbp),%eax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x8,-0x14(%rbp)
jge    119c <teste1+0x8c>
mov    -0x10(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    -0x30(%rbp),%rax
mov    %edx,%ecx
mov    -0x20(%rbp),%rdx
movslq %ecx,%rcx
imul   %rdx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
mov    %rax,-0x28(%rbp)
mov    -0x14(%rbp),%eax
mov    $0x4,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x28(%rbp),%rax
movslq %ecx,%rcx
movss  (%rax,%rcx,4),%xmm0
lea    0xe77(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1130 <teste1+0x20>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<teste1>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %esi,%r15d
movss  (%rdx),%xmm0
lea    0xed7(%rip),%r14
mov    %r14,%rdi
call   1030 <printf@plt>
movss  (%rbx,%r15,4),%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
movss  (%rbx,%r15,8),%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
lea    (%r15,%r15,2),%r12
movss  (%rbx,%r12,4),%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
movss  0x4(%rbx),%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
movss  0x4(%rbx,%r15,4),%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
movss  0x4(%rbx,%r15,8),%xmm0
mov    %r14,%rdi
call   1030 <printf@plt>
movss  0x4(%rbx,%r12,4),%xmm0
mov    %r14,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%f\09\00"
define void @teste1(i32 %0, i32 %1, float* nocapture %2) {
%4 = zext i32 %1 to i64
%5 = load float, float* %2
%6 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float %5)
%7 = getelementptr inbounds float, float* %2, i64 %4
%8 = load float, float* %7
%9 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float %8)
%10 = shl nuw nsw i64 %4, 1
%11 = getelementptr inbounds float, float* %2, i64 %10
%12 = load float, float* %11
%13 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float %12)
%14 = mul nuw nsw i64 %4, 3
%15 = getelementptr inbounds float, float* %2, i64 %14
%16 = load float, float* %15
%17 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float %16)
%18 = getelementptr inbounds float, float* %2, i64 1
%19 = load float, float* %18
%20 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float %19)
%21 = getelementptr inbounds float, float* %7, i64 1
%22 = load float, float* %21
%23 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float %22)
%24 = getelementptr inbounds float, float* %11, i64 1
%25 = load float, float* %24
%26 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float %25)
%27 = getelementptr inbounds float, float* %15, i64 1
%28 = load float, float* %27
%29 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), float %28)
ret void
}