#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 adirisseSouris();
scalar_t__ estDansRectangle(int, int, int, int, int, int);
int hauteurFenetre();
int largeurFenetre();
int ordonneeSouris();
int detecteMenuPrincipal(void) {
  int abs = adirisseSouris();
  int ord = ordonneeSouris();
  int L = largeurFenetre();
  int H = hauteurFenetre();
  if (estDansRectangle(abs, ord, L * 2 / 5, H * 3 / 5, L * 3 / 5, H * 7 / 10)) {
    return 1;
  }
  if (estDansRectangle(abs, ord, L * 2 / 5, H * 9 / 20, L * 3 / 5,
                       H * 11 / 20)) {
    return 2;
  }
  if (estDansRectangle(abs, ord, L * 2 / 5, H * 3 / 10, L * 3 / 5, H * 2 / 5)) {
    return 3;
  }
  if (estDansRectangle(abs, ord, L * 2 / 5, H * 3 / 20, L * 3 / 5, H / 4)) {
    return 4;
  }
  return 0;
}


x86 assembly (clang, -O0):
<detecteMenuPrincipal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    $0x0,%al
call   1060 <adirisseSouris@plt>
mov    %eax,-0x8(%rbp)
mov    $0x0,%al
call   1050 <ordonneeSouris@plt>
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1070 <largeurFenetre@plt>
mov    %eax,-0x10(%rbp)
mov    $0x0,%al
call   1030 <hauteurFenetre@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%eax
shl    $0x1,%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %eax,-0x18(%rbp)
imul   $0x3,-0x14(%rbp),%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
imul   $0x3,-0x10(%rbp),%eax
mov    $0x5,%r8d
cltd
idiv   %r8d
mov    %eax,%r8d
imul   $0x7,-0x14(%rbp),%eax
mov    $0xa,%r9d
cltd
idiv   %r9d
mov    -0x18(%rbp),%edx
mov    %eax,%r9d
call   1040 <estDansRectangle@plt>
cmp    $0x0,%rax
je     11e5 <detecteMenuPrincipal+0x95>
movl   $0x1,-0x4(%rbp)
jmp    131c <detecteMenuPrincipal+0x1cc>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%eax
shl    $0x1,%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
imul   $0x9,-0x14(%rbp),%eax
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
imul   $0x3,-0x10(%rbp),%eax
mov    $0x5,%r8d
cltd
idiv   %r8d
mov    %eax,%r8d
imul   $0xb,-0x14(%rbp),%eax
mov    $0x14,%r9d
cltd
idiv   %r9d
mov    -0x1c(%rbp),%edx
mov    %eax,%r9d
call   1040 <estDansRectangle@plt>
cmp    $0x0,%rax
je     124a <detecteMenuPrincipal+0xfa>
movl   $0x2,-0x4(%rbp)
jmp    131c <detecteMenuPrincipal+0x1cc>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%eax
shl    $0x1,%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %eax,-0x20(%rbp)
imul   $0x3,-0x14(%rbp),%eax
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
imul   $0x3,-0x10(%rbp),%eax
mov    $0x5,%r8d
cltd
idiv   %r8d
mov    %eax,%r8d
mov    -0x14(%rbp),%eax
shl    $0x1,%eax
mov    $0x5,%r9d
cltd
idiv   %r9d
mov    -0x20(%rbp),%edx
mov    %eax,%r9d
call   1040 <estDansRectangle@plt>
cmp    $0x0,%rax
je     12b1 <detecteMenuPrincipal+0x161>
movl   $0x3,-0x4(%rbp)
jmp    131c <detecteMenuPrincipal+0x1cc>
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%eax
shl    $0x1,%eax
mov    $0x5,%ecx
cltd
idiv   %ecx
mov    %eax,-0x24(%rbp)
imul   $0x3,-0x14(%rbp),%eax
mov    $0x14,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
imul   $0x3,-0x10(%rbp),%eax
mov    $0x5,%r8d
cltd
idiv   %r8d
mov    %eax,%r8d
mov    -0x14(%rbp),%eax
mov    $0x4,%r9d
cltd
idiv   %r9d
mov    -0x24(%rbp),%edx
mov    %eax,%r9d
call   1040 <estDansRectangle@plt>
cmp    $0x0,%rax
je     1315 <detecteMenuPrincipal+0x1c5>
movl   $0x4,-0x4(%rbp)
jmp    131c <detecteMenuPrincipal+0x1cc>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<detecteMenuPrincipal>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
xor    %eax,%eax
call   1060 <adirisseSouris@plt>
mov    %eax,%r15d
xor    %eax,%eax
call   1050 <ordonneeSouris@plt>
mov    %eax,%r14d
xor    %eax,%eax
call   1070 <largeurFenetre@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1030 <hauteurFenetre@plt>
mov    %eax,%r13d
lea    0x0(%rbp,%rbp,1),%eax
cltq
imul   $0x66666667,%rax,%rbx
mov    %rbx,%rax
shr    $0x3f,%rax
sar    $0x21,%rbx
add    %eax,%ebx
lea    0x0(%r13,%r13,2),%eax
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%r12
shr    $0x3f,%r12
mov    %rcx,0x10(%rsp)
sar    $0x21,%rcx
add    %r12d,%ecx
lea    0x0(%rbp,%rbp,2),%eax
cltq
imul   $0x66666667,%rax,%rbp
mov    %rbp,%rax
shr    $0x3f,%rax
sar    $0x21,%rbp
add    %eax,%ebp
lea    0x0(,%r13,8),%eax
sub    %r13d,%eax
cltq
imul   $0x66666667,%rax,%r9
mov    %r9,%rax
shr    $0x3f,%rax
sar    $0x22,%r9
add    %eax,%r9d
mov    %r15d,0xc(%rsp)
mov    %r15d,%edi
mov    %r14d,%esi
mov    %ebx,%edx
mov    %ebp,%r8d
call   1040 <estDansRectangle@plt>
mov    %rax,%rcx
mov    $0x1,%eax
test   %rcx,%rcx
jne    1300 <detecteMenuPrincipal+0x1b0>
lea    0x0(%r13,%r13,8),%eax
cltq
imul   $0x66666667,%rax,%rcx
mov    %rcx,%rax
shr    $0x3f,%rax
sar    $0x23,%rcx
add    %eax,%ecx
lea    0x0(%r13,%r13,4),%eax
lea    0x0(%r13,%rax,2),%eax
cltq
imul   $0x66666667,%rax,%r9
mov    %r9,%rax
shr    $0x3f,%rax
sar    $0x23,%r9
add    %eax,%r9d
mov    0xc(%rsp),%edi
mov    %r14d,%esi
mov    %ebx,%edx
mov    %ebp,%r8d
call   1040 <estDansRectangle@plt>
mov    %rax,%rcx
mov    $0x2,%eax
test   %rcx,%rcx
jne    1300 <detecteMenuPrincipal+0x1b0>
mov    0x10(%rsp),%rcx
sar    $0x22,%rcx
add    %r12d,%ecx
lea    0x0(%r13,%r13,1),%eax
cltq
imul   $0x66666667,%rax,%r9
mov    %r9,%rax
shr    $0x3f,%rax
sar    $0x21,%r9
add    %eax,%r9d
mov    0xc(%rsp),%edi
mov    %r14d,%esi
mov    %ebx,%edx
mov    %ebp,%r8d
call   1040 <estDansRectangle@plt>
mov    %rax,%rcx
mov    $0x3,%eax
test   %rcx,%rcx
jne    1300 <detecteMenuPrincipal+0x1b0>
mov    0x10(%rsp),%rcx
sar    $0x23,%rcx
add    %r12d,%ecx
lea    0x3(%r13),%r9d
test   %r13d,%r13d
cmovns %r13d,%r9d
sar    $0x2,%r9d
mov    0xc(%rsp),%edi
mov    %r14d,%esi
mov    %ebx,%edx
mov    %ebp,%r8d
call   1040 <estDansRectangle@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
shl    $0x2,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @detecteMenuPrincipal() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = call i32 (...) @adirisseSouris()
store i32 %6, i32* %2
%7 = call i32 (...) @ordonneeSouris()
store i32 %7, i32* %3
%8 = call i32 (...) @largeurFenetre()
store i32 %8, i32* %4
%9 = call i32 (...) @hauteurFenetre()
store i32 %9, i32* %5
%10 = load i32, i32* %2
%11 = load i32, i32* %3
%12 = load i32, i32* %4
%13 = mul nsw i32 %12, 2
%14 = sdiv i32 %13, 5
%15 = load i32, i32* %5
%16 = mul nsw i32 %15, 3
%17 = sdiv i32 %16, 5
%18 = load i32, i32* %4
%19 = mul nsw i32 %18, 3
%20 = sdiv i32 %19, 5
%21 = load i32, i32* %5
%22 = mul nsw i32 %21, 7
%23 = sdiv i32 %22, 10
%24 = call i64 @estDansRectangle(i32 %10, i32 %11, i32 %14, i32 %17, i32 %20, i32 %23)
%25 = icmp ne i64 %24, 0
br i1 %25, label %26, label %27
26: ; preds = %0
store i32 1, i32* %1
br label %81
27: ; preds = %0
%28 = load i32, i32* %2
%29 = load i32, i32* %3
%30 = load i32, i32* %4
%31 = mul nsw i32 %30, 2
%32 = sdiv i32 %31, 5
%33 = load i32, i32* %5
%34 = mul nsw i32 %33, 9
%35 = sdiv i32 %34, 20
%36 = load i32, i32* %4
%37 = mul nsw i32 %36, 3
%38 = sdiv i32 %37, 5
%39 = load i32, i32* %5
%40 = mul nsw i32 %39, 11
%41 = sdiv i32 %40, 20
%42 = call i64 @estDansRectangle(i32 %28, i32 %29, i32 %32, i32 %35, i32 %38, i32 %41)
%43 = icmp ne i64 %42, 0
br i1 %43, label %44, label %45
44: ; preds = %27
store i32 2, i32* %1
br label %81
45: ; preds = %27
%46 = load i32, i32* %2
%47 = load i32, i32* %3
%48 = load i32, i32* %4
%49 = mul nsw i32 %48, 2
%50 = sdiv i32 %49, 5
%51 = load i32, i32* %5
%52 = mul nsw i32 %51, 3
%53 = sdiv i32 %52, 10
%54 = load i32, i32* %4
%55 = mul nsw i32 %54, 3
%56 = sdiv i32 %55, 5
%57 = load i32, i32* %5
%58 = mul nsw i32 %57, 2
%59 = sdiv i32 %58, 5
%60 = call i64 @estDansRectangle(i32 %46, i32 %47, i32 %50, i32 %53, i32 %56, i32 %59)
%61 = icmp ne i64 %60, 0
br i1 %61, label %62, label %63
62: ; preds = %45
store i32 3, i32* %1
br label %81
63: ; preds = %45
%64 = load i32, i32* %2
%65 = load i32, i32* %3
%66 = load i32, i32* %4
%67 = mul nsw i32 %66, 2
%68 = sdiv i32 %67, 5
%69 = load i32, i32* %5
%70 = mul nsw i32 %69, 3
%71 = sdiv i32 %70, 20
%72 = load i32, i32* %4
%73 = mul nsw i32 %72, 3
%74 = sdiv i32 %73, 5
%75 = load i32, i32* %5
%76 = sdiv i32 %75, 4
%77 = call i64 @estDansRectangle(i32 %64, i32 %65, i32 %68, i32 %71, i32 %74, i32 %76)
%78 = icmp ne i64 %77, 0
br i1 %78, label %79, label %80
79: ; preds = %63
store i32 4, i32* %1
br label %81
80: ; preds = %63
store i32 0, i32* %1
br label %81
81: ; preds = %80, %79, %62, %44, %26
%82 = load i32, i32* %1
ret i32 %82
}

