#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*/ c;

/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ optimize(int *, int);
int main(void) {
  {
    int c[] = {50, 10, 40, 30, 5};
    int N = sizeof(c) / sizeof(c[0]);
    optimize(c, N);
  }
  {
    int c[] = {10, 20, 1, 40, 5, 30, 15};
    int N = sizeof(c) / sizeof(c[0]);
    optimize(c, N);
  }
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeda(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xed7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xed5(%rip),%eax
mov    %eax,-0x10(%rbp)
movl   $0x5,-0x24(%rbp)
lea    -0x20(%rbp),%rdi
mov    -0x24(%rbp),%esi
call   1030 <optimize@plt>
mov    0xec8(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xec5(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xec2(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xec0(%rip),%eax
mov    %eax,-0x28(%rbp)
movl   $0x7,-0x44(%rbp)
lea    -0x40(%rbp),%rdi
mov    -0x44(%rbp),%esi
call   1030 <optimize@plt>
mov    0x2e4b(%rip),%rax
mov    (%rax),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x28,%rsp
mov    0xef6(%rip),%eax
mov    %eax,0x10(%rsp)
movaps 0xedb(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x5,%esi
call   1030 <optimize@plt>
movups 0xeef(%rip),%xmm0
movups %xmm0,0xc(%rsp)
movaps 0xed7(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x7,%esi
call   1030 <optimize@plt>
mov    0x2e7f(%rip),%rax
mov    (%rax),%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.main.c = [5 x i32] [i32 50, i32 10, i32 40, i32 30, i32 5]
@__const.main.c.1 = [7 x i32] [i32 10, i32 20, i32 1, i32 40, i32 5, i32 30, i32 15]
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i32]
%3 = alloca i32
%4 = alloca [7 x i32]
%5 = alloca i32
store i32 0, i32* %1
%6 = bitcast [5 x i32]* %2 to i8*
store i32 5, i32* %3
%7 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%8 = load i32, i32* %3
%9 = call i32 @optimize(i32* %7, i32 %8)
%10 = bitcast [7 x i32]* %4 to i8*
store i32 7, i32* %5
%11 = getelementptr inbounds [7 x i32], [7 x i32]* %4, i64 0, i64 0
%12 = load i32, i32* %5
%13 = call i32 @optimize(i32* %11, i32 %12)
%14 = load i32, i32* @EXIT_SUCCESS
ret i32 %14
}

LLVM IR (-O2):
@__const.main.c = [5 x i32] [i32 50, i32 10, i32 40, i32 30, i32 5]
@__const.main.c.1 = [7 x i32] [i32 10, i32 20, i32 1, i32 40, i32 5, i32 30, i32 15]
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca [5 x i32]
%2 = alloca [7 x i32]
%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 @optimize(i32* %4, i32 5)
%6 = bitcast [7 x i32]* %2 to i8*
%7 = getelementptr inbounds [7 x i32], [7 x i32]* %2, i64 0, i64 0
%8 = call i32 @optimize(i32* %7, i32 7)
%9 = load i32, i32* @EXIT_SUCCESS
ret i32 %9
}