#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 */
scalar_t__ abs(float);
float fmax(float, float);
float fmin(float, float);
int /*<<< orphan*/ putPixel(float, float, int);
void createLine(float x1, float y1, float x2, float y2, int idColor) {
  float x, y;
  float dx = x2 - x1, dy = y2 - y1;
  float m = (float)dy / dx;
  float b = y1 - (m * x1);
  float xmax = fmax(x1, x2), ymax = fmax(y1, y2);
  float xmin = fmin(x1, x2), ymin = fmin(y1, y2);
  if (dx == 0) {
    x = x1;
    for (y = ymin; y < ymax; y++) {
      putPixel(x, y, idColor);
    }
  }
  if (dy == 0) {
    y = y1;
    for (x = xmin; x < xmax; x++) {
      putPixel(x, y, idColor);
    }
  }
  if (abs(dx) >= abs(dy)) {
    for (x = xmin; x < xmax; x++) {
      y = m * x + b;
      putPixel(x, y, idColor);
    }
  } else {
    for (y = ymin; y < ymax; y++) {
      x = (y - b) / m;
      putPixel(x, y, idColor);
    }
  }
}


x86 assembly (clang, -O0):
<createLine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
mov    %edi,-0x14(%rbp)
movss  -0xc(%rbp),%xmm0
subss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x20(%rbp)
movss  -0x10(%rbp),%xmm0
subss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movss  -0x24(%rbp),%xmm0
divss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x28(%rbp)
movss  -0x8(%rbp),%xmm1
movss  -0x28(%rbp),%xmm0
movss  -0x4(%rbp),%xmm2
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x2c(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
call   1050 <fmax@plt>
movss  %xmm0,-0x30(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
call   1050 <fmax@plt>
movss  %xmm0,-0x34(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
call   1040 <fmin@plt>
movss  %xmm0,-0x38(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
call   1040 <fmin@plt>
movss  %xmm0,-0x3c(%rbp)
movss  -0x20(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1271 <createLine+0x131>
jp     1271 <createLine+0x131>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x3c(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm1
movss  -0x34(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    126c <createLine+0x12c>
movss  -0x18(%rbp),%xmm0
movss  -0x1c(%rbp),%xmm1
mov    -0x14(%rbp),%edi
call   1060 <putPixel@plt>
movss  0xda3(%rip),%xmm0
addss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
jmp    1230 <createLine+0xf0>
jmp    1271 <createLine+0x131>
movss  -0x24(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    12dd <createLine+0x19d>
jp     12dd <createLine+0x19d>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x38(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm1
movss  -0x30(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    12d8 <createLine+0x198>
movss  -0x18(%rbp),%xmm0
movss  -0x1c(%rbp),%xmm1
mov    -0x14(%rbp),%edi
call   1060 <putPixel@plt>
movss  0xd37(%rip),%xmm0
addss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
jmp    129c <createLine+0x15c>
jmp    12dd <createLine+0x19d>
movss  -0x20(%rbp),%xmm0
call   1030 <abs@plt>
mov    %rax,-0x48(%rbp)
movss  -0x24(%rbp),%xmm0
call   1030 <abs@plt>
mov    %rax,%rcx
mov    -0x48(%rbp),%rax
cmp    %rcx,%rax
jl     136c <createLine+0x22c>
movss  -0x38(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm1
movss  -0x30(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1367 <createLine+0x227>
movss  -0x28(%rbp),%xmm0
movss  -0x18(%rbp),%xmm2
movss  -0x2c(%rbp),%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x18(%rbp),%xmm0
movss  -0x1c(%rbp),%xmm1
mov    -0x14(%rbp),%edi
call   1060 <putPixel@plt>
movss  0xca8(%rip),%xmm0
addss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
jmp    130f <createLine+0x1cf>
jmp    13cb <createLine+0x28b>
movss  -0x3c(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm1
movss  -0x34(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    13c6 <createLine+0x286>
movss  -0x1c(%rbp),%xmm0
subss  -0x2c(%rbp),%xmm0
divss  -0x28(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
movss  -0x1c(%rbp),%xmm1
mov    -0x14(%rbp),%edi
call   1060 <putPixel@plt>
movss  0xc49(%rip),%xmm0
addss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
jmp    1376 <createLine+0x236>
jmp    13cb <createLine+0x28b>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<createLine>:
push   %r14
push   %rbx
sub    $0x88,%rsp
mov    %edi,%ebx
movaps %xmm0,%xmm5
movaps %xmm0,%xmm4
cmpunordss %xmm0,%xmm4
movaps %xmm2,%xmm8
maxss  %xmm0,%xmm8
movaps %xmm1,%xmm6
cmpunordss %xmm1,%xmm6
movaps %xmm6,%xmm0
andps  %xmm3,%xmm0
movaps %xmm3,%xmm7
maxss  %xmm1,%xmm7
andnps %xmm7,%xmm6
ucomiss %xmm5,%xmm5
movaps %xmm2,%xmm7
jp     1167 <createLine+0x47>
movaps %xmm2,%xmm7
minss  %xmm5,%xmm7
movaps %xmm7,0x20(%rsp)
movaps %xmm3,%xmm7
subss  %xmm1,%xmm7
movaps %xmm7,0x50(%rsp)
movaps %xmm4,%xmm7
andps  %xmm2,%xmm7
subss  %xmm5,%xmm2
andnps %xmm8,%xmm4
orps   %xmm0,%xmm6
ucomiss %xmm1,%xmm1
movss  %xmm1,0x4(%rsp)
jp     1198 <createLine+0x78>
minss  %xmm1,%xmm3
movaps %xmm3,0x10(%rsp)
movaps 0x50(%rsp),%xmm0
divss  %xmm2,%xmm0
movaps %xmm0,0x30(%rsp)
orps   %xmm7,%xmm4
movaps %xmm4,0x40(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm2,0x70(%rsp)
ucomiss %xmm0,%xmm2
movaps %xmm6,0x60(%rsp)
jne    1214 <createLine+0xf4>
jp     1214 <createLine+0xf4>
ucomiss 0x10(%rsp),%xmm6
jbe    1214 <createLine+0xf4>
movaps 0x10(%rsp),%xmm1
movss  %xmm5,0xc(%rsp)
nopl   0x0(%rax)
movss  %xmm1,0x8(%rsp)
movaps %xmm5,%xmm0
movss  0x8(%rsp),%xmm1
mov    %ebx,%edi
call   1040 <putPixel@plt>
movss  0x8(%rsp),%xmm1
movss  0xc(%rsp),%xmm5
addss  0xdf6(%rip),%xmm1
movaps 0x60(%rsp),%xmm0
ucomiss %xmm1,%xmm0
ja     11e0 <createLine+0xc0>
mulss  0x30(%rsp),%xmm5
movss  %xmm5,0xc(%rsp)
movaps 0x50(%rsp),%xmm0
ucomiss 0xdd8(%rip),%xmm0
movss  0x4(%rsp),%xmm1
movaps 0x40(%rsp),%xmm2
jne    1287 <createLine+0x167>
jp     1287 <createLine+0x167>
ucomiss 0x20(%rsp),%xmm2
jbe    1287 <createLine+0x167>
movaps 0x20(%rsp),%xmm0
nopw   0x0(%rax,%rax,1)
movss  %xmm0,0x8(%rsp)
movss  0x8(%rsp),%xmm0
movss  0x4(%rsp),%xmm1
mov    %ebx,%edi
call   1040 <putPixel@plt>
movss  0x8(%rsp),%xmm0
movaps 0x40(%rsp),%xmm2
movss  0x4(%rsp),%xmm1
addss  0xd7e(%rip),%xmm0
ucomiss %xmm0,%xmm2
ja     1250 <createLine+0x130>
subss  0xc(%rsp),%xmm1
movss  %xmm1,0x4(%rsp)
movaps 0x70(%rsp),%xmm0
call   1030 <abs@plt>
mov    %rax,%r14
movaps 0x50(%rsp),%xmm0
call   1030 <abs@plt>
cmp    %rax,%r14
jge    1314 <createLine+0x1f4>
movaps 0x10(%rsp),%xmm1
movaps 0x60(%rsp),%xmm0
ucomiss %xmm1,%xmm0
movss  0x4(%rsp),%xmm2
movaps 0x30(%rsp),%xmm3
jbe    1309 <createLine+0x1e9>
nopl   0x0(%rax)
movaps %xmm1,0x10(%rsp)
movaps %xmm1,%xmm0
subss  %xmm2,%xmm0
divss  %xmm3,%xmm0
mov    %ebx,%edi
call   1040 <putPixel@plt>
movaps 0x30(%rsp),%xmm3
movss  0x4(%rsp),%xmm2
movaps 0x10(%rsp),%xmm1
addss  0xd01(%rip),%xmm1
movaps 0x60(%rsp),%xmm0
ucomiss %xmm1,%xmm0
ja     12d0 <createLine+0x1b0>
add    $0x88,%rsp
pop    %rbx
pop    %r14
ret
movaps 0x40(%rsp),%xmm0
movaps 0x20(%rsp),%xmm2
xchg   %ax,%ax
ucomiss %xmm2,%xmm0
movss  0x4(%rsp),%xmm0
jbe    1309 <createLine+0x1e9>
movaps %xmm2,0x20(%rsp)
movaps 0x30(%rsp),%xmm1
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
movaps %xmm2,%xmm0
mov    %ebx,%edi
call   1040 <putPixel@plt>
movaps 0x20(%rsp),%xmm2
addss  0xcac(%rip),%xmm2
movaps 0x40(%rsp),%xmm0
jmp    1320 <createLine+0x200>

LLVM IR (-O0):
define void @createLine(float %0, float %1, float %2, float %3, i32 %4) {
%6 = alloca float
%7 = alloca float
%8 = alloca float
%9 = alloca float
%10 = alloca i32
%11 = alloca float
%12 = alloca float
%13 = alloca float
%14 = alloca float
%15 = alloca float
%16 = alloca float
%17 = alloca float
%18 = alloca float
%19 = alloca float
%20 = alloca float
store float %0, float* %6
store float %1, float* %7
store float %2, float* %8
store float %3, float* %9
store i32 %4, i32* %10
%21 = load float, float* %8
%22 = load float, float* %6
%23 = fsub float %21, %22
store float %23, float* %13
%24 = load float, float* %9
%25 = load float, float* %7
%26 = fsub float %24, %25
store float %26, float* %14
%27 = load float, float* %14
%28 = load float, float* %13
%29 = fdiv float %27, %28
store float %29, float* %15
%30 = load float, float* %7
%31 = load float, float* %15
%32 = load float, float* %6
%33 = fneg float %31
%34 = call float @llvm.fmuladd.f32(float %33, float %32, float %30)
store float %34, float* %16
%35 = load float, float* %6
%36 = load float, float* %8
%37 = call float @fmax(float %35, float %36)
store float %37, float* %17
%38 = load float, float* %7
%39 = load float, float* %9
%40 = call float @fmax(float %38, float %39)
store float %40, float* %18
%41 = load float, float* %6
%42 = load float, float* %8
%43 = call float @fmin(float %41, float %42)
store float %43, float* %19
%44 = load float, float* %7
%45 = load float, float* %9
%46 = call float @fmin(float %44, float %45)
store float %46, float* %20
%47 = load float, float* %13
%48 = fcmp oeq float %47, 0.000000e+00
br i1 %48, label %49, label %65
49: ; preds = %5
%50 = load float, float* %6
store float %50, float* %11
%51 = load float, float* %20
store float %51, float* %12
br label %52
52: ; preds = %61, %49
%53 = load float, float* %12
%54 = load float, float* %18
%55 = fcmp olt float %53, %54
br i1 %55, label %56, label %64
56: ; preds = %52
%57 = load float, float* %11
%58 = load float, float* %12
%59 = load i32, i32* %10
%60 = call i32 @putPixel(float %57, float %58, i32 %59)
br label %61
61: ; preds = %56
%62 = load float, float* %12
%63 = fadd float %62, 1.000000e+00
store float %63, float* %12
br label %52
64: ; preds = %52
br label %65
65: ; preds = %64, %5
%66 = load float, float* %14
%67 = fcmp oeq float %66, 0.000000e+00
br i1 %67, label %68, label %84
68: ; preds = %65
%69 = load float, float* %7
store float %69, float* %12
%70 = load float, float* %19
store float %70, float* %11
br label %71
71: ; preds = %80, %68
%72 = load float, float* %11
%73 = load float, float* %17
%74 = fcmp olt float %72, %73
br i1 %74, label %75, label %83
75: ; preds = %71
%76 = load float, float* %11
%77 = load float, float* %12
%78 = load i32, i32* %10
%79 = call i32 @putPixel(float %76, float %77, i32 %78)
br label %80
80: ; preds = %75
%81 = load float, float* %11
%82 = fadd float %81, 1.000000e+00
store float %82, float* %11
br label %71
83: ; preds = %71
br label %84
84: ; preds = %83, %65
%85 = load float, float* %13
%86 = call i64 @abs(float %85)
%87 = load float, float* %14
%88 = call i64 @abs(float %87)
%89 = icmp sge i64 %86, %88
br i1 %89, label %90, label %109
90: ; preds = %84
%91 = load float, float* %19
store float %91, float* %11
br label %92
92: ; preds = %105, %90
%93 = load float, float* %11
%94 = load float, float* %17
%95 = fcmp olt float %93, %94
br i1 %95, label %96, label %108
96: ; preds = %92
%97 = load float, float* %15
%98 = load float, float* %11
%99 = load float, float* %16
%100 = call float @llvm.fmuladd.f32(float %97, float %98, float %99)
store float %100, float* %12
%101 = load float, float* %11
%102 = load float, float* %12
%103 = load i32, i32* %10
%104 = call i32 @putPixel(float %101, float %102, i32 %103)
br label %105
105: ; preds = %96
%106 = load float, float* %11
%107 = fadd float %106, 1.000000e+00
store float %107, float* %11
br label %92
108: ; preds = %92
br label %129
109: ; preds = %84
%110 = load float, float* %20
store float %110, float* %12
br label %111
111: ; preds = %125, %109
%112 = load float, float* %12
%113 = load float, float* %18
%114 = fcmp olt float %112, %113
br i1 %114, label %115, label %128
115: ; preds = %111
%116 = load float, float* %12
%117 = load float, float* %16
%118 = fsub float %116, %117
%119 = load float, float* %15
%120 = fdiv float %118, %119
store float %120, float* %11
%121 = load float, float* %11
%122 = load float, float* %12
%123 = load i32, i32* %10
%124 = call i32 @putPixel(float %121, float %122, i32 %123)
br label %125
125: ; preds = %115
%126 = load float, float* %12
%127 = fadd float %126, 1.000000e+00
store float %127, float* %12
br label %111
128: ; preds = %111
br label %129
129: ; preds = %128, %108
ret void
}

LLVM IR (-O2):
define void @createLine(float %0, float %1, float %2, float %3, i32 %4) {
%6 = fsub float %2, %0
%7 = fsub float %3, %1
%8 = fdiv float %7, %6
%9 = fneg float %8
%10 = tail call float @llvm.fmuladd.f32(float %9, float %0, float %1)
%11 = tail call nsz float @llvm.maxnum.f32(float %0, float %2)
%12 = tail call nsz float @llvm.maxnum.f32(float %1, float %3)
%13 = tail call nsz float @llvm.minnum.f32(float %0, float %2)
%14 = tail call nsz float @llvm.minnum.f32(float %1, float %3)
%15 = fcmp oeq float %6, 0.000000e+00
%16 = fcmp olt float %14, %12
%17 = select i1 %15, i1 %16, i1 false
br i1 %17, label %18, label %23
18: ; preds = %5, %18
%19 = phi float [ %21, %18 ], [ %14, %5 ]
%20 = tail call i32 @putPixel(float %0, float %19, i32 %4)
%21 = fadd float %19, 1.000000e+00
%22 = fcmp olt float %21, %12
br i1 %22, label %18, label %23
23: ; preds = %18, %5
%24 = fcmp oeq float %7, 0.000000e+00
%25 = fcmp olt float %13, %11
%26 = select i1 %24, i1 %25, i1 false
br i1 %26, label %27, label %32
27: ; preds = %23, %27
%28 = phi float [ %30, %27 ], [ %13, %23 ]
%29 = tail call i32 @putPixel(float %28, float %1, i32 %4)
%30 = fadd float %28, 1.000000e+00
%31 = fcmp olt float %30, %11
br i1 %31, label %27, label %32
32: ; preds = %27, %23
%33 = tail call i64 @abs(float %6)
%34 = tail call i64 @abs(float %7)
%35 = icmp slt i64 %33, %34
br i1 %35, label %37, label %36
36: ; preds = %32
br i1 %25, label %38, label %51
37: ; preds = %32
br i1 %16, label %44, label %51
38: ; preds = %36, %38
%39 = phi float [ %42, %38 ], [ %13, %36 ]
%40 = tail call float @llvm.fmuladd.f32(float %8, float %39, float %10)
%41 = tail call i32 @putPixel(float %39, float %40, i32 %4)
%42 = fadd float %39, 1.000000e+00
%43 = fcmp olt float %42, %11
br i1 %43, label %38, label %51
44: ; preds = %37, %44
%45 = phi float [ %49, %44 ], [ %14, %37 ]
%46 = fsub float %45, %10
%47 = fdiv float %46, %8
%48 = tail call i32 @putPixel(float %47, float %45, i32 %4)
%49 = fadd float %45, 1.000000e+00
%50 = fcmp olt float %49, %12
br i1 %50, label %44, label %51
51: ; preds = %38, %44, %36, %37
ret void
}