#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 abs(int);
int find_aspect(int h, int v) {
  if ((abs(((h * 3)) - ((v * 4))) < 16))
    return 1;
  if ((abs(((h * 4)) - ((v * 5))) < 16))
    return 2;
  if ((abs(((h * 9)) - ((v * 16))) < 16))
    return 3;
  if ((abs(((h * 10)) - ((v * 16))) < 16))
    return 0;
  return -1;
}


x86 assembly (clang, -O0):
<find_aspect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
imul   $0x3,-0x8(%rbp),%edi
mov    -0xc(%rbp),%eax
shl    $0x2,%eax
sub    %eax,%edi
call   1030 <abs@plt>
cmp    $0x10,%eax
jge    1144 <find_aspect+0x34>
movl   $0x1,-0x4(%rbp)
jmp    11bd <find_aspect+0xad>
mov    -0x8(%rbp),%edi
shl    $0x2,%edi
imul   $0x5,-0xc(%rbp),%eax
sub    %eax,%edi
call   1030 <abs@plt>
cmp    $0x10,%eax
jge    116a <find_aspect+0x5a>
movl   $0x2,-0x4(%rbp)
jmp    11bd <find_aspect+0xad>
imul   $0x9,-0x8(%rbp),%edi
mov    -0xc(%rbp),%eax
shl    $0x4,%eax
sub    %eax,%edi
call   1030 <abs@plt>
cmp    $0x10,%eax
jge    1190 <find_aspect+0x80>
movl   $0x3,-0x4(%rbp)
jmp    11bd <find_aspect+0xad>
imul   $0xa,-0x8(%rbp),%edi
mov    -0xc(%rbp),%eax
shl    $0x4,%eax
sub    %eax,%edi
call   1030 <abs@plt>
cmp    $0x10,%eax
jge    11b6 <find_aspect+0xa6>
movl   $0x0,-0x4(%rbp)
jmp    11bd <find_aspect+0xad>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_aspect>:
lea    (%rdi,%rdi,2),%eax
lea    0x0(,%rsi,4),%ecx
sub    %ecx,%eax
mov    %eax,%ecx
neg    %ecx
cmovs  %eax,%ecx
mov    $0x1,%eax
cmp    $0x10,%ecx
jb     1169 <find_aspect+0x69>
lea    0x0(,%rdi,4),%eax
lea    (%rsi,%rsi,4),%ecx
sub    %ecx,%eax
mov    %eax,%ecx
neg    %ecx
cmovs  %eax,%ecx
mov    $0x2,%eax
cmp    $0x10,%ecx
jb     1169 <find_aspect+0x69>
lea    (%rdi,%rdi,8),%eax
shl    $0x4,%esi
sub    %esi,%eax
mov    %eax,%ecx
neg    %ecx
cmovs  %eax,%ecx
mov    $0x3,%eax
cmp    $0x10,%ecx
jb     1169 <find_aspect+0x69>
add    %edi,%edi
lea    (%rdi,%rdi,4),%eax
sub    %esi,%eax
mov    %eax,%ecx
neg    %ecx
cmovs  %eax,%ecx
xor    %eax,%eax
cmp    $0x10,%ecx
adc    $0xffffffff,%eax
ret

LLVM IR (-O0):
define i32 @find_aspect(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
%7 = mul nsw i32 %6, 3
%8 = load i32, i32* %5
%9 = mul nsw i32 %8, 4
%10 = sub nsw i32 %7, %9
%11 = call i32 @abs(i32 %10)
%12 = icmp slt i32 %11, 16
br i1 %12, label %13, label %14
13: ; preds = %2
store i32 1, i32* %3
br label %42
14: ; preds = %2
%15 = load i32, i32* %4
%16 = mul nsw i32 %15, 4
%17 = load i32, i32* %5
%18 = mul nsw i32 %17, 5
%19 = sub nsw i32 %16, %18
%20 = call i32 @abs(i32 %19)
%21 = icmp slt i32 %20, 16
br i1 %21, label %22, label %23
22: ; preds = %14
store i32 2, i32* %3
br label %42
23: ; preds = %14
%24 = load i32, i32* %4
%25 = mul nsw i32 %24, 9
%26 = load i32, i32* %5
%27 = mul nsw i32 %26, 16
%28 = sub nsw i32 %25, %27
%29 = call i32 @abs(i32 %28)
%30 = icmp slt i32 %29, 16
br i1 %30, label %31, label %32
31: ; preds = %23
store i32 3, i32* %3
br label %42
32: ; preds = %23
%33 = load i32, i32* %4
%34 = mul nsw i32 %33, 10
%35 = load i32, i32* %5
%36 = mul nsw i32 %35, 16
%37 = sub nsw i32 %34, %36
%38 = call i32 @abs(i32 %37)
%39 = icmp slt i32 %38, 16
br i1 %39, label %40, label %41
40: ; preds = %32
store i32 0, i32* %3
br label %42
41: ; preds = %32
store i32 -1, i32* %3
br label %42
42: ; preds = %41, %40, %31, %22, %13
%43 = load i32, i32* %3
ret i32 %43
}

LLVM IR (-O2):
define i32 @find_aspect(i32 %0, i32 %1) {
%3 = mul nsw i32 %0, 3
%4 = mul i32 %1, -4
%5 = add i32 %4, %3
%6 = tail call i32 @llvm.abs.i32(i32 %5, i1 true)
%7 = icmp ult i32 %6, 16
br i1 %7, label %26, label %8
8: ; preds = %2
%9 = shl nsw i32 %0, 2
%10 = mul i32 %1, -5
%11 = add i32 %10, %9
%12 = tail call i32 @llvm.abs.i32(i32 %11, i1 true)
%13 = icmp ult i32 %12, 16
br i1 %13, label %26, label %14
14: ; preds = %8
%15 = mul nsw i32 %0, 9
%16 = shl nsw i32 %1, 4
%17 = sub nsw i32 %15, %16
%18 = tail call i32 @llvm.abs.i32(i32 %17, i1 true)
%19 = icmp ult i32 %18, 16
br i1 %19, label %26, label %20
20: ; preds = %14
%21 = mul nsw i32 %0, 10
%22 = sub nsw i32 %21, %16
%23 = tail call i32 @llvm.abs.i32(i32 %22, i1 true)
%24 = icmp ugt i32 %23, 15
%25 = sext i1 %24 to i32
br label %26
26: ; preds = %20, %14, %8, %2
%27 = phi i32 [ 1, %2 ], [ 2, %8 ], [ 3, %14 ], [ %25, %20 ]
ret i32 %27
}