#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*/ split_n_sort(int *, int);
char *test_split_n_sort_two_elements() {
  int a[] = {2, 1};
  split_n_sort(a, 2);
  do {
    if (!(a[0] == 1))
      return "sorted[0] != 1";
  } while (0);
  do {
    if (!(a[1] == 2))
      return "sorted[1] != 2";
  } while (0);
  return 0;
}


x86 assembly (clang, -O0):
<test_split_n_sort_two_elements>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xee1(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    -0x10(%rbp),%rdi
mov    $0x2,%esi
call   1030 <split_n_sort@plt>
cmpl   $0x1,-0x10(%rbp)
je     114b <test_split_n_sort_two_elements+0x3b>
lea    0xec6(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    117c <test_split_n_sort_two_elements+0x6c>
jmp    1150 <test_split_n_sort_two_elements+0x40>
jmp    1155 <test_split_n_sort_two_elements+0x45>
cmpl   $0x2,-0xc(%rbp)
je     116f <test_split_n_sort_two_elements+0x5f>
lea    0xeb1(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    117c <test_split_n_sort_two_elements+0x6c>
jmp    1174 <test_split_n_sort_two_elements+0x64>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_split_n_sort_two_elements>:
push   %rax
movabs $0x100000002,%rax
mov    %rax,(%rsp)
mov    %rsp,%rdi
mov    $0x2,%esi
call   1030 <split_n_sort@plt>
xor    %ecx,%ecx
cmpl   $0x2,0x4(%rsp)
lea    0xed5(%rip),%rax
cmovne %rax,%rcx
cmpl   $0x1,(%rsp)
lea    0xeb7(%rip),%rax
cmove  %rcx,%rax
pop    %rcx
ret

LLVM IR (-O0):
@__const.test_split_n_sort_two_elements.a = [2 x i32] [i32 2, i32 1]
@.str = [15 x i8] c"sorted[0] != 1\00"
@.str.1 = [15 x i8] c"sorted[1] != 2\00"
define i8* @test_split_n_sort_two_elements() {
%1 = alloca i8*
%2 = alloca [2 x i32]
%3 = bitcast [2 x i32]* %2 to i8*
%4 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%5 = call i32 @split_n_sort(i32* %4, i32 2)
br label %6
6: ; preds = %0
%7 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%8 = load i32, i32* %7
%9 = icmp eq i32 %8, 1
br i1 %9, label %11, label %10
10: ; preds = %6
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i8** %1
br label %20
11: ; preds = %6
br label %12
12: ; preds = %11
br label %13
13: ; preds = %12
%14 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 1
%15 = load i32, i32* %14
%16 = icmp eq i32 %15, 2
br i1 %16, label %18, label %17
17: ; preds = %13
store i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i8** %1
br label %20
18: ; preds = %13
br label %19
19: ; preds = %18
store i8* null, i8** %1
br label %20
20: ; preds = %19, %17, %10
%21 = load i8*, i8** %1
ret i8* %21
}

LLVM IR (-O2):
@.str = [15 x i8] c"sorted[0] != 1\00"
@.str.1 = [15 x i8] c"sorted[1] != 2\00"
define i8* @test_split_n_sort_two_elements() {
%1 = alloca i64
%2 = bitcast i64* %1 to i8*
store i64 4294967298, i64* %1
%3 = bitcast i64* %1 to i32*
%4 = call i32 @split_n_sort(i32* %3, i32 2)
%5 = load i32, i32* %3
%6 = icmp eq i32 %5, 1
%7 = bitcast i64* %1 to [2 x i32]*
%8 = getelementptr inbounds [2 x i32], [2 x i32]* %7, i64 0, i64 1
%9 = load i32, i32* %8
%10 = icmp eq i32 %9, 2
%11 = select i1 %10, i8* null, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0)
%12 = select i1 %6, i8* %11, i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0)
ret i8* %12
}