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


x86 assembly (clang, -O0):
<test_split_n_sort_two_elements>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    -0x8(%rbp),%rdi
mov    $0x2,%esi
call   1030 <split_n_sort@plt>
cmpl   $0x1,-0x8(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%esi
lea    0xeb4(%rip),%rdi
call   1040 <mu_assert@plt>
cmpl   $0x2,-0x4(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%esi
lea    0xeab(%rip),%rdi
call   1040 <mu_assert@plt>
xor    %eax,%eax
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    %esi,%esi
cmpl   $0x1,(%rsp)
sete   %sil
lea    0xeb3(%rip),%rdi
call   1040 <mu_assert@plt>
xor    %esi,%esi
cmpl   $0x2,0x4(%rsp)
sete   %sil
lea    0xeab(%rip),%rdi
call   1040 <mu_assert@plt>
xor    %eax,%eax
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 [2 x i32]
%2 = bitcast [2 x i32]* %1 to i8*
%3 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 0
%4 = call i32 @split_n_sort(i32* %3, i32 2)
%5 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 0
%6 = load i32, i32* %5
%7 = icmp eq i32 %6, 1
%8 = zext i1 %7 to i32
%9 = call i32 @mu_assert(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %8)
%10 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 1
%11 = load i32, i32* %10
%12 = icmp eq i32 %11, 2
%13 = zext i1 %12 to i32
%14 = call i32 @mu_assert(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0), i32 %13)
ret i8* null
}

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