#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*/ printf(char *, int);
int randomizer(int, int);
void generator(int spec[]) {
  int i;
  for (i = 0; i < 2; i++) {
    printf("Arguments: %d\n", spec[i]);
  }
  int knapSack = randomizer(spec[0], spec[1]);
  printf("Randomized knapsnack cpacity: %d\n", knapSack);
}


x86 assembly (clang, -O0):
<generator>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x2,-0xc(%rbp)
jge    1162 <generator+0x42>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%esi
lea    0xeb1(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1133 <generator+0x13>
mov    -0x8(%rbp),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%esi
call   1040 <randomizer@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe8e(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generator>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdi),%esi
lea    0xed0(%rip),%r14
mov    %r14,%rdi
call   1030 <printf@plt>
mov    0x4(%rbx),%esi
mov    %r14,%rdi
call   1030 <printf@plt>
mov    (%rbx),%edi
mov    0x4(%rbx),%esi
call   1040 <randomizer@plt>
lea    0xebb(%rip),%rdi
mov    %eax,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [15 x i8] c"Arguments: %d\0A\00"
@.str.1 = [34 x i8] c"Randomized knapsnack cpacity: %d\0A\00"
define void @generator(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %2)
%4 = getelementptr inbounds i32, i32* %0, i64 1
%5 = load i32, i32* %4
%6 = tail call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = load i32, i32* %0
%8 = load i32, i32* %4
%9 = tail call i32 @randomizer(i32 %7, i32 %8)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 %9)
ret void
}