#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*/ abort();
int /*<<< orphan*/ scale(long *, long *, int);
int main(void) {
  int i;
  long x[10];
  long alpha = 2;
  for (i = 0; i < 10; i++)
    x[i] = i;
  scale(&alpha, x, 5);
  if (x[9] != 18)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x70,%rsp
movl   $0x0,-0x4(%rbp)
movq   $0x2,-0x68(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    1163 <main+0x43>
movslq -0x8(%rbp),%rcx
movslq -0x8(%rbp),%rax
mov    %rcx,-0x60(%rbp,%rax,8)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    113e <main+0x1e>
lea    -0x60(%rbp),%rsi
lea    -0x68(%rbp),%rdi
mov    $0x5,%edx
call   1040 <scale@plt>
cmpq   $0x12,-0x18(%rbp)
je     1187 <main+0x67>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x68,%rsp
movq   $0x2,0x8(%rsp)
movaps 0xecc(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xed0(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xed4(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xed8(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xedc(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
lea    0x8(%rsp),%rdi
lea    0x10(%rsp),%rsi
mov    $0x5,%edx
call   1040 <scale@plt>
cmpq   $0x12,0x58(%rsp)
jne    118c <main+0x6c>
xor    %eax,%eax
add    $0x68,%rsp
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [10 x i64]
%4 = alloca i64
store i32 0, i32* %1
store i64 2, i64* %4
store i32 0, i32* %2
br label %5
5: ; preds = %14, %0
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 10
br i1 %7, label %8, label %17
8: ; preds = %5
%9 = load i32, i32* %2
%10 = sext i32 %9 to i64
%11 = load i32, i32* %2
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [10 x i64], [10 x i64]* %3, i64 0, i64 %12
store i64 %10, i64* %13
br label %14
14: ; preds = %8
%15 = load i32, i32* %2
%16 = add nsw i32 %15, 1
store i32 %16, i32* %2
br label %5
17: ; preds = %5
%18 = getelementptr inbounds [10 x i64], [10 x i64]* %3, i64 0, i64 0
%19 = call i32 @scale(i64* %4, i64* %18, i32 5)
%20 = getelementptr inbounds [10 x i64], [10 x i64]* %3, i64 0, i64 9
%21 = load i64, i64* %20
%22 = icmp ne i64 %21, 18
br i1 %22, label %23, label %25
23: ; preds = %17
%24 = call i32 (...) @abort()
unreachable
25: ; preds = %17
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = alloca [10 x i64]
%2 = alloca i64
%3 = bitcast [10 x i64]* %1 to i8*
%4 = bitcast i64* %2 to i8*
store i64 2, i64* %2
%5 = getelementptr inbounds [10 x i64], [10 x i64]* %1, i64 0, i64 0
%6 = bitcast [10 x i64]* %1 to <2 x i64>*
store <2 x i64> <i64 0, i64 1>, <2 x i64>* %6
%7 = getelementptr inbounds [10 x i64], [10 x i64]* %1, i64 0, i64 2
%8 = bitcast i64* %7 to <2 x i64>*
store <2 x i64> <i64 2, i64 3>, <2 x i64>* %8
%9 = getelementptr inbounds [10 x i64], [10 x i64]* %1, i64 0, i64 4
%10 = bitcast i64* %9 to <2 x i64>*
store <2 x i64> <i64 4, i64 5>, <2 x i64>* %10
%11 = getelementptr inbounds [10 x i64], [10 x i64]* %1, i64 0, i64 6
%12 = bitcast i64* %11 to <2 x i64>*
store <2 x i64> <i64 6, i64 7>, <2 x i64>* %12
%13 = getelementptr inbounds [10 x i64], [10 x i64]* %1, i64 0, i64 8
%14 = getelementptr inbounds [10 x i64], [10 x i64]* %1, i64 0, i64 9
%15 = bitcast i64* %13 to <2 x i64>*
store <2 x i64> <i64 8, i64 9>, <2 x i64>* %15
%16 = call i32 @scale(i64* %2, i64* %5, i32 5)
%17 = load i64, i64* %14
%18 = icmp eq i64 %17, 18
br i1 %18, label %21, label %19
19: ; preds = %0
%20 = call i32 (...) @abort()
unreachable
21: ; preds = %0
ret i32 0
}