#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 fabs(float);
int /*<<< orphan*/ free(float *);
float *malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ set_value(float *, double, int);
int main() {
  int i, failed = 0;
  int N = 1024;
  float *ptr;
  ptr = malloc(sizeof(float) * N);
  set_value(ptr, 11.0, N);
  for (i = 0; i < 10; i++)
    printf("%f\t", ptr[i]);
  printf("\n");
  for (i = N - 10; i < N; i++)
    printf("%f\t", ptr[i]);
  printf("\n");
  for (i = 0; i < N; i++) {
    if (fabs(ptr[i] - 11.0) > 1e-8) {
      failed = 1;
    }
  }
  if (failed) {
    printf("FAILED !!\n");
  } else {
    printf("PASSED !!\n");
  }
  free(ptr);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x400,-0x10(%rbp)
movslq -0x10(%rbp),%rax
shl    $0x2,%rax
mov    %eax,%edi
call   1070 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%esi
movsd  0xe71(%rip),%xmm0
call   1050 <set_value@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    11d2 <main+0x82>
mov    -0x18(%rbp),%rax
movslq -0x8(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe53(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    119b <main+0x4b>
lea    0xe44(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x10(%rbp),%eax
sub    $0xa,%eax
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1222 <main+0xd2>
mov    -0x18(%rbp),%rax
movslq -0x8(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe03(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11e9 <main+0x99>
lea    0xdf4(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1299 <main+0x149>
mov    -0x18(%rbp),%rax
movslq -0x8(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
movsd  0xda4(%rip),%xmm1
subsd  %xmm1,%xmm0
cvtsd2ss %xmm0,%xmm0
call   1060 <fabs@plt>
cvtsi2sd %eax,%xmm0
movsd  0xd93(%rip),%xmm1
ucomisd %xmm1,%xmm0
jbe    1286 <main+0x136>
movl   $0x1,-0xc(%rbp)
jmp    128b <main+0x13b>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1237 <main+0xe7>
cmpl   $0x0,-0xc(%rbp)
je     12b6 <main+0x166>
lea    0xd6a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    12c4 <main+0x174>
lea    0xd62(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    $0x1000,%edi
call   1090 <malloc@plt>
mov    %rax,%r15
movsd  0xe70(%rip),%xmm0
mov    %rax,%rdi
mov    $0x400,%esi
call   1070 <set_value@plt>
movss  (%r15),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe5f(%rip),%r14
mov    %r14,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movss  0x4(%r15),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movss  0x8(%r15),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movss  0xc(%r15),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movss  0x10(%r15),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movss  0x14(%r15),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movss  0x18(%r15),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movss  0x1c(%r15),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movss  0x20(%r15),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movss  0x24(%r15),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
movss  0xfd8(%r15),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movss  0xfdc(%r15),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movss  0xfe0(%r15),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movss  0xfe4(%r15),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movss  0xfe8(%r15),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movss  0xfec(%r15),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movss  0xff0(%r15),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movss  0xff4(%r15),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movss  0xff8(%r15),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
movss  0xffc(%r15),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1060 <printf@plt>
mov    $0xa,%edi
call   1040 <putchar@plt>
xor    %ebx,%ebx
mov    $0x3,%ebp
jmp    1381 <main+0x211>
xchg   %ax,%ax
add    $0x4,%rbp
cmp    $0x403,%rbp
je     1406 <main+0x296>
movss  -0xc(%r15,%rbp,4),%xmm0
movss  0xc78(%rip),%xmm1
addss  %xmm1,%xmm0
call   1080 <fabs@plt>
mov    %eax,%r14d
movss  -0x8(%r15,%rbp,4),%xmm0
addss  0xc5d(%rip),%xmm0
call   1080 <fabs@plt>
mov    %eax,%r12d
movss  -0x4(%r15,%rbp,4),%xmm0
addss  0xc46(%rip),%xmm0
call   1080 <fabs@plt>
mov    %eax,%r13d
movss  (%r15,%rbp,4),%xmm0
addss  0xc30(%rip),%xmm0
call   1080 <fabs@plt>
test   %r14d,%r14d
mov    $0x1,%ecx
cmovg  %ecx,%ebx
test   %r12d,%r12d
cmovg  %ecx,%ebx
test   %r13d,%r13d
cmovg  %ecx,%ebx
test   %eax,%eax
jle    1370 <main+0x200>
mov    $0x1,%ebx
jmp    1370 <main+0x200>
test   %ebx,%ebx
lea    0xc01(%rip),%rax
lea    0xc04(%rip),%rdi
cmove  %rax,%rdi
call   1050 <puts@plt>
mov    %r15,%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%f\09\00"
@.str.1 = [2 x i8] c"\0A\00"
@.str.2 = [11 x i8] c"FAILED !!\0A\00"
@.str.3 = [11 x i8] c"PASSED !!\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca float*
store i32 0, i32* %1
store i32 0, i32* %3
store i32 1024, i32* %4
%6 = load i32, i32* %4
%7 = sext i32 %6 to i64
%8 = mul i64 4, %7
%9 = trunc i64 %8 to i32
%10 = call float* @malloc(i32 %9)
store float* %10, float** %5
%11 = load float*, float** %5
%12 = load i32, i32* %4
%13 = call i32 @set_value(float* %11, double 1.100000e+01, i32 %12)
store i32 0, i32* %2
br label %14
14: ; preds = %25, %0
%15 = load i32, i32* %2
%16 = icmp slt i32 %15, 10
br i1 %16, label %17, label %28
17: ; preds = %14
%18 = load float*, float** %5
%19 = load i32, i32* %2
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds float, float* %18, i64 %20
%22 = load float, float* %21
%23 = fpext float %22 to double
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %23)
br label %25
25: ; preds = %17
%26 = load i32, i32* %2
%27 = add nsw i32 %26, 1
store i32 %27, i32* %2
br label %14
28: ; preds = %14
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%30 = load i32, i32* %4
%31 = sub nsw i32 %30, 10
store i32 %31, i32* %2
br label %32
32: ; preds = %44, %28
%33 = load i32, i32* %2
%34 = load i32, i32* %4
%35 = icmp slt i32 %33, %34
br i1 %35, label %36, label %47
36: ; preds = %32
%37 = load float*, float** %5
%38 = load i32, i32* %2
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds float, float* %37, i64 %39
%41 = load float, float* %40
%42 = fpext float %41 to double
%43 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %42)
br label %44
44: ; preds = %36
%45 = load i32, i32* %2
%46 = add nsw i32 %45, 1
store i32 %46, i32* %2
br label %32
47: ; preds = %32
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
store i32 0, i32* %2
br label %49
49: ; preds = %67, %47
%50 = load i32, i32* %2
%51 = load i32, i32* %4
%52 = icmp slt i32 %50, %51
br i1 %52, label %53, label %70
53: ; preds = %49
%54 = load float*, float** %5
%55 = load i32, i32* %2
%56 = sext i32 %55 to i64
%57 = getelementptr inbounds float, float* %54, i64 %56
%58 = load float, float* %57
%59 = fpext float %58 to double
%60 = fsub double %59, 1.100000e+01
%61 = fptrunc double %60 to float
%62 = call i32 @fabs(float %61)
%63 = sitofp i32 %62 to double
%64 = fcmp ogt double %63, 1.000000e-08
br i1 %64, label %65, label %66
65: ; preds = %53
store i32 1, i32* %3
br label %66
66: ; preds = %65, %53
br label %67
67: ; preds = %66
%68 = load i32, i32* %2
%69 = add nsw i32 %68, 1
store i32 %69, i32* %2
br label %49
70: ; preds = %49
%71 = load i32, i32* %3
%72 = icmp ne i32 %71, 0
br i1 %72, label %73, label %75
73: ; preds = %70
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.2, i64 0, i64 0))
br label %77
75: ; preds = %70
%76 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0))
br label %77
77: ; preds = %75, %73
%78 = load float*, float** %5
%79 = call i32 @free(float* %78)
%80 = load i32, i32* %1
ret i32 %80
}

LLVM IR (-O2):
@.str = [4 x i8] c"%f\09\00"
@str = [10 x i8] c"PASSED !!\00"
@str.4 = [10 x i8] c"FAILED !!\00"
define i32 @main() {
%1 = tail call float* @malloc(i32 4096)
%2 = tail call i32 @set_value(float* %1, double 1.100000e+01, i32 1024)
%3 = load float, float* %1
%4 = fpext float %3 to double
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %4)
%6 = getelementptr inbounds float, float* %1, i64 1
%7 = load float, float* %6
%8 = fpext float %7 to double
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %8)
%10 = getelementptr inbounds float, float* %1, i64 2
%11 = load float, float* %10
%12 = fpext float %11 to double
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %12)
%14 = getelementptr inbounds float, float* %1, i64 3
%15 = load float, float* %14
%16 = fpext float %15 to double
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %16)
%18 = getelementptr inbounds float, float* %1, i64 4
%19 = load float, float* %18
%20 = fpext float %19 to double
%21 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %20)
%22 = getelementptr inbounds float, float* %1, i64 5
%23 = load float, float* %22
%24 = fpext float %23 to double
%25 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %24)
%26 = getelementptr inbounds float, float* %1, i64 6
%27 = load float, float* %26
%28 = fpext float %27 to double
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %28)
%30 = getelementptr inbounds float, float* %1, i64 7
%31 = load float, float* %30
%32 = fpext float %31 to double
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %32)
%34 = getelementptr inbounds float, float* %1, i64 8
%35 = load float, float* %34
%36 = fpext float %35 to double
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %36)
%38 = getelementptr inbounds float, float* %1, i64 9
%39 = load float, float* %38
%40 = fpext float %39 to double
%41 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %40)
%42 = tail call i32 @putchar(i32 10)
%43 = getelementptr inbounds float, float* %1, i64 1014
%44 = load float, float* %43
%45 = fpext float %44 to double
%46 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %45)
%47 = getelementptr inbounds float, float* %1, i64 1015
%48 = load float, float* %47
%49 = fpext float %48 to double
%50 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %49)
%51 = getelementptr inbounds float, float* %1, i64 1016
%52 = load float, float* %51
%53 = fpext float %52 to double
%54 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %53)
%55 = getelementptr inbounds float, float* %1, i64 1017
%56 = load float, float* %55
%57 = fpext float %56 to double
%58 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %57)
%59 = getelementptr inbounds float, float* %1, i64 1018
%60 = load float, float* %59
%61 = fpext float %60 to double
%62 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %61)
%63 = getelementptr inbounds float, float* %1, i64 1019
%64 = load float, float* %63
%65 = fpext float %64 to double
%66 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %65)
%67 = getelementptr inbounds float, float* %1, i64 1020
%68 = load float, float* %67
%69 = fpext float %68 to double
%70 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %69)
%71 = getelementptr inbounds float, float* %1, i64 1021
%72 = load float, float* %71
%73 = fpext float %72 to double
%74 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %73)
%75 = getelementptr inbounds float, float* %1, i64 1022
%76 = load float, float* %75
%77 = fpext float %76 to double
%78 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %77)
%79 = getelementptr inbounds float, float* %1, i64 1023
%80 = load float, float* %79
%81 = fpext float %80 to double
%82 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %81)
%83 = tail call i32 @putchar(i32 10)
br label %84
84: ; preds = %84, %0
%85 = phi i64 [ 0, %0 ], [ %114, %84 ]
%86 = phi i32 [ 0, %0 ], [ %113, %84 ]
%87 = getelementptr inbounds float, float* %1, i64 %85
%88 = load float, float* %87
%89 = fadd float %88, -1.100000e+01
%90 = tail call i32 @fabs(float %89)
%91 = icmp slt i32 %90, 1
%92 = or i64 %85, 1
%93 = getelementptr inbounds float, float* %1, i64 %92
%94 = load float, float* %93
%95 = fadd float %94, -1.100000e+01
%96 = tail call i32 @fabs(float %95)
%97 = icmp slt i32 %96, 1
%98 = or i64 %85, 2
%99 = getelementptr inbounds float, float* %1, i64 %98
%100 = load float, float* %99
%101 = fadd float %100, -1.100000e+01
%102 = tail call i32 @fabs(float %101)
%103 = icmp slt i32 %102, 1
%104 = or i64 %85, 3
%105 = getelementptr inbounds float, float* %1, i64 %104
%106 = load float, float* %105
%107 = fadd float %106, -1.100000e+01
%108 = tail call i32 @fabs(float %107)
%109 = icmp slt i32 %108, 1
%110 = select i1 %109, i1 %103, i1 false
%111 = select i1 %110, i1 %97, i1 false
%112 = select i1 %111, i1 %91, i1 false
%113 = select i1 %112, i32 %86, i32 1
%114 = add nuw nsw i64 %85, 4
%115 = icmp eq i64 %114, 1024
br i1 %115, label %116, label %84
116: ; preds = %84
%117 = icmp eq i32 %113, 0
%118 = select i1 %117, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @str.4, i64 0, i64 0)
%119 = tail call i32 @puts(i8* dereferenceable(1) %118)
%120 = tail call i32 @free(float* %1)
ret i32 0
}