#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 */
float abs(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, float);
int /*<<< orphan*/ stderr;
int *xmalloc(int);
int *build_vrec(float radius) {
  if (!(radius > 1))
    return NULL;
  fprintf(stderr, "building a vrec of radius %g\n", radius);
  int side = 2 * radius + 4;
  int *e = xmalloc((2 * side + 4) * sizeof *e), cx = 0;
  for (int i = -radius - 1; i <= radius + 1; i++)
    if (abs(i) < radius) {
      e[2 * cx + 4] = 0;
      e[2 * cx + 5] = i;
      cx += 1;
    }
  e[0] = cx;
  e[1] = e[2] = e[3] = 0;
  return e;
}


x86 assembly (clang, -O0):
<build_vrec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movss  %xmm0,-0xc(%rbp)
movss  -0xc(%rbp),%xmm0
movss  0xeb6(%rip),%xmm1
ucomiss %xmm1,%xmm0
ja     1160 <build_vrec+0x30>
movq   $0x0,-0x8(%rbp)
jmp    128b <build_vrec+0x15b>
mov    0x2e79(%rip),%rax
mov    (%rax),%edi
movss  -0xc(%rbp),%xmm0
lea    0xe93(%rip),%rsi
call   1050 <fprintf@plt>
movss  -0xc(%rbp),%xmm0
addss  %xmm0,%xmm0
movss  0xe79(%rip),%xmm1
addss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
shl    $0x1,%eax
add    $0x4,%eax
cltq
shl    $0x2,%rax
mov    %eax,%edi
call   1040 <xmalloc@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movss  -0xc(%rbp),%xmm0
movd   %xmm0,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm0
movss  0xe2f(%rip),%xmm1
subss  %xmm1,%xmm0
cvttss2si %xmm0,%eax
mov    %eax,-0x20(%rbp)
cvtsi2ssl -0x20(%rbp),%xmm1
movss  0xe17(%rip),%xmm0
addss  -0xc(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jb     1259 <build_vrec+0x129>
mov    -0x20(%rbp),%edi
call   1030 <abs@plt>
movaps %xmm0,%xmm1
movss  -0xc(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1246 <build_vrec+0x116>
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
shl    $0x1,%ecx
add    $0x4,%ecx
movslq %ecx,%rcx
movl   $0x0,(%rax,%rcx,4)
mov    -0x20(%rbp),%edx
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
shl    $0x1,%ecx
add    $0x5,%ecx
movslq %ecx,%rcx
mov    %edx,(%rax,%rcx,4)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    124b <build_vrec+0x11b>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11dc <build_vrec+0xac>
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
movl   $0x0,0xc(%rax)
mov    -0x18(%rbp),%rax
movl   $0x0,0x8(%rax)
mov    -0x18(%rbp),%rax
movl   $0x0,0x4(%rax)
mov    -0x18(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<build_vrec>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
xor    %ebx,%ebx
ucomiss 0xebf(%rip),%xmm0
jbe    11cc <build_vrec+0x9c>
mov    0x2e92(%rip),%rax
mov    (%rax),%edi
lea    0xeb5(%rip),%rsi
movss  %xmm0,0x8(%rsp)
call   1050 <fprintf@plt>
movss  0x8(%rsp),%xmm0
addss  %xmm0,%xmm0
addss  0xe90(%rip),%xmm0
cvttss2si %xmm0,%eax
lea    0x10(,%rax,8),%edi
call   1040 <xmalloc@plt>
mov    %rax,%r14
movss  0xe79(%rip),%xmm0
movss  0x8(%rsp),%xmm1
subss  %xmm1,%xmm0
movss  0xe5f(%rip),%xmm2
addss  %xmm1,%xmm2
cvttps2dq %xmm0,%xmm1
cvtdq2ps %xmm1,%xmm1
movss  %xmm2,0xc(%rsp)
ucomiss %xmm1,%xmm2
jae    11db <build_vrec+0xab>
mov    %ebx,(%r14)
movl   $0x0,0xc(%r14)
movq   $0x0,0x4(%r14)
jmp    11cf <build_vrec+0x9f>
xor    %r14d,%r14d
mov    %r14,%rax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret
cvttss2si %xmm0,%ebp
xor    %ebx,%ebx
jmp    1205 <build_vrec+0xd5>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x1,%ebp
xorps  %xmm0,%xmm0
cvtsi2ss %ebp,%xmm0
movss  0xc(%rsp),%xmm1
ucomiss %xmm0,%xmm1
jb     11b7 <build_vrec+0x87>
mov    %ebp,%edi
call   1030 <abs@plt>
movss  0x8(%rsp),%xmm1
ucomiss %xmm0,%xmm1
jbe    11f0 <build_vrec+0xc0>
lea    (%rbx,%rbx,1),%eax
cltq
movl   $0x0,0x10(%r14,%rax,4)
mov    %ebp,0x14(%r14,%rax,4)
add    $0x1,%ebx
jmp    11f0 <build_vrec+0xc0>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [30 x i8] c"building a vrec of radius %g\0A\00"
define i32* @build_vrec(float %0) {
%2 = alloca i32*
%3 = alloca float
%4 = alloca i32
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
store float %0, float* %3
%8 = load float, float* %3
%9 = fcmp ogt float %8, 1.000000e+00
br i1 %9, label %11, label %10
10: ; preds = %1
store i32* null, i32** %2
br label %71
11: ; preds = %1
%12 = load i32, i32* @stderr
%13 = load float, float* %3
%14 = call i32 @fprintf(i32 %12, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), float %13)
%15 = load float, float* %3
%16 = call float @llvm.fmuladd.f32(float 2.000000e+00, float %15, float 4.000000e+00)
%17 = fptosi float %16 to i32
store i32 %17, i32* %4
%18 = load i32, i32* %4
%19 = mul nsw i32 2, %18
%20 = add nsw i32 %19, 4
%21 = sext i32 %20 to i64
%22 = mul i64 %21, 4
%23 = trunc i64 %22 to i32
%24 = call i32* @xmalloc(i32 %23)
store i32* %24, i32** %5
store i32 0, i32* %6
%25 = load float, float* %3
%26 = fneg float %25
%27 = fsub float %26, 1.000000e+00
%28 = fptosi float %27 to i32
store i32 %28, i32* %7
br label %29
29: ; preds = %57, %11
%30 = load i32, i32* %7
%31 = sitofp i32 %30 to float
%32 = load float, float* %3
%33 = fadd float %32, 1.000000e+00
%34 = fcmp ole float %31, %33
br i1 %34, label %35, label %60
35: ; preds = %29
%36 = load i32, i32* %7
%37 = call float @abs(i32 %36)
%38 = load float, float* %3
%39 = fcmp olt float %37, %38
br i1 %39, label %40, label %56
40: ; preds = %35
%41 = load i32*, i32** %5
%42 = load i32, i32* %6
%43 = mul nsw i32 2, %42
%44 = add nsw i32 %43, 4
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds i32, i32* %41, i64 %45
store i32 0, i32* %46
%47 = load i32, i32* %7
%48 = load i32*, i32** %5
%49 = load i32, i32* %6
%50 = mul nsw i32 2, %49
%51 = add nsw i32 %50, 5
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds i32, i32* %48, i64 %52
store i32 %47, i32* %53
%54 = load i32, i32* %6
%55 = add nsw i32 %54, 1
store i32 %55, i32* %6
br label %56
56: ; preds = %40, %35
br label %57
57: ; preds = %56
%58 = load i32, i32* %7
%59 = add nsw i32 %58, 1
store i32 %59, i32* %7
br label %29
60: ; preds = %29
%61 = load i32, i32* %6
%62 = load i32*, i32** %5
%63 = getelementptr inbounds i32, i32* %62, i64 0
store i32 %61, i32* %63
%64 = load i32*, i32** %5
%65 = getelementptr inbounds i32, i32* %64, i64 3
store i32 0, i32* %65
%66 = load i32*, i32** %5
%67 = getelementptr inbounds i32, i32* %66, i64 2
store i32 0, i32* %67
%68 = load i32*, i32** %5
%69 = getelementptr inbounds i32, i32* %68, i64 1
store i32 0, i32* %69
%70 = load i32*, i32** %5
store i32* %70, i32** %2
br label %71
71: ; preds = %60, %10
%72 = load i32*, i32** %2
ret i32* %72
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [30 x i8] c"building a vrec of radius %g\0A\00"
define i32* @build_vrec(float %0) {
%2 = fcmp ogt float %0, 1.000000e+00
br i1 %2, label %3, label %40
3: ; preds = %1
%4 = load i32, i32* @stderr
%5 = tail call i32 @fprintf(i32 %4, i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str, i64 0, i64 0), float %0)
%6 = tail call float @llvm.fmuladd.f32(float %0, float 2.000000e+00, float 4.000000e+00)
%7 = fptosi float %6 to i32
%8 = shl i32 %7, 3
%9 = add i32 %8, 16
%10 = tail call i32* @xmalloc(i32 %9)
%11 = fsub float -1.000000e+00, %0
%12 = fptosi float %11 to i32
%13 = fadd float %0, 1.000000e+00
%14 = sitofp i32 %12 to float
%15 = fcmp ult float %13, %14
br i1 %15, label %16, label %21
16: ; preds = %35, %3
%17 = phi i32 [ 0, %3 ], [ %36, %35 ]
store i32 %17, i32* %10
%18 = getelementptr inbounds i32, i32* %10, i64 3
store i32 0, i32* %18
%19 = getelementptr inbounds i32, i32* %10, i64 2
store i32 0, i32* %19
%20 = getelementptr inbounds i32, i32* %10, i64 1
store i32 0, i32* %20
br label %40
21: ; preds = %3, %35
%22 = phi i32 [ %37, %35 ], [ %12, %3 ]
%23 = phi i32 [ %36, %35 ], [ 0, %3 ]
%24 = tail call float @abs(i32 %22)
%25 = fcmp olt float %24, %0
br i1 %25, label %26, label %35
26: ; preds = %21
%27 = shl nsw i32 %23, 1
%28 = add nsw i32 %27, 4
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds i32, i32* %10, i64 %29
store i32 0, i32* %30
%31 = add nsw i32 %27, 5
%32 = sext i32 %31 to i64
%33 = getelementptr inbounds i32, i32* %10, i64 %32
store i32 %22, i32* %33
%34 = add nsw i32 %23, 1
br label %35
35: ; preds = %21, %26
%36 = phi i32 [ %34, %26 ], [ %23, %21 ]
%37 = add nsw i32 %22, 1
%38 = sitofp i32 %37 to float
%39 = fcmp ult float %13, %38
br i1 %39, label %16, label %21
40: ; preds = %1, %16
%41 = phi i32* [ %10, %16 ], [ null, %1 ]
ret i32* %41
}