#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 */
float checkFloat();
int /*<<< orphan*/ printf(char *);
void inputMatrixValues(float *ptr, int size) {
  int i, j, baseX = 3, baseY = 15;
  for (i = 0; i < size; i++) {
    for (j = 0; i < size; i++) {
      printf("\033[(baseX+i*2);(baseY+j)H ");
      *(ptr + i * size + j) = checkFloat();
    }
  }
}


x86 assembly (clang, -O0):
<inputMatrixValues>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x3,-0x18(%rbp)
movl   $0xf,-0x1c(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11b5 <inputMatrixValues+0x95>
movl   $0x0,-0x14(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11a2 <inputMatrixValues+0x82>
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <checkFloat@plt>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%ecx
imul   -0xc(%rbp),%ecx
movslq %ecx,%rcx
shl    $0x2,%rcx
add    %rcx,%rax
movslq -0x14(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1157 <inputMatrixValues+0x37>
jmp    11a7 <inputMatrixValues+0x87>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1144 <inputMatrixValues+0x24>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<inputMatrixValues>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,(%rsp)
test   %esi,%esi
jle    11a1 <inputMatrixValues+0x81>
mov    %esi,%r14d
mov    %esi,%r15d
lea    0x0(,%r15,4),%rbp
lea    0xeb8(%rip),%r13
xor    %eax,%eax
jmp    1158 <inputMatrixValues+0x38>
nopl   0x0(%rax)
add    $0x1,%eax
cmp    %r14d,%eax
jge    11a1 <inputMatrixValues+0x81>
cmp    %r14d,%eax
jge    1150 <inputMatrixValues+0x30>
movslq %eax,%rcx
imul   %r15,%rcx
mov    (%rsp),%rdx
lea    (%rdx,%rcx,4),%rbx
mov    %r14d,%r12d
sub    %eax,%r12d
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r13,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <checkFloat@plt>
movss  %xmm0,(%rbx)
add    %rbp,%rbx
add    $0xffffffff,%r12d
jne    1180 <inputMatrixValues+0x60>
mov    %r14d,%eax
jmp    1150 <inputMatrixValues+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [26 x i8] c"\1B[(baseX+i*2);(baseY+j)H \00"
define void @inputMatrixValues(float* nocapture writeonly %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %24
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %20
%7 = phi i32 [ %22, %20 ], [ 0, %4 ]
%8 = icmp slt i32 %7, %1
br i1 %8, label %9, label %20
9: ; preds = %6
%10 = sext i32 %7 to i64
br label %11
11: ; preds = %9, %11
%12 = phi i64 [ %10, %9 ], [ %17, %11 ]
%13 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str, i64 0, i64 0))
%14 = tail call float (...) @checkFloat()
%15 = mul nsw i64 %12, %5
%16 = getelementptr inbounds float, float* %0, i64 %15
store float %14, float* %16
%17 = add nsw i64 %12, 1
%18 = trunc i64 %17 to i32
%19 = icmp eq i32 %18, %1
br i1 %19, label %20, label %11
20: ; preds = %11, %6
%21 = phi i32 [ %7, %6 ], [ %1, %11 ]
%22 = add nsw i32 %21, 1
%23 = icmp slt i32 %22, %1
br i1 %23, label %6, label %24
24: ; preds = %20, %2
ret void
}