#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 */
typedef int /*<<< orphan*/ b;

/* Variables and functions */
int /*<<< orphan*/ getpid();
int /*<<< orphan*/ printf(char *, ...);
int rand();
int /*<<< orphan*/ srand(int /*<<< orphan*/);
main() {
  char a[8] = {'a', 'b', 'c', 'd'};
  int b[10];
  int n, index;
  n = (sizeof(b) / sizeof b[0]);
  srand(getpid());
  for (index = 0; index < n; index++)
    b[index] = rand() % 30 - 60;
  printf("You have supplied: ");
  for (index = 0; index < n; index++)
    printf("%d ", b[index]);
  printf("\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeaa(%rip),%rax
mov    %rax,-0xc(%rbp)
movl   $0xa,-0x44(%rbp)
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%edi
call   1050 <srand@plt>
movl   $0x0,-0x48(%rbp)
mov    -0x48(%rbp),%eax
cmp    -0x44(%rbp),%eax
jge    11aa <main+0x6a>
mov    $0x0,%al
call   1060 <rand@plt>
mov    $0x1e,%ecx
cltd
idiv   %ecx
sub    $0x3c,%edx
movslq -0x48(%rbp),%rax
mov    %edx,-0x40(%rbp,%rax,4)
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    1176 <main+0x36>
lea    0xe57(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x48(%rbp)
mov    -0x48(%rbp),%eax
cmp    -0x44(%rbp),%eax
jge    11ef <main+0xaf>
movslq -0x48(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%esi
lea    0xe42(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    11bf <main+0x7f>
lea    0xe2a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %eax,%edi
call   1060 <srand@plt>
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0xffffffff88888889,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x4,%ecx
add    %edx,%ecx
mov    %ecx,%edx
shl    $0x5,%edx
mov    %ecx,%esi
sub    %edx,%esi
add    %ecx,%esi
add    %esi,%eax
add    $0xffffffc4,%eax
mov    %eax,0x14(%rsp)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0xffffffff88888889,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x4,%ecx
add    %edx,%ecx
mov    %ecx,%edx
shl    $0x5,%edx
mov    %ecx,%esi
sub    %edx,%esi
add    %ecx,%esi
add    %esi,%eax
add    $0xffffffc4,%eax
mov    %eax,0x10(%rsp)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0xffffffff88888889,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x4,%ecx
add    %edx,%ecx
mov    %ecx,%edx
shl    $0x5,%edx
mov    %ecx,%esi
sub    %edx,%esi
add    %ecx,%esi
add    %esi,%eax
add    $0xffffffc4,%eax
mov    %eax,0xc(%rsp)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0xffffffff88888889,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x4,%ecx
add    %edx,%ecx
mov    %ecx,%edx
shl    $0x5,%edx
mov    %ecx,%esi
sub    %edx,%esi
add    %ecx,%esi
add    %esi,%eax
add    $0xffffffc4,%eax
mov    %eax,0x8(%rsp)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0xffffffff88888889,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x4,%ecx
add    %edx,%ecx
mov    %ecx,%edx
shl    $0x5,%edx
mov    %ecx,%esi
sub    %edx,%esi
add    %ecx,%esi
add    %esi,%eax
add    $0xffffffc4,%eax
mov    %eax,0x4(%rsp)
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0xffffffff88888889,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x4,%ecx
add    %edx,%ecx
mov    %ecx,%edx
shl    $0x5,%edx
mov    %ecx,%esi
sub    %edx,%esi
add    %ecx,%esi
lea    (%rax,%rsi,1),%ebp
add    $0xffffffc4,%ebp
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0xffffffff88888889,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x4,%ecx
add    %edx,%ecx
mov    %ecx,%edx
shl    $0x5,%edx
mov    %ecx,%esi
sub    %edx,%esi
add    %ecx,%esi
lea    (%rax,%rsi,1),%r14d
add    $0xffffffc4,%r14d
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0xffffffff88888889,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x4,%ecx
add    %edx,%ecx
mov    %ecx,%edx
shl    $0x5,%edx
mov    %ecx,%esi
sub    %edx,%esi
add    %ecx,%esi
lea    (%rax,%rsi,1),%r15d
add    $0xffffffc4,%r15d
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0xffffffff88888889,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x4,%ecx
add    %edx,%ecx
mov    %ecx,%edx
shl    $0x5,%edx
mov    %ecx,%esi
sub    %edx,%esi
add    %ecx,%esi
lea    (%rax,%rsi,1),%r12d
add    $0xffffffc4,%r12d
xor    %eax,%eax
call   1070 <rand@plt>
cltq
imul   $0xffffffff88888889,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x4,%ecx
add    %edx,%ecx
mov    %ecx,%edx
shl    $0x5,%edx
mov    %ecx,%esi
sub    %edx,%esi
add    %ecx,%esi
lea    (%rax,%rsi,1),%r13d
add    $0xffffffc4,%r13d
lea    0xc8c(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xc92(%rip),%rbx
mov    %rbx,%rdi
mov    0x14(%rsp),%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    0x10(%rsp),%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    0xc(%rsp),%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    0x8(%rsp),%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    0x4(%rsp),%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    %r12d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    %r13d,%esi
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.a = [8 x i8] c"abcd\00\00\00\00"
@.str = [20 x i8] c"You have supplied: \00"
@.str.1 = [4 x i8] c"%d \00"
@.str.2 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [8 x i8]
%3 = alloca [10 x i32]
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = bitcast [8 x i8]* %2 to i8*
store i32 10, i32* %4
%7 = call i32 (...) @getpid()
%8 = call i32 @srand(i32 %7)
store i32 0, i32* %5
br label %9
9: ; preds = %20, %0
%10 = load i32, i32* %5
%11 = load i32, i32* %4
%12 = icmp slt i32 %10, %11
br i1 %12, label %13, label %23
13: ; preds = %9
%14 = call i32 (...) @rand()
%15 = srem i32 %14, 30
%16 = sub nsw i32 %15, 60
%17 = load i32, i32* %5
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %18
store i32 %16, i32* %19
br label %20
20: ; preds = %13
%21 = load i32, i32* %5
%22 = add nsw i32 %21, 1
store i32 %22, i32* %5
br label %9
23: ; preds = %9
%24 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %5
br label %25
25: ; preds = %35, %23
%26 = load i32, i32* %5
%27 = load i32, i32* %4
%28 = icmp slt i32 %26, %27
br i1 %28, label %29, label %38
29: ; preds = %25
%30 = load i32, i32* %5
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [10 x i32], [10 x i32]* %3, i64 0, i64 %31
%33 = load i32, i32* %32
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %33)
br label %35
35: ; preds = %29
%36 = load i32, i32* %5
%37 = add nsw i32 %36, 1
store i32 %37, i32* %5
br label %25
38: ; preds = %25
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%40 = load i32, i32* %1
ret i32 %40
}

LLVM IR (-O2):
@.str = [20 x i8] c"You have supplied: \00"
@.str.1 = [4 x i8] c"%d \00"
define i32 @main() {
%1 = tail call i32 (...) @getpid()
%2 = tail call i32 @srand(i32 %1)
%3 = tail call i32 (...) @rand()
%4 = srem i32 %3, 30
%5 = add nsw i32 %4, -60
%6 = tail call i32 (...) @rand()
%7 = srem i32 %6, 30
%8 = add nsw i32 %7, -60
%9 = tail call i32 (...) @rand()
%10 = srem i32 %9, 30
%11 = add nsw i32 %10, -60
%12 = tail call i32 (...) @rand()
%13 = srem i32 %12, 30
%14 = add nsw i32 %13, -60
%15 = tail call i32 (...) @rand()
%16 = srem i32 %15, 30
%17 = add nsw i32 %16, -60
%18 = tail call i32 (...) @rand()
%19 = srem i32 %18, 30
%20 = add nsw i32 %19, -60
%21 = tail call i32 (...) @rand()
%22 = srem i32 %21, 30
%23 = add nsw i32 %22, -60
%24 = tail call i32 (...) @rand()
%25 = srem i32 %24, 30
%26 = add nsw i32 %25, -60
%27 = tail call i32 (...) @rand()
%28 = srem i32 %27, 30
%29 = add nsw i32 %28, -60
%30 = tail call i32 (...) @rand()
%31 = srem i32 %30, 30
%32 = add nsw i32 %31, -60
%33 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
%34 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %5)
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %8)
%36 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %11)
%37 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %17)
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %20)
%40 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %23)
%41 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %26)
%42 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %29)
%43 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %32)
%44 = tail call i32 @putchar(i32 10)
ret i32 0
}