LLVM IR (-O2):
define i32 @detecteMenuPrincipal() {
%1 = tail call i32 (...) @adirisseSouris()
%2 = tail call i32 (...) @ordonneeSouris()
%3 = tail call i32 (...) @largeurFenetre()
%4 = tail call i32 (...) @hauteurFenetre()
%5 = shl nsw i32 %3, 1
%6 = sdiv i32 %5, 5
%7 = mul nsw i32 %4, 3
%8 = sdiv i32 %7, 5
%9 = mul nsw i32 %3, 3
%10 = sdiv i32 %9, 5
%11 = mul nsw i32 %4, 7
%12 = sdiv i32 %11, 10
%13 = tail call i64 @estDansRectangle(i32 %1, i32 %2, i32 %6, i32 %8, i32 %10, i32 %12)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %34
15: ; preds = %0
%16 = mul nsw i32 %4, 9
%17 = sdiv i32 %16, 20
%18 = mul nsw i32 %4, 11
%19 = sdiv i32 %18, 20
%20 = tail call i64 @estDansRectangle(i32 %1, i32 %2, i32 %6, i32 %17, i32 %10, i32 %19)
%21 = icmp eq i64 %20, 0
br i1 %21, label %22, label %34
22: ; preds = %15
%23 = sdiv i32 %7, 10
%24 = shl nsw i32 %4, 1
%25 = sdiv i32 %24, 5
%26 = tail call i64 @estDansRectangle(i32 %1, i32 %2, i32 %6, i32 %23, i32 %10, i32 %25)
%27 = icmp eq i64 %26, 0
br i1 %27, label %28, label %34
28: ; preds = %22
%29 = sdiv i32 %7, 20
%30 = sdiv i32 %4, 4
%31 = tail call i64 @estDansRectangle(i32 %1, i32 %2, i32 %6, i32 %29, i32 %10, i32 %30)
%32 = icmp eq i64 %31, 0
%33 = select i1 %32, i32 0, i32 4
br label %34
34: ; preds = %28, %22, %15, %0
%35 = phi i32 [ 1, %0 ], [ 2, %15 ], [ 3, %22 ], [ %33, %28 ]
ret i32 %35
}