#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*/ draw_line_h(char *, int, int, int, int);
int /*<<< orphan*/ draw_line_oblique(char *, int, int, int, int);
int /*<<< orphan*/ draw_line_v(char *, int, int, int, int);
void draw_line(char *fbp, int x1, int y1, int x2, int y2) {
  if (x1 == x2)
    draw_line_v(fbp, x1, y1, x2, y2);
  else if (y1 == y2)
    draw_line_h(fbp, x1, y1, x2, y2);
  else
    draw_line_oblique(fbp, x1, y1, x2, y2);
}


x86 assembly (clang, -O0):
<draw_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%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
cmp    -0x14(%rbp),%eax
jne    1170 <draw_line+0x40>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
call   1040 <draw_line_v@plt>
jmp    11b2 <draw_line+0x82>
mov    -0x10(%rbp),%eax
cmp    -0x18(%rbp),%eax
jne    1197 <draw_line+0x67>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
call   1030 <draw_line_h@plt>
jmp    11ad <draw_line+0x7d>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
call   1050 <draw_line_oblique@plt>
jmp    11b2 <draw_line+0x82>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_line>:
cmp    %ecx,%esi
jne    113b <draw_line+0xb>
mov    %esi,%ecx
jmp    1040 <draw_line_v@plt>
cmp    %r8d,%edx
jne    1148 <draw_line+0x18>
mov    %edx,%r8d
jmp    1030 <draw_line_h@plt>
jmp    1050 <draw_line_oblique@plt>

LLVM IR (-O0):
define void @draw_line(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i8* %0, i8** %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* %9
%13 = icmp eq i32 %11, %12
br i1 %13, label %14, label %21
14: ; preds = %5
%15 = load i8*, i8** %6
%16 = load i32, i32* %7
%17 = load i32, i32* %8
%18 = load i32, i32* %9
%19 = load i32, i32* %10
%20 = call i32 @draw_line_v(i8* %15, i32 %16, i32 %17, i32 %18, i32 %19)
br label %40
21: ; preds = %5
%22 = load i32, i32* %8
%23 = load i32, i32* %10
%24 = icmp eq i32 %22, %23
br i1 %24, label %25, label %32
25: ; preds = %21
%26 = load i8*, i8** %6
%27 = load i32, i32* %7
%28 = load i32, i32* %8
%29 = load i32, i32* %9
%30 = load i32, i32* %10
%31 = call i32 @draw_line_h(i8* %26, i32 %27, i32 %28, i32 %29, i32 %30)
br label %39
32: ; preds = %21
%33 = load i8*, i8** %6
%34 = load i32, i32* %7
%35 = load i32, i32* %8
%36 = load i32, i32* %9
%37 = load i32, i32* %10
%38 = call i32 @draw_line_oblique(i8* %33, i32 %34, i32 %35, i32 %36, i32 %37)
br label %39
39: ; preds = %32, %25
br label %40
40: ; preds = %39, %14
ret void
}

LLVM IR (-O2):
define void @draw_line(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = icmp eq i32 %1, %3
br i1 %6, label %7, label %9
7: ; preds = %5
%8 = tail call i32 @draw_line_v(i8* %0, i32 %1, i32 %2, i32 %1, i32 %4)
br label %15
9: ; preds = %5
%10 = icmp eq i32 %2, %4
br i1 %10, label %11, label %13
11: ; preds = %9
%12 = tail call i32 @draw_line_h(i8* %0, i32 %1, i32 %2, i32 %3, i32 %2)
br label %15
13: ; preds = %9
%14 = tail call i32 @draw_line_oblique(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4)
br label %15
15: ; preds = %11, %13, %7
ret void
}