#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 graph {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ graph_setpixel(struct graph *, int, int, int);
void graph_line(struct graph *g, int x0, int y0, int x1, int y1, int color) {
  int i;
  if (x0 == x1) {
    for (i = y0; i <= y1; i++)
      graph_setpixel(g, x0, i, color);
  } else if (y0 == y1) {
    for (i = x0; i <= x1; i++)
      graph_setpixel(g, i, y0, color);
  } else {
  }
  return;
}


x86 assembly (clang, -O0):
<graph_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    %r9d,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x14(%rbp),%eax
jne    1170 <graph_line+0x60>
mov    -0x10(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     116b <graph_line+0x5b>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x20(%rbp),%edx
mov    -0x1c(%rbp),%ecx
call   1030 <graph_setpixel@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    113f <graph_line+0x2f>
jmp    11bd <graph_line+0xad>
mov    -0x10(%rbp),%eax
cmp    -0x18(%rbp),%eax
jne    11b3 <graph_line+0xa3>
mov    -0xc(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x14(%rbp),%eax
jg     11ae <graph_line+0x9e>
mov    -0x8(%rbp),%rdi
mov    -0x20(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0x1c(%rbp),%ecx
call   1030 <graph_setpixel@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1182 <graph_line+0x72>
jmp    11b8 <graph_line+0xa8>
jmp    11b8 <graph_line+0xa8>
jmp    11bd <graph_line+0xad>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<graph_line>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,%r14d
mov    %r8d,%r13d
mov    %edx,%ebp
mov    %esi,%ebx
mov    %rdi,%r15
cmp    %ecx,%esi
jne    1159 <graph_line+0x49>
cmp    %r13d,%ebp
jg     1187 <graph_line+0x77>
add    $0x1,%r13d
cs nopw 0x0(%rax,%rax,1)
nop
mov    %r15,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %r14d,%ecx
call   1030 <graph_setpixel@plt>
add    $0x1,%ebp
cmp    %ebp,%r13d
jne    1140 <graph_line+0x30>
jmp    1187 <graph_line+0x77>
cmp    %r13d,%ebp
jne    1187 <graph_line+0x77>
mov    %ecx,%r12d
cmp    %ecx,%ebx
jg     1187 <graph_line+0x77>
add    $0x1,%r12d
nopl   0x0(%rax)
mov    %r15,%rdi
mov    %ebx,%esi
mov    %ebp,%edx
mov    %r14d,%ecx
call   1030 <graph_setpixel@plt>
add    $0x1,%ebx
cmp    %ebx,%r12d
jne    1170 <graph_line+0x60>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
%struct.graph = type { i32 }
define void @graph_line(%struct.graph* %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5) {
%7 = icmp eq i32 %1, %3
br i1 %7, label %8, label %15
8: ; preds = %6
%9 = icmp sgt i32 %2, %4
br i1 %9, label %24, label %10
10: ; preds = %8, %10
%11 = phi i32 [ %13, %10 ], [ %2, %8 ]
%12 = tail call i32 @graph_setpixel(%struct.graph* %0, i32 %1, i32 %11, i32 %5)
%13 = add i32 %11, 1
%14 = icmp eq i32 %11, %4
br i1 %14, label %24, label %10
15: ; preds = %6
%16 = icmp ne i32 %2, %4
%17 = icmp sgt i32 %1, %3
%18 = or i1 %16, %17
br i1 %18, label %24, label %19
19: ; preds = %15, %19
%20 = phi i32 [ %22, %19 ], [ %1, %15 ]
%21 = tail call i32 @graph_setpixel(%struct.graph* %0, i32 %20, i32 %2, i32 %5)
%22 = add i32 %20, 1
%23 = icmp eq i32 %20, %3
br i1 %23, label %24, label %19
24: ; preds = %19, %10, %8, %15
ret void
}