#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_oblique_down(char *, int, int, int, int);
int /*<<< orphan*/ draw_line_oblique_up(char *, int, int, int, int);
int /*<<< orphan*/ printf(char *, int, int, int, int);
void draw_line_oblique(char *fbp, int x1, int y1, int x2, int y2) {
  int i, j;
  printf("draw: %d.%d -> %d.%d\n", x1, y1, x2, y2);
  if (x1 > x2) {
    i = x1;
    j = y1;
    x1 = x2;
    x2 = i;
    y1 = y2;
    y2 = j;
  }
  if (y1 > y2) {
    draw_line_oblique_down(fbp, x1, y1, x2, y2);
  } else {
    draw_line_oblique_up(fbp, x1, y1, x2, y2);
  }
}


x86 assembly (clang, -O0):
<draw_line_oblique>:
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),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
lea    0xea3(%rip),%rdi
call   1050 <printf@plt>
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jle    1192 <draw_line_oblique+0x62>
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    -0x1c(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x18(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0x18(%rbp),%eax
jle    11b9 <draw_line_oblique+0x89>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
call   1040 <draw_line_oblique_down@plt>
jmp    11cf <draw_line_oblique+0x9f>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x14(%rbp),%ecx
mov    -0x18(%rbp),%r8d
call   1030 <draw_line_oblique_up@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<draw_line_oblique>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %r8d,%r12d
mov    %ecx,%ebx
mov    %edx,%r15d
mov    %esi,%ebp
mov    %rdi,%r14
lea    0xeb4(%rip),%rdi
call   1050 <printf@plt>
cmp    %ebx,%ebp
jle    115c <draw_line_oblique+0x2c>
mov    %ebp,%ecx
mov    %r15d,%r8d
jmp    1166 <draw_line_oblique+0x36>
mov    %ebx,%ecx
mov    %r12d,%r8d
mov    %r15d,%r12d
mov    %ebp,%ebx
mov    %r14,%rdi
mov    %ebx,%esi
mov    %r12d,%edx
cmp    %r8d,%r12d
jle    1180 <draw_line_oblique+0x50>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1040 <draw_line_oblique_down@plt>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <draw_line_oblique_up@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"draw: %d.%d -> %d.%d\0A\00"
define void @draw_line_oblique(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
%11 = alloca i32
%12 = 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
%13 = load i32, i32* %7
%14 = load i32, i32* %8
%15 = load i32, i32* %9
%16 = load i32, i32* %10
%17 = call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %13, i32 %14, i32 %15, i32 %16)
%18 = load i32, i32* %7
%19 = load i32, i32* %9
%20 = icmp sgt i32 %18, %19
br i1 %20, label %21, label %28
21: ; preds = %5
%22 = load i32, i32* %7
store i32 %22, i32* %11
%23 = load i32, i32* %8
store i32 %23, i32* %12
%24 = load i32, i32* %9
store i32 %24, i32* %7
%25 = load i32, i32* %11
store i32 %25, i32* %9
%26 = load i32, i32* %10
store i32 %26, i32* %8
%27 = load i32, i32* %12
store i32 %27, i32* %10
br label %28
28: ; preds = %21, %5
%29 = load i32, i32* %8
%30 = load i32, i32* %10
%31 = icmp sgt i32 %29, %30
br i1 %31, label %32, label %39
32: ; preds = %28
%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_down(i8* %33, i32 %34, i32 %35, i32 %36, i32 %37)
br label %46
39: ; preds = %28
%40 = load i8*, i8** %6
%41 = load i32, i32* %7
%42 = load i32, i32* %8
%43 = load i32, i32* %9
%44 = load i32, i32* %10
%45 = call i32 @draw_line_oblique_up(i8* %40, i32 %41, i32 %42, i32 %43, i32 %44)
br label %46
46: ; preds = %39, %32
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"draw: %d.%d -> %d.%d\0A\00"
define void @draw_line_oblique(i8* %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = tail call i32 @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2, i32 %3, i32 %4)
%7 = icmp sgt i32 %1, %3
br i1 %7, label %8, label %9
8: ; preds = %5
br label %9
9: ; preds = %8, %5
%10 = phi i32 [ %1, %8 ], [ %3, %5 ]
%11 = phi i32 [ %2, %8 ], [ %4, %5 ]
%12 = phi i32 [ %4, %8 ], [ %2, %5 ]
%13 = phi i32 [ %3, %8 ], [ %1, %5 ]
%14 = icmp sgt i32 %12, %11
br i1 %14, label %15, label %17
15: ; preds = %9
%16 = tail call i32 @draw_line_oblique_down(i8* %0, i32 %13, i32 %12, i32 %10, i32 %11)
br label %19
17: ; preds = %9
%18 = tail call i32 @draw_line_oblique_up(i8* %0, i32 %13, i32 %12, i32 %10, i32 %11)
br label %19
19: ; preds = %17, %15
ret void
}