#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 INFINITY;
float abs_float(float);
float floor(int);
void maxabs2D_float(float *input, int r, int c, float *retVals) {
  int i, ind, len = r * c;
  *retVals = -1;
  *(retVals + 1) = -1;
  *(retVals + 2) = -INFINITY;
  for (i = 0; i < len; i++) {
    if (abs_float(*(input + i)) > *(retVals + 2)) {
      *(retVals + 2) = abs_float(*(input + i));
      ind = i;
    }
  }
  *retVals = floor(ind / c);
  *(retVals + 1) = ind % c;
}


x86 assembly (clang, -O0):
<maxabs2D_float>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    -0xc(%rbp),%eax
imul   -0x10(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rax
movss  0xeb4(%rip),%xmm0
movss  %xmm0,(%rax)
mov    -0x18(%rbp),%rax
movss  0xea4(%rip),%xmm0
movss  %xmm0,0x4(%rax)
mov    0x2e80(%rip),%rax
movss  (%rax),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,0x8(%rax)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x24(%rbp),%eax
jge    11e9 <maxabs2D_float+0xc9>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
call   1030 <abs_float@plt>
mov    -0x18(%rbp),%rax
ucomiss 0x8(%rax),%xmm0
jbe    11d6 <maxabs2D_float+0xb6>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
call   1030 <abs_float@plt>
mov    -0x18(%rbp),%rax
movss  %xmm0,0x8(%rax)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x20(%rbp)
jmp    11db <maxabs2D_float+0xbb>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1189 <maxabs2D_float+0x69>
mov    -0x20(%rbp),%eax
cltd
idivl  -0x10(%rbp)
mov    %eax,%edi
call   1040 <floor@plt>
mov    -0x18(%rbp),%rax
movss  %xmm0,(%rax)
mov    -0x20(%rbp),%eax
cltd
idivl  -0x10(%rbp)
cvtsi2ss %edx,%xmm0
mov    -0x18(%rbp),%rax
movss  %xmm0,0x4(%rax)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<maxabs2D_float>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r13
mov    %edx,%r14d
imul   %edx,%esi
movabs $0xbf800000bf800000,%rax
mov    %rax,(%rcx)
mov    0x2ea0(%rip),%rax
movss  (%rax),%xmm0
xorps  0xead(%rip),%xmm0
movss  %xmm0,0x8(%rcx)
test   %esi,%esi
jle    11a1 <maxabs2D_float+0x81>
mov    %rdi,%rbp
mov    %esi,%r12d
xor    %ebx,%ebx
jmp    1179 <maxabs2D_float+0x59>
cs nopw 0x0(%rax,%rax,1)
add    $0x1,%rbx
cmp    %rbx,%r12
je     11a1 <maxabs2D_float+0x81>
movss  0x0(%rbp,%rbx,4),%xmm0
call   1030 <abs_float@plt>
ucomiss 0x8(%r13),%xmm0
jbe    1170 <maxabs2D_float+0x50>
movss  0x0(%rbp,%rbx,4),%xmm0
call   1030 <abs_float@plt>
movss  %xmm0,0x8(%r13)
mov    %ebx,%r15d
jmp    1170 <maxabs2D_float+0x50>
mov    %r15d,%eax
cltd
idiv   %r14d
mov    %edx,%ebp
mov    %eax,%edi
call   1040 <floor@plt>
movss  %xmm0,0x0(%r13)
xorps  %xmm0,%xmm0
cvtsi2ss %ebp,%xmm0
movss  %xmm0,0x4(%r13)
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@INFINITY = global float 0.000000e+00
define void @maxabs2D_float(float* %0, i32 %1, i32 %2, float* %3) {
%5 = alloca float*
%6 = alloca i32
%7 = alloca i32
%8 = alloca float*
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store float* %0, float** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store float* %3, float** %8
%12 = load i32, i32* %6
%13 = load i32, i32* %7
%14 = mul nsw i32 %12, %13
store i32 %14, i32* %11
%15 = load float*, float** %8
store float -1.000000e+00, float* %15
%16 = load float*, float** %8
%17 = getelementptr inbounds float, float* %16, i64 1
store float -1.000000e+00, float* %17
%18 = load float, float* @INFINITY
%19 = fneg float %18
%20 = load float*, float** %8
%21 = getelementptr inbounds float, float* %20, i64 2
store float %19, float* %21
store i32 0, i32* %9
br label %22
22: ; preds = %48, %4
%23 = load i32, i32* %9
%24 = load i32, i32* %11
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %51
26: ; preds = %22
%27 = load float*, float** %5
%28 = load i32, i32* %9
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds float, float* %27, i64 %29
%31 = load float, float* %30
%32 = call float @abs_float(float %31)
%33 = load float*, float** %8
%34 = getelementptr inbounds float, float* %33, i64 2
%35 = load float, float* %34
%36 = fcmp ogt float %32, %35
br i1 %36, label %37, label %47
37: ; preds = %26
%38 = load float*, float** %5
%39 = load i32, i32* %9
%40 = sext i32 %39 to i64
%41 = getelementptr inbounds float, float* %38, i64 %40
%42 = load float, float* %41
%43 = call float @abs_float(float %42)
%44 = load float*, float** %8
%45 = getelementptr inbounds float, float* %44, i64 2
store float %43, float* %45
%46 = load i32, i32* %9
store i32 %46, i32* %10
br label %47
47: ; preds = %37, %26
br label %48
48: ; preds = %47
%49 = load i32, i32* %9
%50 = add nsw i32 %49, 1
store i32 %50, i32* %9
br label %22
51: ; preds = %22
%52 = load i32, i32* %10
%53 = load i32, i32* %7
%54 = sdiv i32 %52, %53
%55 = call float @floor(i32 %54)
%56 = load float*, float** %8
store float %55, float* %56
%57 = load i32, i32* %10
%58 = load i32, i32* %7
%59 = srem i32 %57, %58
%60 = sitofp i32 %59 to float
%61 = load float*, float** %8
%62 = getelementptr inbounds float, float* %61, i64 1
store float %60, float* %62
ret void
}

LLVM IR (-O2):
@INFINITY = global float 0.000000e+00
define void @maxabs2D_float(float* nocapture %0, i32 %1, i32 %2, float* nocapture %3) {
%5 = mul i32 %2, %1
store float -1.000000e+00, float* %3
%6 = getelementptr inbounds float, float* %3, i64 1
store float -1.000000e+00, float* %6
%7 = load float, float* @INFINITY
%8 = fneg float %7
%9 = getelementptr inbounds float, float* %3, i64 2
store float %8, float* %9
%10 = icmp sgt i32 %5, 0
br i1 %10, label %11, label %29
11: ; preds = %4
%12 = zext i32 %5 to i64
br label %13
13: ; preds = %11, %25
%14 = phi i64 [ 0, %11 ], [ %27, %25 ]
%15 = phi i32 [ undef, %11 ], [ %26, %25 ]
%16 = getelementptr inbounds float, float* %0, i64 %14
%17 = load float, float* %16
%18 = tail call float @abs_float(float %17)
%19 = load float, float* %9
%20 = fcmp ogt float %18, %19
br i1 %20, label %21, label %25
21: ; preds = %13
%22 = load float, float* %16
%23 = tail call float @abs_float(float %22)
store float %23, float* %9
%24 = trunc i64 %14 to i32
br label %25
25: ; preds = %13, %21
%26 = phi i32 [ %24, %21 ], [ %15, %13 ]
%27 = add nuw nsw i64 %14, 1
%28 = icmp eq i64 %27, %12
br i1 %28, label %29, label %13
29: ; preds = %25, %4
%30 = phi i32 [ undef, %4 ], [ %26, %25 ]
%31 = sdiv i32 %30, %2
%32 = tail call float @floor(i32 %31)
store float %32, float* %3
%33 = srem i32 %30, %2
%34 = sitofp i32 %33 to float
store float %34, float* %6
ret void
}