#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*/ printf(char *);
int /*<<< orphan*/ put_pixel(int, int);
void simple_plot(int x, int y, float slope) {
  printf("Simple Line plot (y=mx+c))");
  put_pixel(x, y);
  int i;
  int src_x = x;
  int src_y = y;
  for (i = 0; i < 100; i++) {
    ++src_x;
    src_y = slope * src_x + 0;
    put_pixel(src_x, src_y);
  }
}


x86 assembly (clang, -O0):
<simple_plot>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movss  %xmm0,-0xc(%rbp)
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1040 <put_pixel@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%eax
mov    %eax,-0x18(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x64,-0x10(%rbp)
jge    11a5 <simple_plot+0x85>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
movss  -0xc(%rbp),%xmm0
cvtsi2ssl -0x14(%rbp),%xmm1
mulss  %xmm1,%xmm0
xorps  %xmm1,%xmm1
addss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1040 <put_pixel@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    115d <simple_plot+0x3d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<simple_plot>:
push   %rbp
push   %rbx
push   %rax
movss  %xmm0,0x4(%rsp)
mov    %esi,%ebp
mov    %edi,%ebx
lea    0xed0(%rip),%rdi
call   1030 <printf@plt>
mov    %ebx,%edi
mov    %ebp,%esi
call   1040 <put_pixel@plt>
mov    $0x1,%ebp
nopw   0x0(%rax,%rax,1)
lea    (%rbx,%rbp,1),%edi
xorps  %xmm0,%xmm0
cvtsi2ss %edi,%xmm0
mulss  0x4(%rsp),%xmm0
addss  0xe98(%rip),%xmm0
cvttss2si %xmm0,%esi
call   1040 <put_pixel@plt>
add    $0x1,%ebp
cmp    $0x65,%ebp
jne    1150 <simple_plot+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [27 x i8] c"Simple Line plot (y=mx+c))\00"
define void @simple_plot(i32 %0, i32 %1, float %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca float
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store float %2, float* %6
%10 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%11 = load i32, i32* %4
%12 = load i32, i32* %5
%13 = call i32 @put_pixel(i32 %11, i32 %12)
%14 = load i32, i32* %4
store i32 %14, i32* %8
%15 = load i32, i32* %5
store i32 %15, i32* %9
store i32 0, i32* %7
br label %16
16: ; preds = %30, %3
%17 = load i32, i32* %7
%18 = icmp slt i32 %17, 100
br i1 %18, label %19, label %33
19: ; preds = %16
%20 = load i32, i32* %8
%21 = add nsw i32 %20, 1
store i32 %21, i32* %8
%22 = load float, float* %6
%23 = load i32, i32* %8
%24 = sitofp i32 %23 to float
%25 = call float @llvm.fmuladd.f32(float %22, float %24, float 0.000000e+00)
%26 = fptosi float %25 to i32
store i32 %26, i32* %9
%27 = load i32, i32* %8
%28 = load i32, i32* %9
%29 = call i32 @put_pixel(i32 %27, i32 %28)
br label %30
30: ; preds = %19
%31 = load i32, i32* %7
%32 = add nsw i32 %31, 1
store i32 %32, i32* %7
br label %16
33: ; preds = %16
ret void
}

LLVM IR (-O2):
@.str = [27 x i8] c"Simple Line plot (y=mx+c))\00"
define void @simple_plot(i32 %0, i32 %1, float %2) {
%4 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%5 = tail call i32 @put_pixel(i32 %0, i32 %1)
br label %6
6: ; preds = %3, %6
%7 = phi i32 [ %0, %3 ], [ %9, %6 ]
%8 = phi i32 [ 0, %3 ], [ %14, %6 ]
%9 = add nsw i32 %7, 1
%10 = sitofp i32 %9 to float
%11 = tail call float @llvm.fmuladd.f32(float %2, float %10, float 0.000000e+00)
%12 = fptosi float %11 to i32
%13 = tail call i32 @put_pixel(i32 %9, i32 %12)
%14 = add nuw nsw i32 %8, 1
%15 = icmp eq i32 %14, 100
br i1 %15, label %16, label %6
16: ; preds = %6
ret void
}