#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*/ AdjustSpan(int *, int *, int);
scalar_t__ IsCompletelyOutside(int, int, int, int, int, int);
bool ClipLine(int *u, int *v, int *len, int clipu, int clipv) {
  if (IsCompletelyOutside(*u, *v, *len, 1, clipu, clipv))
    return false;
  AdjustSpan(u, len, clipu);
  return true;
}


x86 assembly (clang, -O0):
<ClipLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    %r8d,-0x28(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
mov    -0x20(%rbp),%rax
mov    (%rax),%edx
mov    -0x24(%rbp),%r8d
mov    -0x28(%rbp),%r9d
mov    $0x1,%ecx
call   1040 <IsCompletelyOutside@plt>
cmp    $0x0,%rax
je     1175 <ClipLine+0x55>
movl   $0x0,-0x4(%rbp)
jmp    118c <ClipLine+0x6c>
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
mov    -0x24(%rbp),%edx
call   1030 <AdjustSpan@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ClipLine>:
push   %rbp
push   %r14
push   %rbx
mov    %r8d,%r9d
mov    %ecx,%r14d
mov    %rdx,%rbx
mov    %rdi,%rbp
mov    (%rdi),%edi
mov    (%rsi),%esi
mov    (%rdx),%edx
mov    $0x1,%ecx
mov    %r14d,%r8d
call   1040 <IsCompletelyOutside@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
jne    1160 <ClipLine+0x40>
mov    %rbp,%rdi
mov    %rbx,%rsi
mov    %r14d,%edx
call   1030 <AdjustSpan@plt>
mov    $0x1,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @ClipLine(i32* %0, i32* %1, i32* %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i32
store i32* %0, i32** %7
store i32* %1, i32** %8
store i32* %2, i32** %9
store i32 %3, i32* %10
store i32 %4, i32* %11
%12 = load i32*, i32** %7
%13 = load i32, i32* %12
%14 = load i32*, i32** %8
%15 = load i32, i32* %14
%16 = load i32*, i32** %9
%17 = load i32, i32* %16
%18 = load i32, i32* %10
%19 = load i32, i32* %11
%20 = call i64 @IsCompletelyOutside(i32 %13, i32 %15, i32 %17, i32 1, i32 %18, i32 %19)
%21 = icmp ne i64 %20, 0
br i1 %21, label %22, label %23
22: ; preds = %5
store i32 0, i32* %6
br label %28
23: ; preds = %5
%24 = load i32*, i32** %7
%25 = load i32*, i32** %9
%26 = load i32, i32* %10
%27 = call i32 @AdjustSpan(i32* %24, i32* %25, i32 %26)
store i32 1, i32* %6
br label %28
28: ; preds = %23, %22
%29 = load i32, i32* %6
ret i32 %29
}

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