#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*/ linspace(double *, int, int, int);
int /*<<< orphan*/ printf(char *, double);
int main(void) {
  int n = 10;
  double grid[n];
  linspace(grid, 1, 2, n);
  int i;
  for (i = 0; i < n; i++) {
    printf("%g\n", grid[i]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xa,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x10(%rbp)
lea    0xf(,%rax,8),%rcx
and    $0xfffffffffffffff0,%rcx
mov    %rsp,%rdi
sub    %rcx,%rdi
mov    %rdi,-0x28(%rbp)
mov    %rdi,%rsp
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%ecx
mov    $0x1,%esi
mov    $0x2,%edx
call   1040 <linspace@plt>
movl   $0x0,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x8(%rbp),%eax
jge    11a9 <main+0x89>
mov    -0x28(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm0
lea    0xe6a(%rip),%rdi
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1176 <main+0x56>
movl   $0x0,-0x4(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x50,%rsp
mov    %rsp,%rdi
mov    $0x1,%esi
mov    $0x2,%edx
mov    $0xa,%ecx
call   1040 <linspace@plt>
movsd  (%rsp),%xmm0
lea    0xeb8(%rip),%rbx
mov    %rbx,%rdi
call   1030 <printf@plt>
movsd  0x8(%rsp),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movsd  0x10(%rsp),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movsd  0x18(%rsp),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movsd  0x20(%rsp),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movsd  0x28(%rsp),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movsd  0x30(%rsp),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movsd  0x38(%rsp),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movsd  0x40(%rsp),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
movsd  0x48(%rsp),%xmm0
mov    %rbx,%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x50,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [4 x i8] c"%g\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i32
store i32 0, i32* %1
store i32 10, i32* %2
%6 = load i32, i32* %2
%7 = zext i32 %6 to i64
%8 = call i8* @llvm.stacksave()
store i8* %8, i8** %3
%9 = alloca double, i64 %7
store i64 %7, i64* %4
%10 = load i32, i32* %2
%11 = call i32 @linspace(double* %9, i32 1, i32 2, i32 %10)
store i32 0, i32* %5
br label %12
12: ; preds = %22, %0
%13 = load i32, i32* %5
%14 = load i32, i32* %2
%15 = icmp slt i32 %13, %14
br i1 %15, label %16, label %25
16: ; preds = %12
%17 = load i32, i32* %5
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds double, double* %9, i64 %18
%20 = load double, double* %19
%21 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %20)
br label %22
22: ; preds = %16
%23 = load i32, i32* %5
%24 = add nsw i32 %23, 1
store i32 %24, i32* %5
br label %12
25: ; preds = %12
store i32 0, i32* %1
%26 = load i8*, i8** %3
%27 = load i32, i32* %1
ret i32 %27
}

LLVM IR (-O2):
@.str = [4 x i8] c"%g\0A\00"
define i32 @main() {
%1 = alloca [10 x double]
%2 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 0, i64 0
%3 = call i32 @linspace(double* %2, i32 1, i32 2, i32 10)
%4 = load double, double* %2
%5 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %4)
%6 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 0, i64 1
%7 = load double, double* %6
%8 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %7)
%9 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 0, i64 2
%10 = load double, double* %9
%11 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %10)
%12 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 0, i64 3
%13 = load double, double* %12
%14 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %13)
%15 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 0, i64 4
%16 = load double, double* %15
%17 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %16)
%18 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 0, i64 5
%19 = load double, double* %18
%20 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %19)
%21 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 0, i64 6
%22 = load double, double* %21
%23 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %22)
%24 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 0, i64 7
%25 = load double, double* %24
%26 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %25)
%27 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 0, i64 8
%28 = load double, double* %27
%29 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %28)
%30 = getelementptr inbounds [10 x double], [10 x double]* %1, i64 0, i64 9
%31 = load double, double* %30
%32 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), double %31)
ret i32 0
}