#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 /*<<< orphan*/ AdjustSpan2(int *, int *, int *, int);
scalar_t__ IsCompletelyOutside(int, int, int, int, int, int);
bool ClipRectangle2(int *x, int *y, int *u, int *v, int *w, int *h, int clipw,
                    int cliph) {
  if (IsCompletelyOutside(*x, *y, *w, *h, clipw, cliph))
    return false;
  AdjustSpan2(x, u, w, clipw);
  AdjustSpan2(y, v, h, cliph);
  return true;
}


x86 assembly (clang, -O0):
<ClipRectangle2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    0x18(%rbp),%eax
mov    0x10(%rbp),%eax
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    %r8,-0x30(%rbp)
mov    %r9,-0x38(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
mov    -0x30(%rbp),%rax
mov    (%rax),%edx
mov    -0x38(%rbp),%rax
mov    (%rax),%ecx
mov    0x10(%rbp),%r8d
mov    0x18(%rbp),%r9d
call   1040 <IsCompletelyOutside@plt>
cmp    $0x0,%rax
je     1181 <ClipRectangle2+0x61>
movl   $0x0,-0x4(%rbp)
jmp    11b0 <ClipRectangle2+0x90>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x30(%rbp),%rdx
mov    0x10(%rbp),%ecx
call   1030 <AdjustSpan2@plt>
mov    -0x18(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x38(%rbp),%rdx
mov    0x18(%rbp),%ecx
call   1030 <AdjustSpan2@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ClipRectangle2>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9,%r12
mov    %r8,%rbx
mov    %rcx,(%rsp)
mov    %rdx,%r13
mov    %rsi,%rbp
mov    %rdi,%r14
mov    0x48(%rsp),%r9d
mov    0x40(%rsp),%r15d
mov    (%rdi),%edi
mov    (%rsi),%esi
mov    (%r8),%edx
mov    (%r12),%ecx
mov    %r15d,%r8d
call   1040 <IsCompletelyOutside@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
jne    118e <ClipRectangle2+0x6e>
mov    %r14,%rdi
mov    %r13,%rsi
mov    %rbx,%rdx
mov    %r15d,%ecx
call   1030 <AdjustSpan2@plt>
mov    %rbp,%rdi
mov    (%rsp),%rsi
mov    %r12,%rdx
mov    0x48(%rsp),%ecx
call   1030 <AdjustSpan2@plt>
mov    $0x1,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @ClipRectangle2(i32* %0, i32* %1, i32* %2, i32* %3, i32* %4, i32* %5, i32 %6, i32 %7) {
%9 = load i32, i32* %0
%10 = load i32, i32* %1
%11 = load i32, i32* %4
%12 = load i32, i32* %5
%13 = tail call i64 @IsCompletelyOutside(i32 %9, i32 %10, i32 %11, i32 %12, i32 %6, i32 %7)
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %18
15: ; preds = %8
%16 = tail call i32 @AdjustSpan2(i32* %0, i32* %2, i32* %4, i32 %6)
%17 = tail call i32 @AdjustSpan2(i32* %1, i32* %3, i32* %5, i32 %7)
br label %18
18: ; preds = %8, %15
%19 = phi i32 [ 1, %15 ], [ 0, %8 ]
ret i32 %19
}