#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_Drec(float radius) {
  if (!(radius > 1))
    return NULL;
  fprintf(stderr, "building a drec 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] = -i;
      e[2 * cx + 5] = i;
      cx += 1;
    }
  e[0] = cx;
  e[1] = e[2] = e[3] = 0;
  return e;
}


x86 assembly (clang, -O0):
<build_Drec>:
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_Drec+0x30>
movq   $0x0,-0x8(%rbp)
jmp    128c <build_Drec+0x15c>
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     125a <build_Drec+0x12a>
mov    -0x20(%rbp),%edi
call   1030 <abs@plt>
movaps %xmm0,%xmm1
movss  -0xc(%rbp),%xmm0
ucomiss %xmm1,%xmm0
jbe    1247 <build_Drec+0x117>
xor    %edx,%edx
sub    -0x20(%rbp),%edx
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
shl    $0x1,%ecx
add    $0x4,%ecx
movslq %ecx,%rcx
mov    %edx,(%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    124c <build_Drec+0x11c>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11dc <build_Drec+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_Drec>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
xor    %r15d,%r15d
ucomiss 0xebf(%rip),%xmm0
jbe    11c9 <build_Drec+0x99>
mov    0x2e92(%rip),%rax
mov    (%rax),%edi
lea    0xeb5(%rip),%rsi
movss  %xmm0,(%rsp)
call   1050 <fprintf@plt>
movss  (%rsp),%xmm0
addss  %xmm0,%xmm0
addss  0xe92(%rip),%xmm0
cvttss2si %xmm0,%eax
lea    0x10(,%rax,8),%edi
call   1040 <xmalloc@plt>
mov    %rax,%r14
movss  0xe7b(%rip),%xmm0
movss  (%rsp),%xmm1
subss  %xmm1,%xmm0
movss  0xe62(%rip),%xmm2
addss  %xmm1,%xmm2
cvttps2dq %xmm0,%xmm1
cvtdq2ps %xmm1,%xmm1
movss  %xmm2,0x4(%rsp)
ucomiss %xmm1,%xmm2
jae    11da <build_Drec+0xaa>
mov    %r15d,(%r14)
movl   $0x0,0xc(%r14)
movq   $0x0,0x4(%r14)
jmp    11cc <build_Drec+0x9c>
xor    %r14d,%r14d
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
cvttss2si %xmm0,%ebp
mov    %ebp,%ebx
neg    %ebx
xor    %r15d,%r15d
jmp    1208 <build_Drec+0xd8>
nopw   0x0(%rax,%rax,1)
add    $0x1,%ebp
xorps  %xmm0,%xmm0
cvtsi2ss %ebp,%xmm0
add    $0xffffffff,%ebx
movss  0x4(%rsp),%xmm1
ucomiss %xmm0,%xmm1
jb     11b4 <build_Drec+0x84>
mov    %ebp,%edi
call   1030 <abs@plt>
movss  (%rsp),%xmm1
ucomiss %xmm0,%xmm1
jbe    11f0 <build_Drec+0xc0>
lea    (%r15,%r15,1),%eax
cltq
mov    %ebx,0x10(%r14,%rax,4)
mov    %ebp,0x14(%r14,%rax,4)
add    $0x1,%r15d
jmp    11f0 <build_Drec+0xc0>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [30 x i8] c"building a drec of radius %g\0A\00"
define i32* @build_Drec(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 %73
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 = %59, %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 %62
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 %58
40: ; preds = %35
%41 = load i32, i32* %7
%42 = sub nsw i32 0, %41
%43 = load i32*, i32** %5
%44 = load i32, i32* %6
%45 = mul nsw i32 2, %44
%46 = add nsw i32 %45, 4
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i32, i32* %43, i64 %47
store i32 %42, i32* %48
%49 = load i32, i32* %7
%50 = load i32*, i32** %5
%51 = load i32, i32* %6
%52 = mul nsw i32 2, %51
%53 = add nsw i32 %52, 5
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds i32, i32* %50, i64 %54
store i32 %49, i32* %55
%56 = load i32, i32* %6
%57 = add nsw i32 %56, 1
store i32 %57, i32* %6
br label %58
58: ; preds = %40, %35
br label %59
59: ; preds = %58
%60 = load i32, i32* %7
%61 = add nsw i32 %60, 1
store i32 %61, i32* %7
br label %29
62: ; preds = %29
%63 = load i32, i32* %6
%64 = load i32*, i32** %5
%65 = getelementptr inbounds i32, i32* %64, i64 0
store i32 %63, i32* %65
%66 = load i32*, i32** %5
%67 = getelementptr inbounds i32, i32* %66, i64 3
store i32 0, i32* %67
%68 = load i32*, i32** %5
%69 = getelementptr inbounds i32, i32* %68, i64 2
store i32 0, i32* %69
%70 = load i32*, i32** %5
%71 = getelementptr inbounds i32, i32* %70, i64 1
store i32 0, i32* %71
%72 = load i32*, i32** %5
store i32* %72, i32** %2
br label %73
73: ; preds = %62, %10
%74 = load i32*, i32** %2
ret i32* %74
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [30 x i8] c"building a drec of radius %g\0A\00"
define i32* @build_Drec(float %0) {
%2 = fcmp ogt float %0, 1.000000e+00
br i1 %2, label %3, label %41
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 = %36, %3
%17 = phi i32 [ 0, %3 ], [ %37, %36 ]
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 %41
21: ; preds = %3, %36
%22 = phi i32 [ %38, %36 ], [ %12, %3 ]
%23 = phi i32 [ %37, %36 ], [ 0, %3 ]
%24 = tail call float @abs(i32 %22)
%25 = fcmp olt float %24, %0
br i1 %25, label %26, label %36
26: ; preds = %21
%27 = sub nsw i32 0, %22
%28 = shl nsw i32 %23, 1
%29 = add nsw i32 %28, 4
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds i32, i32* %10, i64 %30
store i32 %27, i32* %31
%32 = add nsw i32 %28, 5
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i32, i32* %10, i64 %33
store i32 %22, i32* %34
%35 = add nsw i32 %23, 1
br label %36
36: ; preds = %21, %26
%37 = phi i32 [ %35, %26 ], [ %23, %21 ]
%38 = add nsw i32 %22, 1
%39 = sitofp i32 %38 to float
%40 = fcmp ult float %13, %39
br i1 %40, label %16, label %21
41: ; preds = %1, %16
%42 = phi i32* [ %10, %16 ], [ null, %1 ]
ret i32* %42
}