#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*/ ellpack(double *, int *, double *, double *);
int /*<<< orphan*/ fillVal(double *, int *, double *);
int /*<<< orphan*/ initOut(double *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ srand48(long);
int main() {
  int colind[494 * 10];
  double nzval[494 * 10];
  double x[494];
  double y[494];
  int i;
  srand48(8650341L);
  fillVal(nzval, colind, x);
  initOut(y);
  ellpack(nzval, colind, x, y);
  printf("\n");
  for (i = 0; i < 494; i++) {
    printf("%d ", y[i]);
  }
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10690,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x83fe65,%edi
call   1060 <srand48@plt>
lea    -0xe7a0(%rbp),%rdi
lea    -0x4d40(%rbp),%rsi
lea    -0xf710(%rbp),%rdx
call   1030 <fillVal@plt>
lea    -0x10680(%rbp),%rdi
call   1050 <initOut@plt>
lea    -0xe7a0(%rbp),%rdi
lea    -0x4d40(%rbp),%rsi
lea    -0xf710(%rbp),%rdx
lea    -0x10680(%rbp),%rcx
call   1070 <ellpack@plt>
lea    0xe46(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x10684(%rbp)
cmpl   $0x1ee,-0x10684(%rbp)
jge    120d <main+0xbd>
movslq -0x10684(%rbp),%rax
movsd  -0x10680(%rbp,%rax,8),%xmm0
fe ff
lea    0xe10(%rip),%rdi
mov    $0x1,%al
call   1040 <printf@plt>
mov    -0x10684(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10684(%rbp)
jmp    11cb <main+0x7b>
lea    0xdec(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10690,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x10678,%rsp
mov    $0x83fe65,%edi
call   1070 <srand48@plt>
lea    0x6c10(%rsp),%r12
lea    0x1ee0(%rsp),%r14
lea    0xf70(%rsp),%r15
mov    %r12,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1040 <fillVal@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1060 <initOut@plt>
mov    %r12,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
mov    %rbx,%rcx
call   1080 <ellpack@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %ebx,%ebx
lea    0xe33(%rip),%r14
nopl   (%rax)
movsd  (%rsp,%rbx,8),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
call   1050 <printf@plt>
add    $0x1,%rbx
cmp    $0x1ee,%rbx
jne    11d0 <main+0x70>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x10678,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str.1 = [4 x i8] c"%d \00"
define i32 @main() {
%1 = alloca [4940 x i32]
%2 = alloca [4940 x double]
%3 = alloca [494 x double]
%4 = alloca [494 x double]
%5 = bitcast [4940 x i32]* %1 to i8*
%6 = bitcast [4940 x double]* %2 to i8*
%7 = bitcast [494 x double]* %3 to i8*
%8 = bitcast [494 x double]* %4 to i8*
%9 = tail call i32 @srand48(i64 8650341)
%10 = getelementptr inbounds [4940 x double], [4940 x double]* %2, i64 0, i64 0
%11 = getelementptr inbounds [4940 x i32], [4940 x i32]* %1, i64 0, i64 0
%12 = getelementptr inbounds [494 x double], [494 x double]* %3, i64 0, i64 0
%13 = call i32 @fillVal(double* %10, i32* %11, double* %12)
%14 = getelementptr inbounds [494 x double], [494 x double]* %4, i64 0, i64 0
%15 = call i32 @initOut(double* %14)
%16 = call i32 @ellpack(double* %10, i32* %11, double* %12, double* %14)
%17 = call i32 @putchar(i32 10)
br label %18
18: ; preds = %0, %18
%19 = phi i64 [ 0, %0 ], [ %23, %18 ]
%20 = getelementptr inbounds [494 x double], [494 x double]* %4, i64 0, i64 %19
%21 = load double, double* %20
%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 = add nuw nsw i64 %19, 1
%24 = icmp eq i64 %23, 494
br i1 %24, label %25, label %18
25: ; preds = %18
%26 = call i32 @putchar(i32 10)
ret i32 0
}