#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*/ write_record(int, float, float, int);
void do_dots(double *xarray, double *yarray, int num_verticies, int category) {
  int node;
  for (node = 0; node < num_verticies; node++) {
    write_record((int)(yarray[node] + .5), (float)xarray[node],
                 (float)xarray[node], category);
  }
}


x86 assembly (clang, -O0):
<do_dots>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    118a <do_dots+0x7a>
mov    -0x10(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  0xeb7(%rip),%xmm0
addsd  (%rax,%rcx,8),%xmm0
cvttsd2si %xmm0,%edi
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
cvtsd2ss %xmm0,%xmm0
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
cvtsd2ss %xmm1,%xmm1
mov    -0x18(%rbp),%esi
call   1030 <write_record@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112d <do_dots+0x1d>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<do_dots>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
test   %edx,%edx
jle    1160 <do_dots+0x50>
mov    %ecx,%r14d
mov    %rsi,%r15
mov    %rdi,%r12
mov    %edx,%ebx
xor    %ebp,%ebp
nopl   0x0(%rax)
movsd  (%r15,%rbp,8),%xmm0
addsd  0xec2(%rip),%xmm0
cvttsd2si %xmm0,%edi
movsd  (%r12,%rbp,8),%xmm0
cvtsd2ss %xmm0,%xmm0
movaps %xmm0,%xmm1
mov    %r14d,%esi
call   1030 <write_record@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1130 <do_dots+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @do_dots(double* %0, double* %1, i32 %2, i32 %3) {
%5 = alloca double*
%6 = alloca double*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store double* %0, double** %5
store double* %1, double** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
store i32 0, i32* %9
br label %10
10: ; preds = %36, %4
%11 = load i32, i32* %9
%12 = load i32, i32* %7
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %39
14: ; preds = %10
%15 = load double*, double** %6
%16 = load i32, i32* %9
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds double, double* %15, i64 %17
%19 = load double, double* %18
%20 = fadd double %19, 5.000000e-01
%21 = fptosi double %20 to i32
%22 = load double*, double** %5
%23 = load i32, i32* %9
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds double, double* %22, i64 %24
%26 = load double, double* %25
%27 = fptrunc double %26 to float
%28 = load double*, double** %5
%29 = load i32, i32* %9
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds double, double* %28, i64 %30
%32 = load double, double* %31
%33 = fptrunc double %32 to float
%34 = load i32, i32* %8
%35 = call i32 @write_record(i32 %21, float %27, float %33, i32 %34)
br label %36
36: ; preds = %14
%37 = load i32, i32* %9
%38 = add nsw i32 %37, 1
store i32 %38, i32* %9
br label %10
39: ; preds = %10
ret void
}

LLVM IR (-O2):
define void @do_dots(double* nocapture %0, double* nocapture %1, i32 %2, i32 %3) {
%5 = icmp sgt i32 %2, 0
br i1 %5, label %6, label %20
6: ; preds = %4
%7 = zext i32 %2 to i64
br label %8
8: ; preds = %6, %8
%9 = phi i64 [ 0, %6 ], [ %18, %8 ]
%10 = getelementptr inbounds double, double* %1, i64 %9
%11 = load double, double* %10
%12 = fadd double %11, 5.000000e-01
%13 = fptosi double %12 to i32
%14 = getelementptr inbounds double, double* %0, i64 %9
%15 = load double, double* %14
%16 = fptrunc double %15 to float
%17 = tail call i32 @write_record(i32 %13, float %16, float %16, i32 %3)
%18 = add nuw nsw i64 %9, 1
%19 = icmp eq i64 %18, %7
br i1 %19, label %20, label %8
20: ; preds = %8, %4
ret void
}