#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 */
scalar_t__ point_in_polygon(int, int, int, int *, int *);
int rectangle_inside_polygon(int rx, int ry, int w, int h, int number_of_points,
                             int *xs, int *ys) {
  return (point_in_polygon(rx, ry, number_of_points, xs, ys) &&
          point_in_polygon(rx + w - 1, ry, number_of_points, xs, ys) &&
          point_in_polygon(rx, ry + h - 1, number_of_points, xs, ys) &&
          point_in_polygon(rx + w - 1, ry + h - 1, number_of_points, xs, ys));
}


x86 assembly (clang, -O0):
<rectangle_inside_polygon>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x10(%rbp),%rax
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    %r9,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    0x10(%rbp),%r8
call   1030 <point_in_polygon@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x21(%rbp)
je     11e0 <rectangle_inside_polygon+0xd0>
mov    -0x4(%rbp),%edi
add    -0xc(%rbp),%edi
sub    $0x1,%edi
mov    -0x8(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    0x10(%rbp),%r8
call   1030 <point_in_polygon@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x21(%rbp)
je     11e0 <rectangle_inside_polygon+0xd0>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
add    -0x10(%rbp),%esi
sub    $0x1,%esi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    0x10(%rbp),%r8
call   1030 <point_in_polygon@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x21(%rbp)
je     11e0 <rectangle_inside_polygon+0xd0>
mov    -0x4(%rbp),%edi
add    -0xc(%rbp),%edi
sub    $0x1,%edi
mov    -0x8(%rbp),%esi
add    -0x10(%rbp),%esi
sub    $0x1,%esi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rcx
mov    0x10(%rbp),%r8
call   1030 <point_in_polygon@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<rectangle_inside_polygon>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,%r13
mov    %r8d,%ebp
mov    %rcx,(%rsp)
mov    %edx,%r12d
mov    %esi,%r14d
mov    %edi,%ebx
mov    0x40(%rsp),%r8
mov    %ebp,%edx
mov    %r9,%rcx
call   1030 <point_in_polygon@plt>
xor    %r15d,%r15d
test   %rax,%rax
je     11a8 <rectangle_inside_polygon+0x98>
add    %ebx,%r12d
add    $0xffffffff,%r12d
mov    %r12d,%edi
mov    %r14d,%esi
mov    %ebp,%edx
mov    %r13,%rcx
mov    0x40(%rsp),%r8
call   1030 <point_in_polygon@plt>
test   %rax,%rax
je     11a8 <rectangle_inside_polygon+0x98>
mov    (%rsp),%rax
add    %eax,%r14d
add    $0xffffffff,%r14d
mov    %ebx,%edi
mov    %r14d,%esi
mov    %ebp,%edx
mov    %r13,%rcx
mov    0x40(%rsp),%r8
call   1030 <point_in_polygon@plt>
test   %rax,%rax
je     11a8 <rectangle_inside_polygon+0x98>
mov    %r12d,%edi
mov    %r14d,%esi
mov    %ebp,%edx
mov    %r13,%rcx
mov    0x40(%rsp),%r8
call   1030 <point_in_polygon@plt>
xor    %r15d,%r15d
test   %rax,%rax
setne  %r15b
mov    %r15d,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32 @rectangle_inside_polygon(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32* %5, i32* %6) {
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32*
%14 = alloca i32*
store i32 %0, i32* %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i32* %5, i32** %13
store i32* %6, i32** %14
%15 = load i32, i32* %8
%16 = load i32, i32* %9
%17 = load i32, i32* %12
%18 = load i32*, i32** %13
%19 = load i32*, i32** %14
%20 = call i64 @point_in_polygon(i32 %15, i32 %16, i32 %17, i32* %18, i32* %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %58
22: ; preds = %7
%23 = load i32, i32* %8
%24 = load i32, i32* %10
%25 = add nsw i32 %23, %24
%26 = sub nsw i32 %25, 1
%27 = load i32, i32* %9
%28 = load i32, i32* %12
%29 = load i32*, i32** %13
%30 = load i32*, i32** %14
%31 = call i64 @point_in_polygon(i32 %26, i32 %27, i32 %28, i32* %29, i32* %30)
%32 = icmp ne i64 %31, 0
br i1 %32, label %33, label %58
33: ; preds = %22
%34 = load i32, i32* %8
%35 = load i32, i32* %9
%36 = load i32, i32* %11
%37 = add nsw i32 %35, %36
%38 = sub nsw i32 %37, 1
%39 = load i32, i32* %12
%40 = load i32*, i32** %13
%41 = load i32*, i32** %14
%42 = call i64 @point_in_polygon(i32 %34, i32 %38, i32 %39, i32* %40, i32* %41)
%43 = icmp ne i64 %42, 0
br i1 %43, label %44, label %58
44: ; preds = %33
%45 = load i32, i32* %8
%46 = load i32, i32* %10
%47 = add nsw i32 %45, %46
%48 = sub nsw i32 %47, 1
%49 = load i32, i32* %9
%50 = load i32, i32* %11
%51 = add nsw i32 %49, %50
%52 = sub nsw i32 %51, 1
%53 = load i32, i32* %12
%54 = load i32*, i32** %13
%55 = load i32*, i32** %14
%56 = call i64 @point_in_polygon(i32 %48, i32 %52, i32 %53, i32* %54, i32* %55)
%57 = icmp ne i64 %56, 0
br label %58
58: ; preds = %44, %33, %22, %7
%59 = phi i1 [ false, %33 ], [ false, %22 ], [ false, %7 ], [ %57, %44 ]
%60 = zext i1 %59 to i32
ret i32 %60
}

LLVM IR (-O2):
define i32 @rectangle_inside_polygon(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4, i32* %5, i32* %6) {
%8 = tail call i64 @point_in_polygon(i32 %0, i32 %1, i32 %4, i32* %5, i32* %6)
%9 = icmp eq i64 %8, 0
br i1 %9, label %24, label %10
10: ; preds = %7
%11 = add i32 %0, -1
%12 = add i32 %11, %2
%13 = tail call i64 @point_in_polygon(i32 %12, i32 %1, i32 %4, i32* %5, i32* %6)
%14 = icmp eq i64 %13, 0
br i1 %14, label %24, label %15
15: ; preds = %10
%16 = add i32 %1, -1
%17 = add i32 %16, %3
%18 = tail call i64 @point_in_polygon(i32 %0, i32 %17, i32 %4, i32* %5, i32* %6)
%19 = icmp eq i64 %18, 0
br i1 %19, label %24, label %20
20: ; preds = %15
%21 = tail call i64 @point_in_polygon(i32 %12, i32 %17, i32 %4, i32* %5, i32* %6)
%22 = icmp ne i64 %21, 0
%23 = zext i1 %22 to i32
br label %24
24: ; preds = %20, %15, %10, %7
%25 = phi i32 [ 0, %15 ], [ 0, %10 ], [ 0, %7 ], [ %23, %20 ]
ret i32 %25
}