#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 */
struct ADrawTag {
  int dummy;
};

/* Variables and functions */
unsigned int INT_MAX;
scalar_t__ abs(int);
int /*<<< orphan*/ gdImageLine(int /*<<< orphan*/, unsigned int, unsigned int,
                               unsigned int, unsigned int, int);
int /*<<< orphan*/ gdImageSetAntiAliased(int /*<<< orphan*/,
                                         int /*<<< orphan*/);
int /*<<< orphan*/ getGdoImg(struct ADrawTag *);
int /*<<< orphan*/ getGdoPen(struct ADrawTag *);
int /*<<< orphan*/ swap(unsigned int *, unsigned int *);
void gdoLine(struct ADrawTag *ctx, unsigned int x1, unsigned int y1,
             unsigned int x2, unsigned int y2) {
  if (x1 <= INT_MAX && y1 <= INT_MAX && x2 <= INT_MAX && y2 <= INT_MAX) {
    if (x1 > x2 && abs((int)x1 - (int)x2) > abs((int)y1 - (int)y2)) {
      swap(&x1, &x2);
      swap(&y1, &y2);
    }
    gdImageSetAntiAliased(getGdoImg(ctx), getGdoPen(ctx));
    gdImageLine(getGdoImg(ctx), x1, y1, x2, y2, (-7));
  }
}


x86 assembly (clang, -O0):
<gdoLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    0x2e65(%rip),%rcx
cmp    (%rcx),%eax
ja     1253 <gdoLine+0xf3>
mov    -0x10(%rbp),%eax
mov    0x2e53(%rip),%rcx
cmp    (%rcx),%eax
ja     1253 <gdoLine+0xf3>
mov    -0x14(%rbp),%eax
mov    0x2e41(%rip),%rcx
cmp    (%rcx),%eax
ja     1253 <gdoLine+0xf3>
mov    -0x18(%rbp),%eax
mov    0x2e2f(%rip),%rcx
cmp    (%rcx),%eax
ja     1253 <gdoLine+0xf3>
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jbe    1211 <gdoLine+0xb1>
mov    -0xc(%rbp),%edi
sub    -0x14(%rbp),%edi
call   1040 <abs@plt>
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%edi
sub    -0x18(%rbp),%edi
call   1040 <abs@plt>
mov    %rax,%rcx
mov    -0x20(%rbp),%rax
cmp    %rcx,%rax
jle    1211 <gdoLine+0xb1>
lea    -0xc(%rbp),%rdi
lea    -0x14(%rbp),%rsi
call   1070 <swap@plt>
lea    -0x10(%rbp),%rdi
lea    -0x18(%rbp),%rsi
call   1070 <swap@plt>
mov    -0x8(%rbp),%rdi
call   1080 <getGdoImg@plt>
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <getGdoPen@plt>
mov    -0x24(%rbp),%edi
mov    %eax,%esi
call   1030 <gdImageSetAntiAliased@plt>
mov    -0x8(%rbp),%rdi
call   1080 <getGdoImg@plt>
mov    %eax,%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
mov    $0xfffffff9,%r9d
call   1060 <gdImageLine@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<gdoLine>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
mov    %esi,0x14(%rsp)
mov    %edx,0x10(%rsp)
mov    %ecx,0xc(%rsp)
mov    %r8d,0x8(%rsp)
mov    0x2e66(%rip),%rax
mov    (%rax),%eax
cmp    %esi,%eax
jb     1224 <gdoLine+0xc4>
mov    %edx,%ebx
cmp    %edx,%eax
jb     1224 <gdoLine+0xc4>
cmp    %ecx,%eax
jb     1224 <gdoLine+0xc4>
mov    %r8d,%ebp
cmp    %r8d,%eax
jb     1224 <gdoLine+0xc4>
mov    %rdi,%r14
sub    %ecx,%esi
jbe    11e3 <gdoLine+0x83>
mov    %esi,%edi
call   1040 <abs@plt>
mov    %rax,%r15
sub    %ebp,%ebx
mov    %ebx,%edi
call   1040 <abs@plt>
cmp    %rax,%r15
jle    11e3 <gdoLine+0x83>
lea    0x14(%rsp),%rdi
lea    0xc(%rsp),%rsi
call   1070 <swap@plt>
lea    0x10(%rsp),%rdi
lea    0x8(%rsp),%rsi
call   1070 <swap@plt>
mov    %r14,%rdi
call   1080 <getGdoImg@plt>
mov    %eax,%ebx
mov    %r14,%rdi
call   1050 <getGdoPen@plt>
mov    %ebx,%edi
mov    %eax,%esi
call   1030 <gdImageSetAntiAliased@plt>
mov    %r14,%rdi
call   1080 <getGdoImg@plt>
mov    0x14(%rsp),%esi
mov    0x10(%rsp),%edx
mov    0xc(%rsp),%ecx
mov    0x8(%rsp),%r8d
mov    %eax,%edi
mov    $0xfffffff9,%r9d
call   1060 <gdImageLine@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
%struct.ADrawTag = type { i32 }
@INT_MAX = global i32 0
define void @gdoLine(%struct.ADrawTag* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca %struct.ADrawTag*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store %struct.ADrawTag* %0, %struct.ADrawTag** %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%11 = load i32, i32* %7
%12 = load i32, i32* @INT_MAX
%13 = icmp ule i32 %11, %12
br i1 %13, label %14, label %56
14: ; preds = %5
%15 = load i32, i32* %8
%16 = load i32, i32* @INT_MAX
%17 = icmp ule i32 %15, %16
br i1 %17, label %18, label %56
18: ; preds = %14
%19 = load i32, i32* %9
%20 = load i32, i32* @INT_MAX
%21 = icmp ule i32 %19, %20
br i1 %21, label %22, label %56
22: ; preds = %18
%23 = load i32, i32* %10
%24 = load i32, i32* @INT_MAX
%25 = icmp ule i32 %23, %24
br i1 %25, label %26, label %56
26: ; preds = %22
%27 = load i32, i32* %7
%28 = load i32, i32* %9
%29 = icmp ugt i32 %27, %28
br i1 %29, label %30, label %43
30: ; preds = %26
%31 = load i32, i32* %7
%32 = load i32, i32* %9
%33 = sub nsw i32 %31, %32
%34 = call i64 @abs(i32 %33)
%35 = load i32, i32* %8
%36 = load i32, i32* %10
%37 = sub nsw i32 %35, %36
%38 = call i64 @abs(i32 %37)
%39 = icmp sgt i64 %34, %38
br i1 %39, label %40, label %43
40: ; preds = %30
%41 = call i32 @swap(i32* %7, i32* %9)
%42 = call i32 @swap(i32* %8, i32* %10)
br label %43
43: ; preds = %40, %30, %26
%44 = load %struct.ADrawTag*, %struct.ADrawTag** %6
%45 = call i32 @getGdoImg(%struct.ADrawTag* %44)
%46 = load %struct.ADrawTag*, %struct.ADrawTag** %6
%47 = call i32 @getGdoPen(%struct.ADrawTag* %46)
%48 = call i32 @gdImageSetAntiAliased(i32 %45, i32 %47)
%49 = load %struct.ADrawTag*, %struct.ADrawTag** %6
%50 = call i32 @getGdoImg(%struct.ADrawTag* %49)
%51 = load i32, i32* %7
%52 = load i32, i32* %8
%53 = load i32, i32* %9
%54 = load i32, i32* %10
%55 = call i32 @gdImageLine(i32 %50, i32 %51, i32 %52, i32 %53, i32 %54, i32 -7)
br label %56
56: ; preds = %43, %22, %18, %14, %5
ret void
}

