#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 */
double fabs(double);
double sin(double);
void sinc(double x[2048]) {
  int k;
  for (k = 0; k < 2048; k++) {
    if (fabs(x[k]) < 1.0020841800044864E-292) {
      x[k] = 1.0;
    } else {
      x[k] *= 3.1415926535897931;
      x[k] = sin(x[k]) / x[k];
    }
  }
}


x86 assembly (clang, -O0):
<sinc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x800,-0xc(%rbp)
jge    11cd <sinc+0xbd>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
movaps 0xedc(%rip),%xmm0
pand   %xmm0,%xmm1
movsd  0xeb0(%rip),%xmm0
ucomisd %xmm1,%xmm0
jbe    1174 <sinc+0x64>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsd  0xea6(%rip),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
jmp    11ba <sinc+0xaa>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsd  0xe84(%rip),%xmm0
mulsd  (%rax,%rcx,8),%xmm0
movsd  %xmm0,(%rax,%rcx,8)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
call   1030 <sin@plt>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
divsd  (%rax,%rcx,8),%xmm0
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsd  %xmm0,(%rax,%rcx,8)
jmp    11bf <sinc+0xaf>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <sinc+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sinc>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
xor    %ebx,%ebx
movapd 0xedf(%rip),%xmm2
movsd  0xee7(%rip),%xmm3
movsd  0xee7(%rip),%xmm4
jmp    1153 <sinc+0x43>
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
movsd  %xmm1,(%r14,%rbx,8)
add    $0x1,%rbx
cmp    $0x800,%rbx
je     11a2 <sinc+0x92>
movsd  (%r14,%rbx,8),%xmm0
movapd %xmm0,%xmm1
andpd  %xmm2,%xmm1
ucomisd %xmm1,%xmm4
movapd %xmm3,%xmm1
ja     1140 <sinc+0x30>
mulsd  0xead(%rip),%xmm0
movsd  %xmm0,(%r14,%rbx,8)
call   1030 <sin@plt>
movsd  0xe92(%rip),%xmm4
movsd  0xe82(%rip),%xmm3
movapd 0xe6a(%rip),%xmm2
movapd %xmm0,%xmm1
divsd  (%r14,%rbx,8),%xmm1
jmp    1140 <sinc+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @sinc(double* %0) {
%2 = alloca double*
%3 = alloca i32
store double* %0, double** %2
store i32 0, i32* %3
br label %4
4: ; preds = %44, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 2048
br i1 %6, label %7, label %47
7: ; preds = %4
%8 = load double*, double** %2
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds double, double* %8, i64 %10
%12 = load double, double* %11
%13 = call double @llvm.fabs.f64(double %12)
%14 = fcmp olt double %13, 0x350000000000000
br i1 %14, label %15, label %20
15: ; preds = %7
%16 = load double*, double** %2
%17 = load i32, i32* %3
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds double, double* %16, i64 %18
store double 1.000000e+00, double* %19
br label %43
20: ; preds = %7
%21 = load double*, double** %2
%22 = load i32, i32* %3
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds double, double* %21, i64 %23
%25 = load double, double* %24
%26 = fmul double %25, 0x400921FB54442D18
store double %26, double* %24
%27 = load double*, double** %2
%28 = load i32, i32* %3
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds double, double* %27, i64 %29
%31 = load double, double* %30
%32 = call double @sin(double %31)
%33 = load double*, double** %2
%34 = load i32, i32* %3
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds double, double* %33, i64 %35
%37 = load double, double* %36
%38 = fdiv double %32, %37
%39 = load double*, double** %2
%40 = load i32, i32* %3
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds double, double* %39, i64 %41
store double %38, double* %42
br label %43
43: ; preds = %20, %15
br label %44
44: ; preds = %43
%45 = load i32, i32* %3
%46 = add nsw i32 %45, 1
store i32 %46, i32* %3
br label %4
47: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @sinc(double* nocapture %0) {
br label %2
2: ; preds = %1, %13
%3 = phi i64 [ 0, %1 ], [ %15, %13 ]
%4 = getelementptr inbounds double, double* %0, i64 %3
%5 = load double, double* %4
%6 = tail call double @llvm.fabs.f64(double %5)
%7 = fcmp olt double %6, 0x350000000000000
br i1 %7, label %13, label %8
8: ; preds = %2
%9 = fmul double %5, 0x400921FB54442D18
store double %9, double* %4
%10 = tail call double @sin(double %9)
%11 = load double, double* %4
%12 = fdiv double %10, %11
br label %13
13: ; preds = %2, %8
%14 = phi double [ %12, %8 ], [ 1.000000e+00, %2 ]
store double %14, double* %4
%15 = add nuw nsw i64 %3, 1
%16 = icmp eq i64 %15, 2048
br i1 %16, label %17, label %2
17: ; preds = %13
ret void
}