#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*/ GL_COLOR_BUFFER_BIT;
int /*<<< orphan*/ glClear(int /*<<< orphan*/);
int /*<<< orphan*/ glColor3f(double, double, double);
int /*<<< orphan*/ glFlush();
int /*<<< orphan*/ setPixel(int, int);
void display(void) {
  glClear(GL_COLOR_BUFFER_BIT);
  glColor3f(0.0, 1.0, 0.0);
  int i, x1 = 40, y1 = 200, x2 = 200, y2 = 10, Delta_x, Delta_y, new_e, x, y;
  Delta_x = x2 - x1;
  Delta_y = y2 - y1;
  x = x1;
  y = y1;
  new_e = 2 * Delta_y - Delta_x;
  for (i = 1; i <= Delta_x; i++) {
    setPixel(x, y);
    while (new_e <= 0) {
      y = y - 1;
      new_e = new_e + 2 * Delta_x;
    }
    x = x + 1;
    new_e = new_e + 2 * Delta_y;
  }
  glFlush();
}


x86 assembly (clang, -O0):
<display>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x2e91(%rip),%rax
mov    (%rax),%edi
call   1030 <glClear@plt>
xorps  %xmm2,%xmm2
movsd  0xe9f(%rip),%xmm1
movaps %xmm2,%xmm0
call   1050 <glColor3f@plt>
movl   $0x28,-0x8(%rbp)
movl   $0xc8,-0xc(%rbp)
movl   $0xc8,-0x10(%rbp)
movl   $0xa,-0x14(%rbp)
mov    -0x10(%rbp),%eax
sub    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%eax
sub    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x28(%rbp)
mov    -0x1c(%rbp),%eax
shl    $0x1,%eax
sub    -0x18(%rbp),%eax
mov    %eax,-0x20(%rbp)
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
cmp    -0x18(%rbp),%eax
jg     1218 <display+0xd8>
mov    -0x24(%rbp),%edi
mov    -0x28(%rbp),%esi
call   1040 <setPixel@plt>
cmpl   $0x0,-0x20(%rbp)
jg     11f3 <display+0xb3>
mov    -0x28(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x28(%rbp)
mov    -0x20(%rbp),%eax
mov    -0x18(%rbp),%ecx
shl    $0x1,%ecx
add    %ecx,%eax
mov    %eax,-0x20(%rbp)
jmp    11cd <display+0x8d>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%eax
mov    -0x1c(%rbp),%ecx
shl    $0x1,%ecx
add    %ecx,%eax
mov    %eax,-0x20(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    11b6 <display+0x76>
mov    $0x0,%al
call   1060 <glFlush@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<display>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    0x2e92(%rip),%rax
mov    (%rax),%edi
call   1030 <glClear@plt>
movsd  0xea3(%rip),%xmm1
xorps  %xmm0,%xmm0
xorps  %xmm2,%xmm2
call   1050 <glColor3f@plt>
mov    $0xfffffde4,%ebp
mov    $0x28,%ebx
mov    $0xc8,%r14d
mov    $0xcccccccd,%r15d
jmp    1191 <display+0x51>
add    $0x1,%ebx
add    $0xfffffe84,%ebp
cmp    $0xc8,%ebx
je     11d5 <display+0x95>
mov    %ebx,%edi
mov    %r14d,%esi
call   1040 <setPixel@plt>
test   %ebp,%ebp
jg     1180 <display+0x40>
cmp    $0xfffffec2,%ebp
mov    $0xfffffec1,%eax
cmovge %ebp,%eax
xor    %ecx,%ecx
sub    %ebp,%eax
setne  %cl
sub    %ecx,%eax
imul   %r15,%rax
shr    $0x28,%rax
add    %ecx,%eax
lea    (%rax,%rax,4),%ecx
not    %eax
add    %eax,%r14d
shl    $0x6,%ecx
add    %ecx,%ebp
add    $0x140,%ebp
jmp    1180 <display+0x40>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1060 <glFlush@plt>

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

LLVM IR (-O2):
@GL_COLOR_BUFFER_BIT = global i32 0
define void @display() {
%1 = load i32, i32* @GL_COLOR_BUFFER_BIT
%2 = tail call i32 @glClear(i32 %1)
%3 = tail call i32 @glColor3f(double 0.000000e+00, double 1.000000e+00, double 0.000000e+00)
br label %4
4: ; preds = %0, %23
%5 = phi i32 [ 200, %0 ], [ %25, %23 ]
%6 = phi i32 [ 40, %0 ], [ %26, %23 ]
%7 = phi i32 [ -540, %0 ], [ %27, %23 ]
%8 = tail call i32 @setPixel(i32 %6, i32 %5)
%9 = icmp slt i32 %7, 1
br i1 %9, label %10, label %23
10: ; preds = %4
%11 = call i32 @llvm.smax.i32(i32 %7, i32 -319)
%12 = sub i32 %11, %7
%13 = icmp ne i32 %12, 0
%14 = zext i1 %13 to i32
%15 = sub i32 %12, %14
%16 = udiv i32 %15, 320
%17 = add nuw nsw i32 %16, %14
%18 = xor i32 %17, -1
%19 = add i32 %5, %18
%20 = mul i32 %17, 320
%21 = add nsw i32 %7, 320
%22 = add i32 %21, %20
br label %23
23: ; preds = %10, %4
%24 = phi i32 [ %7, %4 ], [ %22, %10 ]
%25 = phi i32 [ %5, %4 ], [ %19, %10 ]
%26 = add nuw nsw i32 %6, 1
%27 = add nsw i32 %24, -380
%28 = icmp eq i32 %26, 200
br i1 %28, label %29, label %4
29: ; preds = %23
%30 = tail call i32 (...) @glFlush()
ret void
}