#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*/ free(float *);
int /*<<< orphan*/ getchar();
scalar_t__ malloc(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, float *);
int main() {
  int i;
  float *arr1, *arr2;
  arr1 = (float *)malloc(3 * sizeof(float));
  arr2 = (float *)malloc(3 * sizeof(float));
  printf("Please input %d floats for 'arr1':\n", 3);
  for (i = 0; i < 3; i++) {
    scanf("%f", arr1 + i);
  }
  getchar();
  for (i = 0; i < 3; i++) {
    *(arr2 + i) = *(arr1 + i);
  }
  printf("Arr1:\n");
  for (i = 0; i < 3; i++) {
    printf("pos %d: %.3f\n", i + 1, arr1[i]);
  }
  printf("Arr2:\n");
  for (i = 0; i < 3; i++) {
    printf("pos %d: %.3f\n", i + 1, arr2[i]);
  }
  free(arr1);
  free(arr2);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0xc,%edi
call   1060 <malloc@plt>
mov    %rax,-0x10(%rbp)
mov    $0xc,%edi
call   1060 <malloc@plt>
mov    %rax,-0x18(%rbp)
lea    0xe7e(%rip),%rdi
mov    $0x3,%esi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    11c8 <main+0x78>
mov    -0x10(%rbp),%rsi
movslq -0x8(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe6f(%rip),%rdi
call   1070 <scanf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1195 <main+0x45>
mov    $0x0,%al
call   1050 <getchar@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    1208 <main+0xb8>
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
mov    -0x18(%rbp),%rax
movslq -0x8(%rbp),%rcx
movss  %xmm0,(%rax,%rcx,4)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11d6 <main+0x86>
lea    0xe18(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    125a <main+0x10a>
mov    -0x8(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%rax
movslq -0x8(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xde9(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    121d <main+0xcd>
lea    0xddb(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
jge    12ac <main+0x15c>
mov    -0x8(%rbp),%esi
add    $0x1,%esi
mov    -0x18(%rbp),%rax
movslq -0x8(%rbp),%rcx
movss  (%rax,%rcx,4),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xd97(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    126f <main+0x11f>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
mov    $0xc,%edi
call   1070 <malloc@plt>
mov    %rax,%rbx
mov    $0xc,%edi
call   1070 <malloc@plt>
mov    %rax,%r14
lea    0xe7a(%rip),%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe8b(%rip),%r15
mov    %r15,%rdi
mov    %rbx,%rsi
call   1080 <scanf@plt>
lea    0x4(%rbx),%rsi
mov    %r15,%rdi
call   1080 <scanf@plt>
lea    0x8(%rbx),%rsi
mov    %r15,%rdi
call   1080 <scanf@plt>
xor    %eax,%eax
call   1060 <getchar@plt>
movss  (%rbx),%xmm0
movss  %xmm0,(%r14)
movss  0x4(%rbx),%xmm0
movss  %xmm0,0x4(%r14)
movss  0x8(%rbx),%xmm0
movss  %xmm0,0x8(%r14)
lea    0xe4c(%rip),%rdi
call   1040 <puts@plt>
movss  (%rbx),%xmm0
cvtss2sd %xmm0,%xmm0
lea    0xe2a(%rip),%r15
mov    %r15,%rdi
mov    $0x1,%esi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x4(%rbx),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r15,%rdi
mov    $0x2,%esi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x8(%rbx),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r15,%rdi
mov    $0x3,%esi
mov    $0x1,%al
call   1050 <printf@plt>
lea    0xdf8(%rip),%rdi
call   1040 <puts@plt>
movss  (%r14),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r15,%rdi
mov    $0x1,%esi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x4(%r14),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r15,%rdi
mov    $0x2,%esi
mov    $0x1,%al
call   1050 <printf@plt>
movss  0x8(%r14),%xmm0
cvtss2sd %xmm0,%xmm0
mov    %r15,%rdi
mov    $0x3,%esi
mov    $0x1,%al
call   1050 <printf@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [36 x i8] c"Please input %d floats for 'arr1':\0A\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.2 = [7 x i8] c"Arr1:\0A\00"
@.str.3 = [14 x i8] c"pos %d: %.3f\0A\00"
@.str.4 = [7 x i8] c"Arr2:\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca float*
%4 = alloca float*
store i32 0, i32* %1
%5 = call i64 @malloc(i32 12)
%6 = inttoptr i64 %5 to float*
store float* %6, float** %3
%7 = call i64 @malloc(i32 12)
%8 = inttoptr i64 %7 to float*
store float* %8, float** %4
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 3)
store i32 0, i32* %2
br label %10
10: ; preds = %19, %0
%11 = load i32, i32* %2
%12 = icmp slt i32 %11, 3
br i1 %12, label %13, label %22
13: ; preds = %10
%14 = load float*, float** %3
%15 = load i32, i32* %2
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds float, float* %14, i64 %16
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %17)
br label %19
19: ; preds = %13
%20 = load i32, i32* %2
%21 = add nsw i32 %20, 1
store i32 %21, i32* %2
br label %10
22: ; preds = %10
%23 = call i32 (...) @getchar()
store i32 0, i32* %2
br label %24
24: ; preds = %37, %22
%25 = load i32, i32* %2
%26 = icmp slt i32 %25, 3
br i1 %26, label %27, label %40
27: ; preds = %24
%28 = load float*, float** %3
%29 = load i32, i32* %2
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds float, float* %28, i64 %30
%32 = load float, float* %31
%33 = load float*, float** %4
%34 = load i32, i32* %2
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds float, float* %33, i64 %35
store float %32, float* %36
br label %37
37: ; preds = %27
%38 = load i32, i32* %2
%39 = add nsw i32 %38, 1
store i32 %39, i32* %2
br label %24
40: ; preds = %24
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %2
br label %42
42: ; preds = %55, %40
%43 = load i32, i32* %2
%44 = icmp slt i32 %43, 3
br i1 %44, label %45, label %58
45: ; preds = %42
%46 = load i32, i32* %2
%47 = add nsw i32 %46, 1
%48 = load float*, float** %3
%49 = load i32, i32* %2
%50 = sext i32 %49 to i64
%51 = getelementptr inbounds float, float* %48, i64 %50
%52 = load float, float* %51
%53 = fpext float %52 to double
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %47, double %53)
br label %55
55: ; preds = %45
%56 = load i32, i32* %2
%57 = add nsw i32 %56, 1
store i32 %57, i32* %2
br label %42
58: ; preds = %42
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
store i32 0, i32* %2
br label %60
60: ; preds = %73, %58
%61 = load i32, i32* %2
%62 = icmp slt i32 %61, 3
br i1 %62, label %63, label %76
63: ; preds = %60
%64 = load i32, i32* %2
%65 = add nsw i32 %64, 1
%66 = load float*, float** %4
%67 = load i32, i32* %2
%68 = sext i32 %67 to i64
%69 = getelementptr inbounds float, float* %66, i64 %68
%70 = load float, float* %69
%71 = fpext float %70 to double
%72 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %65, double %71)
br label %73
73: ; preds = %63
%74 = load i32, i32* %2
%75 = add nsw i32 %74, 1
store i32 %75, i32* %2
br label %60
76: ; preds = %60
%77 = load float*, float** %3
%78 = call i32 @free(float* %77)
%79 = load float*, float** %4
%80 = call i32 @free(float* %79)
ret i32 0
}

LLVM IR (-O2):
@.str = [36 x i8] c"Please input %d floats for 'arr1':\0A\00"
@.str.1 = [3 x i8] c"%f\00"
@.str.3 = [14 x i8] c"pos %d: %.3f\0A\00"
@str = [6 x i8] c"Arr1:\00"
@str.5 = [6 x i8] c"Arr2:\00"
define i32 @main() {
%1 = tail call i64 @malloc(i32 12)
%2 = inttoptr i64 %1 to float*
%3 = tail call i64 @malloc(i32 12)
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str, i64 0, i64 0), i32 3)
%5 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %2)
%6 = getelementptr inbounds float, float* %2, i64 1
%7 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %6)
%8 = getelementptr inbounds float, float* %2, i64 2
%9 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), float* %8)
%10 = inttoptr i64 %3 to float*
%11 = tail call i32 (...) @getchar()
%12 = load float, float* %2
store float %12, float* %10
%13 = load float, float* %6
%14 = getelementptr inbounds float, float* %10, i64 1
store float %13, float* %14
%15 = load float, float* %8
%16 = getelementptr inbounds float, float* %10, i64 2
store float %15, float* %16
%17 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0))
%18 = load float, float* %2
%19 = fpext float %18 to double
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 1, double %19)
%21 = load float, float* %6
%22 = fpext float %21 to double
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 2, double %22)
%24 = load float, float* %8
%25 = fpext float %24 to double
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 3, double %25)
%27 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @str.5, i64 0, i64 0))
%28 = load float, float* %10
%29 = fpext float %28 to double
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 1, double %29)
%31 = load float, float* %14
%32 = fpext float %31 to double
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 2, double %32)
%34 = load float, float* %16
%35 = fpext float %34 to double
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 3, double %35)
%37 = tail call i32 @free(float* %2)
%38 = tail call i32 @free(float* %10)
ret i32 0
}