#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 /*<<< orphan*/ scanf(char *, int *);
int /*<<< orphan*/ test(int, int, int);
int main() {
  int *a;
  int i, size, max;
  printf("Enter size of array: \n");
  scanf("%d", &size);
  printf("\n");
  printf("Enter max range of array: \n");
  scanf("%d", &max);
  printf("\n");
  test(size, max, 1);
  test(size, max, 2);
  test(size, max, 3);
  test(size, max, 4);
  test(size, max, 5);
  test(size, max, 6);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
lea    0xec5(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xed2(%rip),%rdi
call   1030 <printf@plt>
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
lea    0xe9d(%rip),%rdi
lea    -0x1c(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
mov    -0x18(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    $0x1,%edx
call   1050 <test@plt>
mov    -0x18(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    $0x2,%edx
call   1050 <test@plt>
mov    -0x18(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    $0x3,%edx
call   1050 <test@plt>
mov    -0x18(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    $0x4,%edx
call   1050 <test@plt>
mov    -0x18(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    $0x5,%edx
call   1050 <test@plt>
mov    -0x18(%rbp),%edi
mov    -0x1c(%rbp),%esi
mov    $0x6,%edx
call   1050 <test@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xeb7(%rip),%rdi
call   1040 <puts@plt>
lea    0xea8(%rip),%rbx
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xea3(%rip),%rdi
call   1040 <puts@plt>
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
mov    $0x1,%edx
call   1060 <test@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
mov    $0x2,%edx
call   1060 <test@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
mov    $0x3,%edx
call   1060 <test@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
mov    $0x4,%edx
call   1060 <test@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
mov    $0x5,%edx
call   1060 <test@plt>
mov    0xc(%rsp),%edi
mov    0x8(%rsp),%esi
mov    $0x6,%edx
call   1060 <test@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Enter size of array: \0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [28 x i8] c"Enter max range of array: \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
%6 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%8 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%9 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.3, i64 0, i64 0))
%10 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%11 = call i32 @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%12 = load i32, i32* %4
%13 = load i32, i32* %5
%14 = call i32 @test(i32 %12, i32 %13, i32 1)
%15 = load i32, i32* %4
%16 = load i32, i32* %5
%17 = call i32 @test(i32 %15, i32 %16, i32 2)
%18 = load i32, i32* %4
%19 = load i32, i32* %5
%20 = call i32 @test(i32 %18, i32 %19, i32 3)
%21 = load i32, i32* %4
%22 = load i32, i32* %5
%23 = call i32 @test(i32 %21, i32 %22, i32 4)
%24 = load i32, i32* %4
%25 = load i32, i32* %5
%26 = call i32 @test(i32 %24, i32 %25, i32 5)
%27 = load i32, i32* %4
%28 = load i32, i32* %5
%29 = call i32 @test(i32 %27, i32 %28, i32 6)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@str = [22 x i8] c"Enter size of array: \00"
@str.4 = [27 x i8] c"Enter max range of array: \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = call i32 @putchar(i32 10)
%8 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @str.4, i64 0, i64 0))
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%10 = call i32 @putchar(i32 10)
%11 = load i32, i32* %1
%12 = load i32, i32* %2
%13 = call i32 @test(i32 %11, i32 %12, i32 1)
%14 = load i32, i32* %1
%15 = load i32, i32* %2
%16 = call i32 @test(i32 %14, i32 %15, i32 2)
%17 = load i32, i32* %1
%18 = load i32, i32* %2
%19 = call i32 @test(i32 %17, i32 %18, i32 3)
%20 = load i32, i32* %1
%21 = load i32, i32* %2
%22 = call i32 @test(i32 %20, i32 %21, i32 4)
%23 = load i32, i32* %1
%24 = load i32, i32* %2
%25 = call i32 @test(i32 %23, i32 %24, i32 5)
%26 = load i32, i32* %1
%27 = load i32, i32* %2
%28 = call i32 @test(i32 %26, i32 %27, i32 6)
ret i32 0
}