#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 min_switch_v2(int *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char const *argv[]) {
  int case1[] = {12, 6, 6, 6, 6, 6, 12, 12, 12, 12, 12, 12, 12, 12, 12, 12};
  int case2[] = {12, 9, 3, 12, 6, 6, 9, 3, 12, 9, 12, 9, 12, 12, 6, 6};
  printf("%d\n", min_switch_v2(case1, 0));
  printf("%d\n", min_switch_v2(case2, 0));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x50(%rbp),%rdi
lea    0xeac(%rip),%rsi
mov    $0x40,%edx
call   1040 <memcpy@plt>
lea    -0x90(%rbp),%rdi
lea    0xed4(%rip),%rsi
mov    $0x40,%edx
call   1040 <memcpy@plt>
lea    -0x50(%rbp),%rdi
xor    %esi,%esi
call   1050 <min_switch_v2@plt>
mov    %eax,%esi
lea    0xef6(%rip),%rdi
call   1030 <printf@plt>
lea    -0x90(%rbp),%rdi
xor    %esi,%esi
call   1050 <min_switch_v2@plt>
mov    %eax,%esi
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x80,%rsp
movaps 0xf01(%rip),%xmm0
movaps %xmm0,0x70(%rsp)
movaps 0xee5(%rip),%xmm0
movaps %xmm0,0x60(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,0x50(%rsp)
movaps 0xead(%rip),%xmm0
movaps %xmm0,0x40(%rsp)
movaps 0xf11(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xef5(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
movaps 0xed9(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xebd(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x40(%rsp),%rdi
xor    %esi,%esi
call   1040 <min_switch_v2@plt>
lea    0xee6(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %rsp,%rdi
xor    %esi,%esi
call   1040 <min_switch_v2@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.case1 = [16 x i32] [i32 12, i32 6, i32 6, i32 6, i32 6, i32 6, i32 12, i32 12, i32 12, i32 12, i32 12, i32 12, i32 12, i32 12, i32 12, i32 12]
@__const.main.case2 = [16 x i32] [i32 12, i32 9, i32 3, i32 12, i32 6, i32 6, i32 9, i32 3, i32 12, i32 9, i32 12, i32 9, i32 12, i32 12, i32 6, i32 6]
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [16 x i32]
%7 = alloca [16 x i32]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = bitcast [16 x i32]* %6 to i8*
%9 = bitcast [16 x i32]* %7 to i8*
%10 = getelementptr inbounds [16 x i32], [16 x i32]* %6, i64 0, i64 0
%11 = call i32 @min_switch_v2(i32* %10, i32 0)
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = getelementptr inbounds [16 x i32], [16 x i32]* %7, i64 0, i64 0
%14 = call i32 @min_switch_v2(i32* %13, i32 0)
%15 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %14)
ret i32 0
}

LLVM IR (-O2):
@__const.main.case1 = [16 x i32] [i32 12, i32 6, i32 6, i32 6, i32 6, i32 6, i32 12, i32 12, i32 12, i32 12, i32 12, i32 12, i32 12, i32 12, i32 12, i32 12]
@__const.main.case2 = [16 x i32] [i32 12, i32 9, i32 3, i32 12, i32 6, i32 6, i32 9, i32 3, i32 12, i32 9, i32 12, i32 9, i32 12, i32 12, i32 6, i32 6]
@.str = [4 x i8] c"%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [16 x i32]
%4 = alloca [16 x i32]
%5 = bitcast [16 x i32]* %3 to i8*
%6 = bitcast [16 x i32]* %4 to i8*
%7 = getelementptr inbounds [16 x i32], [16 x i32]* %3, i64 0, i64 0
%8 = call i32 @min_switch_v2(i32* %7, i32 0)
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = getelementptr inbounds [16 x i32], [16 x i32]* %4, i64 0, i64 0
%11 = call i32 @min_switch_v2(i32* %10, i32 0)
%12 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i32 %11)
ret i32 0
}