#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 conv1D2Dcol(int, int);
int conv1D2Drow(int, int);
int conv2D1D(int, int, int);
int findPixelAcrossScales(int ref_rowcol, int ref_nX, int tgt_nX,
                          int ref_nX_o_tgt_nX, int ref_nY_o_tgt_nY) {
  int ref_row = conv1D2Drow(ref_nX, ref_rowcol);
  int ref_col = conv1D2Dcol(ref_row, ref_rowcol);
  int tgt_col = (int)(ref_col / ref_nX_o_tgt_nX);
  int tgt_row = (int)(ref_row / ref_nY_o_tgt_nY);
  int tgt_rowcol = conv2D1D(tgt_nX, tgt_col, tgt_row);
  return (tgt_rowcol);
}


x86 assembly (clang, -O0):
<findPixelAcrossScales>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    -0x4(%rbp),%esi
call   1040 <conv1D2Drow@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%edi
mov    -0x4(%rbp),%esi
call   1050 <conv1D2Dcol@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cltd
idivl  -0x10(%rbp)
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%eax
cltd
idivl  -0x14(%rbp)
mov    %eax,-0x24(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x20(%rbp),%esi
mov    -0x24(%rbp),%edx
call   1030 <conv2D1D@plt>
mov    %eax,-0x28(%rbp)
mov    -0x28(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<findPixelAcrossScales>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %r8d,%r15d
mov    %ecx,%r12d
mov    %edx,%r14d
mov    %edi,%ebx
mov    %esi,%edi
mov    %ebx,%esi
call   1040 <conv1D2Drow@plt>
mov    %eax,%ebp
mov    %eax,%edi
mov    %ebx,%esi
call   1050 <conv1D2Dcol@plt>
cltd
idiv   %r12d
mov    %eax,%esi
mov    %ebp,%eax
cltd
idiv   %r15d
mov    %r14d,%edi
mov    %eax,%edx
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <conv2D1D@plt>

LLVM IR (-O0):
define i32 @findPixelAcrossScales(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
%15 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%16 = load i32, i32* %7
%17 = load i32, i32* %6
%18 = call i32 @conv1D2Drow(i32 %16, i32 %17)
store i32 %18, i32* %11
%19 = load i32, i32* %11
%20 = load i32, i32* %6
%21 = call i32 @conv1D2Dcol(i32 %19, i32 %20)
store i32 %21, i32* %12
%22 = load i32, i32* %12
%23 = load i32, i32* %9
%24 = sdiv i32 %22, %23
store i32 %24, i32* %13
%25 = load i32, i32* %11
%26 = load i32, i32* %10
%27 = sdiv i32 %25, %26
store i32 %27, i32* %14
%28 = load i32, i32* %8
%29 = load i32, i32* %13
%30 = load i32, i32* %14
%31 = call i32 @conv2D1D(i32 %28, i32 %29, i32 %30)
store i32 %31, i32* %15
%32 = load i32, i32* %15
ret i32 %32
}

LLVM IR (-O2):
define i32 @findPixelAcrossScales(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = tail call i32 @conv1D2Drow(i32 %1, i32 %0)
%7 = tail call i32 @conv1D2Dcol(i32 %6, i32 %0)
%8 = sdiv i32 %7, %3
%9 = sdiv i32 %6, %4
%10 = tail call i32 @conv2D1D(i32 %2, i32 %8, i32 %9)
ret i32 %10
}