#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 numstr_part(char **, int *, int, int, int);
void numstr_rec_sort(char **strs, int *nums, int left, int right) {
  if (right > left) {
    int mid = (left + right) / 2;
    mid = numstr_part(strs, nums, left, mid, right);
    numstr_rec_sort(strs, nums, left, mid - 1);
    numstr_rec_sort(strs, nums, mid + 1, right);
  }
}


x86 assembly (clang, -O0):
<numstr_rec_sort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %ecx,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jle    1199 <numstr_rec_sort+0x79>
mov    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x1c(%rbp),%ecx
mov    -0x18(%rbp),%r8d
call   1030 <numstr_part@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x1c(%rbp),%ecx
sub    $0x1,%ecx
call   1040 <numstr_rec_sort@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x1c(%rbp),%edx
add    $0x1,%edx
mov    -0x18(%rbp),%ecx
call   1040 <numstr_rec_sort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<numstr_rec_sort>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
cmp    %edx,%ecx
jle    117c <numstr_rec_sort+0x5c>
mov    %ecx,%r12d
mov    %edx,%r13d
mov    %rsi,%r14
mov    %rdi,%r15
nopl   0x0(%rax)
lea    (%r12,%r13,1),%eax
mov    %eax,%ecx
shr    $0x1f,%ecx
add    %eax,%ecx
sar    %ecx
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r13d,%edx
mov    %r12d,%r8d
call   1030 <numstr_part@plt>
mov    %eax,%ebx
lea    -0x1(%rbx),%ecx
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r13d,%edx
call   1040 <numstr_rec_sort@plt>
add    $0x1,%ebx
mov    %ebx,%r13d
cmp    %r12d,%ebx
jl     1140 <numstr_rec_sort+0x20>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define void @numstr_rec_sort(i8** %0, i32* %1, i32 %2, i32 %3) {
%5 = alloca i8**
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i8** %0, i8*** %5
store i32* %1, i32** %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = load i32, i32* %8
%11 = load i32, i32* %7
%12 = icmp sgt i32 %10, %11
br i1 %12, label %13, label %34
13: ; preds = %4
%14 = load i32, i32* %7
%15 = load i32, i32* %8
%16 = add nsw i32 %14, %15
%17 = sdiv i32 %16, 2
store i32 %17, i32* %9
%18 = load i8**, i8*** %5
%19 = load i32*, i32** %6
%20 = load i32, i32* %7
%21 = load i32, i32* %9
%22 = load i32, i32* %8
%23 = call i32 @numstr_part(i8** %18, i32* %19, i32 %20, i32 %21, i32 %22)
store i32 %23, i32* %9
%24 = load i8**, i8*** %5
%25 = load i32*, i32** %6
%26 = load i32, i32* %7
%27 = load i32, i32* %9
%28 = sub nsw i32 %27, 1
%29 = load i8**, i8*** %5
%30 = load i32*, i32** %6
%31 = load i32, i32* %9
%32 = add nsw i32 %31, 1
%33 = load i32, i32* %8
br label %34
34: ; preds = %13, %4
ret void
}

LLVM IR (-O2):
define void @numstr_rec_sort(i8** %0, i32* %1, i32 %2, i32 %3) {
%5 = icmp sgt i32 %3, %2
br i1 %5, label %6, label %14
6: ; preds = %4, %6
%7 = phi i32 [ %12, %6 ], [ %2, %4 ]
%8 = add nsw i32 %7, %3
%9 = sdiv i32 %8, 2
%10 = tail call i32 @numstr_part(i8** %0, i32* %1, i32 %7, i32 %9, i32 %3)
%11 = add nsw i32 %10, -1
tail call void @numstr_rec_sort(i8** %0, i32* %1, i32 %7, i32 %11)
%12 = add nsw i32 %10, 1
%13 = icmp slt i32 %12, %3
br i1 %13, label %6, label %14
14: ; preds = %6, %4
ret void
}