#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*/ print1(float *, int);
int /*<<< orphan*/ printf(char *);
void print2(void *_data, int x, int y) {
  float(*data)[x] = _data;
  for (int yi = 0; yi < y; yi++)
    print1(data[yi], x);
  printf("\n");
}


x86 assembly (clang, -O0):
<print2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1181 <print2+0x61>
mov    -0x28(%rbp),%rcx
mov    -0x18(%rbp),%rdi
movslq -0x1c(%rbp),%rax
imul   %rcx,%rax
shl    $0x2,%rax
add    %rax,%rdi
mov    -0xc(%rbp),%esi
call   1040 <print1@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1148 <print2+0x28>
lea    0xe78(%rip),%rdi
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print2>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
test   %edx,%edx
jle    1154 <print2+0x34>
mov    %esi,%r14d
mov    %rdi,%rbx
mov    %esi,%r15d
mov    %edx,%ebp
shl    $0x2,%r15
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r14d,%esi
call   1040 <print1@plt>
add    %r15,%rbx
add    $0xffffffffffffffff,%rbp
jne    1140 <print2+0x20>
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <putchar@plt>

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

LLVM IR (-O2):
define void @print2(i8* %0, i32 %1, i32 %2) {
%4 = zext i32 %1 to i64
%5 = bitcast i8* %0 to float*
%6 = icmp sgt i32 %2, 0
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = zext i32 %2 to i64
br label %11
9: ; preds = %11, %3
%10 = tail call i32 @putchar(i32 10)
ret void
11: ; preds = %7, %11
%12 = phi i64 [ 0, %7 ], [ %16, %11 ]
%13 = mul nuw nsw i64 %12, %4
%14 = getelementptr inbounds float, float* %5, i64 %13
%15 = tail call i32 @print1(float* %14, i32 %1)
%16 = add nuw nsw i64 %12, 1
%17 = icmp eq i64 %16, %8
br i1 %17, label %9, label %11
}