#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 findSmallest(int *, int, int *, int);
int /*<<< orphan*/ msort(int *, int /*<<< orphan*/, int);
int /*<<< orphan*/ pr_array(int *, int);
int SortNFind(int a[], int alen, int b[], int blen) {
  msort(a, 0, alen - 1);
  pr_array(a, alen);
  msort(b, 0, blen - 1);
  pr_array(b, blen);
  return findSmallest(a, alen, b, blen);
}


x86 assembly (clang, -O0):
<SortNFind>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
call   1040 <msort@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
call   1030 <pr_array@plt>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%edx
sub    $0x1,%edx
xor    %esi,%esi
call   1040 <msort@plt>
mov    -0x18(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1030 <pr_array@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1050 <findSmallest@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<SortNFind>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %ecx,%r14d
mov    %rdx,%r15
mov    %esi,%r12d
mov    %rdi,%rbx
lea    -0x1(%r12),%edx
xor    %esi,%esi
call   1040 <msort@plt>
mov    %rbx,%rdi
mov    %r12d,%esi
call   1030 <pr_array@plt>
lea    -0x1(%r14),%edx
mov    %r15,%rdi
xor    %esi,%esi
call   1040 <msort@plt>
mov    %r15,%rdi
mov    %r14d,%esi
call   1030 <pr_array@plt>
mov    %rbx,%rdi
mov    %r12d,%esi
mov    %r15,%rdx
mov    %r14d,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
jmp    1050 <findSmallest@plt>

LLVM IR (-O0):
define i32 @SortNFind(i32* %0, i32 %1, i32* %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32*
%8 = alloca i32
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32* %2, i32** %7
store i32 %3, i32* %8
%9 = load i32*, i32** %5
%10 = load i32, i32* %6
%11 = sub nsw i32 %10, 1
%12 = call i32 @msort(i32* %9, i32 0, i32 %11)
%13 = load i32*, i32** %5
%14 = load i32, i32* %6
%15 = call i32 @pr_array(i32* %13, i32 %14)
%16 = load i32*, i32** %7
%17 = load i32, i32* %8
%18 = sub nsw i32 %17, 1
%19 = call i32 @msort(i32* %16, i32 0, i32 %18)
%20 = load i32*, i32** %7
%21 = load i32, i32* %8
%22 = call i32 @pr_array(i32* %20, i32 %21)
%23 = load i32*, i32** %5
%24 = load i32, i32* %6
%25 = load i32*, i32** %7
%26 = load i32, i32* %8
%27 = call i32 @findSmallest(i32* %23, i32 %24, i32* %25, i32 %26)
ret i32 %27
}

LLVM IR (-O2):
define i32 @SortNFind(i32* %0, i32 %1, i32* %2, i32 %3) {
%5 = add nsw i32 %1, -1
%6 = tail call i32 @msort(i32* %0, i32 0, i32 %5)
%7 = tail call i32 @pr_array(i32* %0, i32 %1)
%8 = add nsw i32 %3, -1
%9 = tail call i32 @msort(i32* %2, i32 0, i32 %8)
%10 = tail call i32 @pr_array(i32* %2, i32 %3)
%11 = tail call i32 @findSmallest(i32* %0, i32 %1, i32* %2, i32 %3)
ret i32 %11
}