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

/* Variables and functions */
int /*<<< orphan*/ gym_sort(int *, int const);
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  int i;
  int times[] = {2, 1, 12, 3, 16, 19, 23};
  const int length = sizeof(times) / sizeof(int);
  gym_sort(times, length);
  for (i = 0; i < length; ++i)
    printf("%i%s ", (times[i] > 12 ? times[i] - 12 : times[i]),
           (times[i] < 12 ? "AM" : "PM"));
  printf("\n");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeca(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xec7(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xec4(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xec2(%rip),%eax
mov    %eax,-0x18(%rbp)
movl   $0x7,-0x34(%rbp)
lea    -0x30(%rbp),%rdi
mov    $0x7,%esi
call   1040 <gym_sort@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0x7,-0x8(%rbp)
jge    11e8 <main+0xc8>
movslq -0x8(%rbp),%rax
cmpl   $0xc,-0x30(%rbp,%rax,4)
jle    11a1 <main+0x81>
movslq -0x8(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
sub    $0xc,%eax
mov    %eax,-0x38(%rbp)
jmp    11ac <main+0x8c>
movslq -0x8(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    %eax,-0x38(%rbp)
mov    -0x38(%rbp),%esi
movslq -0x8(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%ecx
lea    0xe67(%rip),%rdx
lea    0xe5d(%rip),%rax
cmp    $0xc,%ecx
cmovl  %rax,%rdx
lea    0xe49(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1175 <main+0x55>
lea    0xe39(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x20,%rsp
movups 0xecc(%rip),%xmm0
movups %xmm0,0xc(%rsp)
movaps 0xeb4(%rip),%xmm0
movaps %xmm0,(%rsp)
mov    %rsp,%rdi
mov    $0x7,%esi
call   1050 <gym_sort@plt>
mov    (%rsp),%eax
lea    -0xc(%rax),%esi
cmp    $0xd,%eax
cmovl  %eax,%esi
cmp    $0xc,%eax
lea    0xeaf(%rip),%r15
lea    0xeab(%rip),%rbx
mov    %rbx,%rdx
cmovl  %r15,%rdx
lea    0xe94(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%eax
lea    -0xc(%rax),%esi
cmp    $0xd,%eax
cmovl  %eax,%esi
cmp    $0xc,%eax
mov    %rbx,%rdx
cmovl  %r15,%rdx
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x8(%rsp),%eax
lea    -0xc(%rax),%esi
cmp    $0xd,%eax
cmovl  %eax,%esi
cmp    $0xc,%eax
mov    %rbx,%rdx
cmovl  %r15,%rdx
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%eax
lea    -0xc(%rax),%esi
cmp    $0xd,%eax
cmovl  %eax,%esi
cmp    $0xc,%eax
mov    %rbx,%rdx
cmovl  %r15,%rdx
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rsp),%eax
lea    -0xc(%rax),%esi
cmp    $0xd,%eax
cmovl  %eax,%esi
cmp    $0xc,%eax
mov    %rbx,%rdx
cmovl  %r15,%rdx
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x14(%rsp),%eax
lea    -0xc(%rax),%esi
cmp    $0xd,%eax
cmovl  %eax,%esi
cmp    $0xc,%eax
mov    %rbx,%rdx
cmovl  %r15,%rdx
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x18(%rsp),%eax
lea    -0xc(%rax),%esi
cmp    $0xd,%eax
cmovl  %eax,%esi
cmp    $0xc,%eax
cmovl  %r15,%rbx
mov    %r14,%rdi
mov    %rbx,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.times = [7 x i32] [i32 2, i32 1, i32 12, i32 3, i32 16, i32 19, i32 23]
@.str = [6 x i8] c"%i%s \00"
@.str.1 = [3 x i8] c"AM\00"
@.str.2 = [3 x i8] c"PM\00"
@.str.3 = [2 x i8] c"\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [7 x i32]
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [7 x i32]* %3 to i8*
store i32 7, i32* %4
%6 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 0
%7 = call i32 @gym_sort(i32* %6, i32 7)
store i32 0, i32* %2
br label %8
8: ; preds = %38, %0
%9 = load i32, i32* %2
%10 = icmp slt i32 %9, 7
br i1 %10, label %11, label %41
11: ; preds = %8
%12 = load i32, i32* %2
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 %13
%15 = load i32, i32* %14
%16 = icmp sgt i32 %15, 12
br i1 %16, label %17, label %23
17: ; preds = %11
%18 = load i32, i32* %2
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 %19
%21 = load i32, i32* %20
%22 = sub nsw i32 %21, 12
br label %28
23: ; preds = %11
%24 = load i32, i32* %2
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 %25
%27 = load i32, i32* %26
br label %28
28: ; preds = %23, %17
%29 = phi i32 [ %22, %17 ], [ %27, %23 ]
%30 = load i32, i32* %2
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds [7 x i32], [7 x i32]* %3, i64 0, i64 %31
%33 = load i32, i32* %32
%34 = icmp slt i32 %33, 12
%35 = zext i1 %34 to i64
%36 = select i1 %34, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %29, i8* %36)
br label %38
38: ; preds = %28
%39 = load i32, i32* %2
%40 = add nsw i32 %39, 1
store i32 %40, i32* %2
br label %8
41: ; preds = %8
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@__const.main.times = [7 x i32] [i32 2, i32 1, i32 12, i32 3, i32 16, i32 19, i32 23]
@.str = [6 x i8] c"%i%s \00"
@.str.1 = [3 x i8] c"AM\00"
@.str.2 = [3 x i8] c"PM\00"
define i32 @main() {
%1 = alloca [7 x i32]
%2 = bitcast [7 x i32]* %1 to i8*
%3 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 0
%4 = call i32 @gym_sort(i32* %3, i32 7)
%5 = load i32, i32* %3
%6 = icmp sgt i32 %5, 12
%7 = add nsw i32 %5, -12
%8 = select i1 %6, i32 %7, i32 %5
%9 = icmp slt i32 %5, 12
%10 = select i1 %9, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%11 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %8, i8* %10)
%12 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 1
%13 = load i32, i32* %12
%14 = icmp sgt i32 %13, 12
%15 = add nsw i32 %13, -12
%16 = select i1 %14, i32 %15, i32 %13
%17 = icmp slt i32 %13, 12
%18 = select i1 %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %16, i8* %18)
%20 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 2
%21 = load i32, i32* %20
%22 = icmp sgt i32 %21, 12
%23 = add nsw i32 %21, -12
%24 = select i1 %22, i32 %23, i32 %21
%25 = icmp slt i32 %21, 12
%26 = select i1 %25, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%27 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %24, i8* %26)
%28 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 3
%29 = load i32, i32* %28
%30 = icmp sgt i32 %29, 12
%31 = add nsw i32 %29, -12
%32 = select i1 %30, i32 %31, i32 %29
%33 = icmp slt i32 %29, 12
%34 = select i1 %33, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %32, i8* %34)
%36 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 4
%37 = load i32, i32* %36
%38 = icmp sgt i32 %37, 12
%39 = add nsw i32 %37, -12
%40 = select i1 %38, i32 %39, i32 %37
%41 = icmp slt i32 %37, 12
%42 = select i1 %41, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%43 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %40, i8* %42)
%44 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 5
%45 = load i32, i32* %44
%46 = icmp sgt i32 %45, 12
%47 = add nsw i32 %45, -12
%48 = select i1 %46, i32 %47, i32 %45
%49 = icmp slt i32 %45, 12
%50 = select i1 %49, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%51 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %48, i8* %50)
%52 = getelementptr inbounds [7 x i32], [7 x i32]* %1, i64 0, i64 6
%53 = load i32, i32* %52
%54 = icmp sgt i32 %53, 12
%55 = add nsw i32 %53, -12
%56 = select i1 %54, i32 %55, i32 %53
%57 = icmp slt i32 %53, 12
%58 = select i1 %57, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0)
%59 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %56, i8* %58)
%60 = call i32 @putchar(i32 10)
ret i32 0
}