#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 sqrt(float);
void fun_def(float *a, float *b, int n) {
  int i;
  for (i = 0; i < n; i++) {
    b[i] = sqrt(a[i] * a[i] + 2.8f);
  }
}


x86 assembly (clang, -O0):
<fun_def>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    1180 <fun_def+0x70>
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x8(%rbp),%rax
movslq -0x18(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm1
mulss  %xmm1,%xmm0
movss  0xea4(%rip),%xmm1
addss  %xmm1,%xmm0
call   1030 <sqrt@plt>
mov    -0x10(%rbp),%rax
movslq -0x18(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    112a <fun_def+0x1a>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun_def>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
test   %edx,%edx
jle    11fb <fun_def+0xeb>
mov    %rsi,%r14
mov    %rdi,%r15
mov    %edx,%r12d
cmp    $0x1,%edx
jne    1162 <fun_def+0x52>
xor    %ebx,%ebx
test   $0x1,%r12b
je     11fb <fun_def+0xeb>
movss  (%r15,%rbx,4),%xmm0
mulss  %xmm0,%xmm0
addss  0xeb3(%rip),%xmm0
xorps  %xmm1,%xmm1
ucomiss %xmm1,%xmm0
jb     11f0 <fun_def+0xe0>
sqrtss %xmm0,%xmm0
jmp    11f5 <fun_def+0xe5>
mov    %r12d,%r13d
and    $0xfffffffe,%r13d
xor    %ebx,%ebx
movss  0xe8d(%rip),%xmm1
xorps  %xmm2,%xmm2
jmp    11a0 <fun_def+0x90>
nopl   0x0(%rax,%rax,1)
call   1030 <sqrt@plt>
xorps  %xmm2,%xmm2
movss  0xe70(%rip),%xmm1
movss  %xmm0,0x4(%r14,%rbx,4)
add    $0x2,%rbx
cmp    %rbx,%r13
je     1131 <fun_def+0x21>
movss  (%r15,%rbx,4),%xmm0
mulss  %xmm0,%xmm0
addss  %xmm1,%xmm0
ucomiss %xmm2,%xmm0
jb     11c0 <fun_def+0xb0>
sqrtss %xmm0,%xmm0
jmp    11d0 <fun_def+0xc0>
nopl   0x0(%rax)
call   1030 <sqrt@plt>
xorps  %xmm2,%xmm2
movss  0xe30(%rip),%xmm1
movss  %xmm0,(%r14,%rbx,4)
movss  0x4(%r15,%rbx,4),%xmm0
mulss  %xmm0,%xmm0
addss  %xmm1,%xmm0
ucomiss %xmm2,%xmm0
jb     1180 <fun_def+0x70>
sqrtss %xmm0,%xmm0
jmp    1190 <fun_def+0x80>
call   1030 <sqrt@plt>
movss  %xmm0,(%r14,%rbx,4)
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @fun_def(float* %0, float* %1, i32 %2) {
%4 = alloca float*
%5 = alloca float*
%6 = alloca i32
%7 = alloca i32
store float* %0, float** %4
store float* %1, float** %5
store i32 %2, i32* %6
store i32 0, i32* %7
br label %8
8: ; preds = %29, %3
%9 = load i32, i32* %7
%10 = load i32, i32* %6
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %32
12: ; preds = %8
%13 = load float*, float** %4
%14 = load i32, i32* %7
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds float, float* %13, i64 %15
%17 = load float, float* %16
%18 = load float*, float** %4
%19 = load i32, i32* %7
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds float, float* %18, i64 %20
%22 = load float, float* %21
%23 = call float @llvm.fmuladd.f32(float %17, float %22, float 0x4006666660000000)
%24 = call float @sqrt(float %23)
%25 = load float*, float** %5
%26 = load i32, i32* %7
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds float, float* %25, i64 %27
store float %24, float* %28
br label %29
29: ; preds = %12
%30 = load i32, i32* %7
%31 = add nsw i32 %30, 1
store i32 %31, i32* %7
br label %8
32: ; preds = %8
ret void
}

LLVM IR (-O2):
define void @fun_def(float* nocapture %0, float* nocapture writeonly %1, i32 %2) {
%4 = icmp sgt i32 %2, 0
br i1 %4, label %5, label %37
5: ; preds = %3
%6 = zext i32 %2 to i64
%7 = and i64 %6, 1
%8 = icmp eq i32 %2, 1
br i1 %8, label %28, label %9
9: ; preds = %5
%10 = and i64 %6, 4294967294
br label %11
11: ; preds = %11, %9
%12 = phi i64 [ 0, %9 ], [ %25, %11 ]
%13 = phi i64 [ 0, %9 ], [ %26, %11 ]
%14 = getelementptr inbounds float, float* %0, i64 %12
%15 = load float, float* %14
%16 = tail call float @llvm.fmuladd.f32(float %15, float %15, float 0x4006666660000000)
%17 = tail call float @sqrt(float %16)
%18 = getelementptr inbounds float, float* %1, i64 %12
store float %17, float* %18
%19 = or i64 %12, 1
%20 = getelementptr inbounds float, float* %0, i64 %19
%21 = load float, float* %20
%22 = tail call float @llvm.fmuladd.f32(float %21, float %21, float 0x4006666660000000)
%23 = tail call float @sqrt(float %22)
%24 = getelementptr inbounds float, float* %1, i64 %19
store float %23, float* %24
%25 = add nuw nsw i64 %12, 2
%26 = add i64 %13, 2
%27 = icmp eq i64 %26, %10
br i1 %27, label %28, label %11
28: ; preds = %11, %5
%29 = phi i64 [ 0, %5 ], [ %25, %11 ]
%30 = icmp eq i64 %7, 0
br i1 %30, label %37, label %31
31: ; preds = %28
%32 = getelementptr inbounds float, float* %0, i64 %29
%33 = load float, float* %32
%34 = tail call float @llvm.fmuladd.f32(float %33, float %33, float 0x4006666660000000)
%35 = tail call float @sqrt(float %34)
%36 = getelementptr inbounds float, float* %1, i64 %29
store float %35, float* %36
br label %37
37: ; preds = %31, %28, %3
ret void
}