#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 find_aspect(int, int);
int find_aspect_fromisize(unsigned char *edid_data) {
  int hsiz = edid_data[0x15];
  int vsiz = edid_data[0x16];
  int res;
  if ((hsiz == 0) && (vsiz == 0))
    return 1;
  res = find_aspect(hsiz, vsiz);
  if (res < 0)
    return 1;
  else
    return res;
}


x86 assembly (clang, -O0):
<find_aspect_fromisize>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movzbl 0x15(%rax),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movzbl 0x16(%rax),%eax
mov    %eax,-0x18(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    1152 <find_aspect_fromisize+0x42>
cmpl   $0x0,-0x18(%rbp)
jne    1152 <find_aspect_fromisize+0x42>
movl   $0x1,-0x4(%rbp)
jmp    117c <find_aspect_fromisize+0x6c>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1030 <find_aspect@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jge    1176 <find_aspect_fromisize+0x66>
movl   $0x1,-0x4(%rbp)
jmp    117c <find_aspect_fromisize+0x6c>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<find_aspect_fromisize>:
push   %rax
mov    %rdi,%rax
movzbl 0x15(%rdi),%edi
movzbl 0x16(%rax),%esi
mov    $0x1,%eax
mov    %edi,%ecx
or     %esi,%ecx
je     1138 <find_aspect_fromisize+0x28>
call   1030 <find_aspect@plt>
mov    %eax,%ecx
test   %eax,%eax
mov    $0x1,%eax
cmovns %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @find_aspect_fromisize(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
%7 = load i8*, i8** %3
%8 = getelementptr inbounds i8, i8* %7, i64 21
%9 = load i8, i8* %8
%10 = zext i8 %9 to i32
store i32 %10, i32* %4
%11 = load i8*, i8** %3
%12 = getelementptr inbounds i8, i8* %11, i64 22
%13 = load i8, i8* %12
%14 = zext i8 %13 to i32
store i32 %14, i32* %5
%15 = load i32, i32* %4
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %21
17: ; preds = %1
%18 = load i32, i32* %5
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %21
20: ; preds = %17
store i32 1, i32* %2
br label %30
21: ; preds = %17, %1
%22 = load i32, i32* %4
%23 = load i32, i32* %5
%24 = call i32 @find_aspect(i32 %22, i32 %23)
store i32 %24, i32* %6
%25 = load i32, i32* %6
%26 = icmp slt i32 %25, 0
br i1 %26, label %27, label %28
27: ; preds = %21
store i32 1, i32* %2
br label %30
28: ; preds = %21
%29 = load i32, i32* %6
store i32 %29, i32* %2
br label %30
30: ; preds = %28, %27, %20
%31 = load i32, i32* %2
ret i32 %31
}

LLVM IR (-O2):
define i32 @find_aspect_fromisize(i8* nocapture %0) {
%2 = getelementptr inbounds i8, i8* %0, i64 21
%3 = load i8, i8* %2
%4 = getelementptr inbounds i8, i8* %0, i64 22
%5 = load i8, i8* %4
%6 = icmp eq i8 %3, 0
%7 = icmp eq i8 %5, 0
%8 = select i1 %6, i1 %7, i1 false
br i1 %8, label %15, label %9
9: ; preds = %1
%10 = zext i8 %5 to i32
%11 = zext i8 %3 to i32
%12 = tail call i32 @find_aspect(i32 %11, i32 %10)
%13 = icmp slt i32 %12, 0
%14 = select i1 %13, i32 1, i32 %12
br label %15
15: ; preds = %9, %1
%16 = phi i32 [ 1, %1 ], [ %14, %9 ]
ret i32 %16
}