#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 /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ vectorAdd(int *, int *, float *, int);
void testArgs() {
  int a[3], b[3];
  float c[3];
  int i;
  int len = 3;
  for (i = 0; i < len; i++) {
    a[i] = i;
    b[i] = i;
    c[i] = 0;
  }
  vectorAdd(a, b, c, len);
  printf("testArgs:");
  for (i = 0; i < len; i++) {
    printf(" %g", c[i]);
  }
  printf("\n");
}


x86 assembly (clang, -O0):
<testArgs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x3,-0x2c(%rbp)
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    1173 <testArgs+0x53>
mov    -0x28(%rbp),%ecx
movslq -0x28(%rbp),%rax
mov    %ecx,-0xc(%rbp,%rax,4)
mov    -0x28(%rbp),%ecx
movslq -0x28(%rbp),%rax
mov    %ecx,-0x18(%rbp,%rax,4)
movslq -0x28(%rbp),%rax
xorps  %xmm0,%xmm0
movss  %xmm0,-0x24(%rbp,%rax,4)
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1136 <testArgs+0x16>
lea    -0xc(%rbp),%rdi
lea    -0x18(%rbp),%rsi
lea    -0x24(%rbp),%rdx
mov    -0x2c(%rbp),%ecx
call   1040 <vectorAdd@plt>
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x28(%rbp)
mov    -0x28(%rbp),%eax
cmp    -0x2c(%rbp),%eax
jge    11d2 <testArgs+0xb2>
movslq -0x28(%rbp),%rax
movss  -0x24(%rbp,%rax,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe4d(%rip),%rdi
mov    $0x1,%al
call   1030 <printf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    119c <testArgs+0x7c>
lea    0xe35(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testArgs>:
push   %rbx
sub    $0x30,%rsp
movl   $0x0,0x10(%rsp)
movq   $0x0,0x8(%rsp)
movl   $0x0,0x24(%rsp)
movl   $0x0,0x18(%rsp)
movabs $0x200000001,%rax
mov    %rax,0x28(%rsp)
mov    %rax,0x1c(%rsp)
lea    0x24(%rsp),%rdi
lea    0x18(%rsp),%rsi
lea    0x8(%rsp),%rdx
mov    $0x3,%ecx
call   1050 <vectorAdd@plt>
lea    0xe76(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
movss  0x8(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe68(%rip),%rbx
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0xc(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
movss  0x10(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %rbx,%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"testArgs:\00"
@.str.1 = [4 x i8] c" %g\00"
@.str.2 = [2 x i8] c"\0A\00"
define void @testArgs() {
%1 = alloca [3 x i32]
%2 = alloca [3 x i32]
%3 = alloca [3 x float]
%4 = alloca i32
%5 = alloca i32
store i32 3, i32* %5
store i32 0, i32* %4
br label %6
6: ; preds = %22, %0
%7 = load i32, i32* %4
%8 = load i32, i32* %5
%9 = icmp slt i32 %7, %8
br i1 %9, label %10, label %25
10: ; preds = %6
%11 = load i32, i32* %4
%12 = load i32, i32* %4
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 %13
store i32 %11, i32* %14
%15 = load i32, i32* %4
%16 = load i32, i32* %4
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 %17
store i32 %15, i32* %18
%19 = load i32, i32* %4
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [3 x float], [3 x float]* %3, i64 0, i64 %20
store float 0.000000e+00, float* %21
br label %22
22: ; preds = %10
%23 = load i32, i32* %4
%24 = add nsw i32 %23, 1
store i32 %24, i32* %4
br label %6
25: ; preds = %6
%26 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
%27 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
%28 = getelementptr inbounds [3 x float], [3 x float]* %3, i64 0, i64 0
%29 = load i32, i32* %5
%30 = call i32 @vectorAdd(i32* %26, i32* %27, float* %28, i32 %29)
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %4
br label %32
32: ; preds = %43, %25
%33 = load i32, i32* %4
%34 = load i32, i32* %5
%35 = icmp slt i32 %33, %34
br i1 %35, label %36, label %46
36: ; preds = %32
%37 = load i32, i32* %4
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds [3 x float], [3 x float]* %3, i64 0, i64 %38
%40 = load float, float* %39
%41 = fpext float %40 to double
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %41)
br label %43
43: ; preds = %36
%44 = load i32, i32* %4
%45 = add nsw i32 %44, 1
store i32 %45, i32* %4
br label %32
46: ; preds = %32
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"testArgs:\00"
@.str.1 = [4 x i8] c" %g\00"
define void @testArgs() {
%1 = alloca [3 x i32]
%2 = alloca [3 x i32]
%3 = alloca [3 x float]
%4 = bitcast [3 x float]* %3 to i8*
%5 = bitcast [3 x i32]* %1 to i8*
%6 = bitcast [3 x i32]* %2 to i8*
%7 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 0
store i32 0, i32* %7
%8 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 0
store i32 0, i32* %8
%9 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 1
store i32 1, i32* %9
%10 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 1
store i32 1, i32* %10
%11 = getelementptr inbounds [3 x i32], [3 x i32]* %1, i64 0, i64 2
store i32 2, i32* %11
%12 = getelementptr inbounds [3 x i32], [3 x i32]* %2, i64 0, i64 2
store i32 2, i32* %12
%13 = getelementptr inbounds [3 x float], [3 x float]* %3, i64 0, i64 0
%14 = call i32 @vectorAdd(i32* %7, i32* %8, float* %13, i32 3)
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%16 = load float, float* %13
%17 = fpext float %16 to double
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %17)
%19 = getelementptr inbounds [3 x float], [3 x float]* %3, i64 0, i64 1
%20 = load float, float* %19
%21 = fpext float %20 to double
%22 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %21)
%23 = getelementptr inbounds [3 x float], [3 x float]* %3, i64 0, i64 2
%24 = load float, float* %23
%25 = fpext float %24 to double
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), double %25)
%27 = call i32 @putchar(i32 10)
ret void
}