#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 solution(int *, int);
int main() {
  int a[] = {3, 1, 2, 4, 3};
  printf("1: %d\n", solution(a, 5));
  int b[] = {-1000, 1000};
  printf("2: %d\n", solution(b, 2));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xec5(%rip),%eax
mov    %eax,-0x10(%rbp)
lea    -0x20(%rbp),%rdi
mov    $0x5,%esi
call   1030 <solution@plt>
mov    %eax,%esi
lea    0xeaf(%rip),%rdi
call   1040 <printf@plt>
mov    0xeb3(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    -0x28(%rbp),%rdi
mov    $0x2,%esi
call   1030 <solution@plt>
mov    %eax,%esi
lea    0xe8f(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
mov    0xee6(%rip),%eax
mov    %eax,0x20(%rsp)
movaps 0xecb(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
lea    0x10(%rsp),%rdi
mov    $0x5,%esi
call   1030 <solution@plt>
lea    0xec4(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
movabs $0x3e8fffffc18,%rax
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rdi
mov    $0x2,%esi
call   1030 <solution@plt>
lea    0xe9f(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.a = [5 x i32] [i32 3, i32 1, i32 2, i32 4, i32 3]
@.str = [7 x i8] c"1: %d\0A\00"
@__const.main.b = [2 x i32] [i32 -1000, i32 1000]
@.str.1 = [7 x i8] c"2: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i32]
%3 = alloca [2 x i32]
store i32 0, i32* %1
%4 = bitcast [5 x i32]* %2 to i8*
%5 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%6 = call i32 @solution(i32* %5, i32 5)
%7 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = bitcast [2 x i32]* %3 to i8*
%9 = getelementptr inbounds [2 x i32], [2 x i32]* %3, i64 0, i64 0
%10 = call i32 @solution(i32* %9, i32 2)
%11 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %10)
ret i32 0
}

LLVM IR (-O2):
@__const.main.a = [5 x i32] [i32 3, i32 1, i32 2, i32 4, i32 3]
@.str = [7 x i8] c"1: %d\0A\00"
@.str.1 = [7 x i8] c"2: %d\0A\00"
define i32 @main() {
%1 = alloca [5 x i32]
%2 = alloca i64
%3 = bitcast [5 x i32]* %1 to i8*
%4 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%5 = call i32 @solution(i32* %4, i32 5)
%6 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %5)
%7 = bitcast i64* %2 to i8*
store i64 4299262262296, i64* %2
%8 = bitcast i64* %2 to i32*
%9 = call i32 @solution(i32* %8, i32 2)
%10 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0), i32 %9)
ret i32 0
}