LLVM IR (-O2):
%struct.ADrawTag = type { i32 }
@INT_MAX = global i32 0
define void @gdoLine(%struct.ADrawTag* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
store i32 %4, i32* %9
%10 = load i32, i32* @INT_MAX
%11 = icmp ult i32 %10, %1
%12 = icmp ult i32 %10, %2
%13 = or i1 %11, %12
br i1 %13, label %39, label %14
14: ; preds = %5
%15 = icmp ult i32 %10, %3
%16 = icmp ult i32 %10, %4
%17 = or i1 %15, %16
br i1 %17, label %39, label %18
18: ; preds = %14
%19 = icmp ugt i32 %1, %3
br i1 %19, label %20, label %29
20: ; preds = %18
%21 = sub nsw i32 %1, %3
%22 = tail call i64 @abs(i32 %21)
%23 = sub nsw i32 %2, %4
%24 = tail call i64 @abs(i32 %23)
%25 = icmp sgt i64 %22, %24
br i1 %25, label %26, label %29
26: ; preds = %20
%27 = call i32 @swap(i32* %6, i32* %8)
%28 = call i32 @swap(i32* %7, i32* %9)
br label %29
29: ; preds = %26, %20, %18
%30 = call i32 @getGdoImg(%struct.ADrawTag* %0)
%31 = call i32 @getGdoPen(%struct.ADrawTag* %0)
%32 = call i32 @gdImageSetAntiAliased(i32 %30, i32 %31)
%33 = call i32 @getGdoImg(%struct.ADrawTag* %0)
%34 = load i32, i32* %6
%35 = load i32, i32* %7
%36 = load i32, i32* %8
%37 = load i32, i32* %9
%38 = call i32 @gdImageLine(i32 %33, i32 %34, i32 %35, i32 %36, i32 %37, i32 -7)
br label %39
39: ; preds = %29, %14, %5
ret void
}