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


x86 assembly (clang, -O0):
<createLineMtr>:
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)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x18(%rbp)
xorps  %xmm0,%xmm0
movss  %xmm0,-0x1c(%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  -0x4(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
call   1060 <fmax@plt>
movss  %xmm0,-0x28(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
call   1060 <fmax@plt>
movss  %xmm0,-0x2c(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0xc(%rbp),%xmm1
call   1050 <fmin@plt>
movss  %xmm0,-0x30(%rbp)
movss  -0x8(%rbp),%xmm0
movss  -0x10(%rbp),%xmm1
call   1050 <fmin@plt>
movss  %xmm0,-0x34(%rbp)
movss  -0x20(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    1249 <createLineMtr+0x109>
jp     1249 <createLineMtr+0x109>
movss  -0x4(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x34(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm1
movss  -0x2c(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1244 <createLineMtr+0x104>
movss  -0x18(%rbp),%xmm0
movss  -0x1c(%rbp),%xmm1
mov    -0x14(%rbp),%edi
call   1040 <putPixelMtr@plt>
movss  0xdcb(%rip),%xmm0
addss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
jmp    1208 <createLineMtr+0xc8>
jmp    1408 <createLineMtr+0x2c8>
movss  -0x24(%rbp),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jne    12b5 <createLineMtr+0x175>
jp     12b5 <createLineMtr+0x175>
movss  -0x8(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x30(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm1
movss  -0x28(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    12b0 <createLineMtr+0x170>
movss  -0x18(%rbp),%xmm0
movss  -0x1c(%rbp),%xmm1
mov    -0x14(%rbp),%edi
call   1040 <putPixelMtr@plt>
movss  0xd5f(%rip),%xmm0
addss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
jmp    1274 <createLineMtr+0x134>
jmp    1408 <createLineMtr+0x2c8>
movss  -0x24(%rbp),%xmm0
divss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x38(%rbp)
movss  -0x8(%rbp),%xmm1
movss  -0x38(%rbp),%xmm0
movss  -0x4(%rbp),%xmm2
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x3c(%rbp)
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     137c <createLineMtr+0x23c>
movss  -0x30(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm1
movss  -0x28(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1377 <createLineMtr+0x237>
movss  -0x38(%rbp),%xmm0
movss  -0x18(%rbp),%xmm2
movss  -0x3c(%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   1040 <putPixelMtr@plt>
movss  0xc98(%rip),%xmm0
addss  -0x18(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
jmp    131f <createLineMtr+0x1df>
jmp    1408 <createLineMtr+0x2c8>
movss  -0x20(%rbp),%xmm0
call   1030 <abs@plt>
mov    %rax,-0x50(%rbp)
movss  -0x24(%rbp),%xmm0
call   1030 <abs@plt>
mov    %rax,%rcx
mov    -0x50(%rbp),%rax
cmp    %rcx,%rax
jge    1403 <createLineMtr+0x2c3>
movss  -0x34(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
movss  -0x1c(%rbp),%xmm1
movss  -0x2c(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    13fe <createLineMtr+0x2be>
movss  -0x1c(%rbp),%xmm0
subss  -0x3c(%rbp),%xmm0
divss  -0x38(%rbp),%xmm0
movss  %xmm0,-0x18(%rbp)
movss  -0x18(%rbp),%xmm0
movss  -0x1c(%rbp),%xmm1
mov    -0x14(%rbp),%edi
call   1040 <putPixelMtr@plt>
movss  0xc11(%rip),%xmm0
addss  -0x1c(%rbp),%xmm0
movss  %xmm0,-0x1c(%rbp)
jmp    13ae <createLineMtr+0x26e>
jmp    1408 <createLineMtr+0x2c8>
jmp    1408 <createLineMtr+0x2c8>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<createLineMtr>:
push   %r14
push   %rbx
sub    $0x88,%rsp
mov    %edi,%ebx
movaps %xmm0,%xmm7
movaps %xmm1,%xmm4
cmpunordss %xmm1,%xmm4
movaps %xmm4,%xmm5
andps  %xmm3,%xmm5
movaps %xmm3,%xmm0
maxss  %xmm1,%xmm0
andnps %xmm0,%xmm4
ucomiss %xmm7,%xmm7
movaps %xmm2,%xmm0
jp     1156 <createLineMtr+0x36>
movaps %xmm2,%xmm0
minss  %xmm7,%xmm0
orps   %xmm5,%xmm4
movaps %xmm2,%xmm6
subss  %xmm7,%xmm6
ucomiss %xmm1,%xmm1
movaps %xmm3,%xmm5
jp     116f <createLineMtr+0x4f>
movaps %xmm3,%xmm5
minss  %xmm1,%xmm5
xorps  %xmm8,%xmm8
ucomiss %xmm8,%xmm6
movaps %xmm4,0x60(%rsp)
jne    11c4 <createLineMtr+0xa4>
jp     11c4 <createLineMtr+0xa4>
ucomiss %xmm5,%xmm4
jbe    1346 <createLineMtr+0x226>
movss  %xmm7,0x30(%rsp)
nop
movaps %xmm5,0x20(%rsp)
movaps %xmm7,%xmm0
movaps %xmm5,%xmm1
mov    %ebx,%edi
call   1040 <putPixelMtr@plt>
movss  0x30(%rsp),%xmm7
movaps 0x20(%rsp),%xmm5
addss  0xe4b(%rip),%xmm5
movaps 0x60(%rsp),%xmm0
ucomiss %xmm5,%xmm0
ja     1190 <createLineMtr+0x70>
jmp    1346 <createLineMtr+0x226>
movaps %xmm7,%xmm4
cmpunordss %xmm7,%xmm4
movaps %xmm4,%xmm9
andps  %xmm2,%xmm9
maxss  %xmm7,%xmm2
andnps %xmm2,%xmm4
orps   %xmm9,%xmm4
subss  %xmm1,%xmm3
ucomiss %xmm8,%xmm3
movaps %xmm4,0x50(%rsp)
jne    122e <createLineMtr+0x10e>
jp     122e <createLineMtr+0x10e>
ucomiss %xmm0,%xmm4
jbe    1346 <createLineMtr+0x226>
movss  %xmm1,0xc(%rsp)
nop
movaps %xmm0,0x10(%rsp)
mov    %ebx,%edi
call   1040 <putPixelMtr@plt>
movaps 0x10(%rsp),%xmm0
movss  0xc(%rsp),%xmm1
addss  0xde1(%rip),%xmm0
movaps 0x50(%rsp),%xmm2
ucomiss %xmm0,%xmm2
ja     1200 <createLineMtr+0xe0>
jmp    1346 <createLineMtr+0x226>
movaps %xmm0,0x10(%rsp)
movaps %xmm5,0x20(%rsp)
movaps %xmm3,%xmm0
divss  %xmm6,%xmm0
movaps %xmm0,0x40(%rsp)
mulss  %xmm0,%xmm7
subss  %xmm7,%xmm1
movss  %xmm1,0xc(%rsp)
movaps %xmm6,%xmm0
movaps %xmm3,0x30(%rsp)
movaps %xmm6,0x70(%rsp)
call   1030 <abs@plt>
mov    %rax,%r14
movaps 0x30(%rsp),%xmm0
call   1030 <abs@plt>
cmp    %rax,%r14
jge    12f4 <createLineMtr+0x1d4>
movaps 0x70(%rsp),%xmm0
call   1030 <abs@plt>
mov    %rax,%r14
movaps 0x30(%rsp),%xmm0
call   1030 <abs@plt>
cmp    %rax,%r14
movss  0xc(%rsp),%xmm2
movaps 0x60(%rsp),%xmm0
movaps 0x20(%rsp),%xmm1
movaps 0x40(%rsp),%xmm3
jge    1346 <createLineMtr+0x226>
nopl   0x0(%rax,%rax,1)
ucomiss %xmm1,%xmm0
jbe    1346 <createLineMtr+0x226>
movaps %xmm1,0x20(%rsp)
movaps %xmm1,%xmm0
subss  %xmm2,%xmm0
divss  %xmm3,%xmm0
mov    %ebx,%edi
call   1040 <putPixelMtr@plt>
movaps 0x40(%rsp),%xmm3
movaps 0x20(%rsp),%xmm1
movss  0xc(%rsp),%xmm2
addss  0xd18(%rip),%xmm1
movaps 0x60(%rsp),%xmm0
ucomiss %xmm1,%xmm0
ja     12b9 <createLineMtr+0x199>
jmp    1346 <createLineMtr+0x226>
movaps 0x10(%rsp),%xmm0
movaps 0x50(%rsp),%xmm1
ucomiss %xmm0,%xmm1
movss  0xc(%rsp),%xmm2
jbe    1346 <createLineMtr+0x226>
nopl   0x0(%rax)
movaps %xmm0,0x10(%rsp)
movaps 0x40(%rsp),%xmm1
mulss  %xmm0,%xmm1
addss  %xmm2,%xmm1
mov    %ebx,%edi
call   1040 <putPixelMtr@plt>
movaps 0x10(%rsp),%xmm0
movss  0xc(%rsp),%xmm2
addss  0xcc4(%rip),%xmm0
movaps 0x50(%rsp),%xmm1
ucomiss %xmm0,%xmm1
ja     1310 <createLineMtr+0x1f0>
add    $0x88,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @createLineMtr(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
store float 0.000000e+00, float* %11
store float 0.000000e+00, float* %12
%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* %6
%28 = load float, float* %8
%29 = call float @fmax(float %27, float %28)
store float %29, float* %15
%30 = load float, float* %7
%31 = load float, float* %9
%32 = call float @fmax(float %30, float %31)
store float %32, float* %16
%33 = load float, float* %6
%34 = load float, float* %8
%35 = call float @fmin(float %33, float %34)
store float %35, float* %17
%36 = load float, float* %7
%37 = load float, float* %9
%38 = call float @fmin(float %36, float %37)
store float %38, float* %18
%39 = load float, float* %13
%40 = fcmp oeq float %39, 0.000000e+00
br i1 %40, label %41, label %57
41: ; preds = %5
%42 = load float, float* %6
store float %42, float* %11
%43 = load float, float* %18
store float %43, float* %12
br label %44
44: ; preds = %53, %41
%45 = load float, float* %12
%46 = load float, float* %16
%47 = fcmp olt float %45, %46
br i1 %47, label %48, label %56
48: ; preds = %44
%49 = load float, float* %11
%50 = load float, float* %12
%51 = load i32, i32* %10
%52 = call i32 @putPixelMtr(float %49, float %50, i32 %51)
br label %53
53: ; preds = %48
%54 = load float, float* %12
%55 = fadd float %54, 1.000000e+00
store float %55, float* %12
br label %44
56: ; preds = %44
br label %136
57: ; preds = %5
%58 = load float, float* %14
%59 = fcmp oeq float %58, 0.000000e+00
br i1 %59, label %60, label %76
60: ; preds = %57
%61 = load float, float* %7
store float %61, float* %12
%62 = load float, float* %17
store float %62, float* %11
br label %63
63: ; preds = %72, %60
%64 = load float, float* %11
%65 = load float, float* %15
%66 = fcmp olt float %64, %65
br i1 %66, label %67, label %75
67: ; preds = %63
%68 = load float, float* %11
%69 = load float, float* %12
%70 = load i32, i32* %10
%71 = call i32 @putPixelMtr(float %68, float %69, i32 %70)
br label %72
72: ; preds = %67
%73 = load float, float* %11
%74 = fadd float %73, 1.000000e+00
store float %74, float* %11
br label %63
75: ; preds = %63
br label %136
76: ; preds = %57
%77 = load float, float* %14
%78 = load float, float* %13
%79 = fdiv float %77, %78
store float %79, float* %19
%80 = load float, float* %7
%81 = load float, float* %19
%82 = load float, float* %6
%83 = fneg float %81
%84 = call float @llvm.fmuladd.f32(float %83, float %82, float %80)
store float %84, float* %20
%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 = %76
%91 = load float, float* %17
store float %91, float* %11
br label %92
92: ; preds = %105, %90
%93 = load float, float* %11
%94 = load float, float* %15
%95 = fcmp olt float %93, %94
br i1 %95, label %96, label %108
96: ; preds = %92
%97 = load float, float* %19
%98 = load float, float* %11
%99 = load float, float* %20
%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 @putPixelMtr(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 %136
109: ; preds = %76
%110 = load float, float* %13
%111 = call i64 @abs(float %110)
%112 = load float, float* %14
%113 = call i64 @abs(float %112)
%114 = icmp slt i64 %111, %113
br i1 %114, label %115, label %135
115: ; preds = %109
%116 = load float, float* %18
store float %116, float* %12
br label %117
117: ; preds = %131, %115
%118 = load float, float* %12
%119 = load float, float* %16
%120 = fcmp olt float %118, %119
br i1 %120, label %121, label %134
121: ; preds = %117
%122 = load float, float* %12
%123 = load float, float* %20
%124 = fsub float %122, %123
%125 = load float, float* %19
%126 = fdiv float %124, %125
store float %126, float* %11
%127 = load float, float* %11
%128 = load float, float* %12
%129 = load i32, i32* %10
%130 = call i32 @putPixelMtr(float %127, float %128, i32 %129)
br label %131
131: ; preds = %121
%132 = load float, float* %12
%133 = fadd float %132, 1.000000e+00
store float %133, float* %12
br label %117
134: ; preds = %117
br label %136
135: ; preds = %109
br label %136
136: ; preds = %135, %134, %108, %75, %56
ret void
}

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