#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 lowerBinarySearch(int *, int, int, int /*<<< orphan*/, int);
scalar_t__ malloc(int);
int upperBinarySearch(int *, int, int, int /*<<< orphan*/, int);
int *searchRange(int *nums, int numsSize, int target, int *returnSize) {
  int *r = (int *)malloc(2 * sizeof(int));
  r[0] = lowerBinarySearch(nums, numsSize, target, 0, numsSize - 1);
  r[1] = upperBinarySearch(nums, numsSize, target, 0, numsSize - 1);
  *returnSize = 2;
  return r;
}


x86 assembly (clang, -O0):
<searchRange>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    $0x8,%edi
call   1050 <malloc@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0xc(%rbp),%r8d
sub    $0x1,%r8d
xor    %ecx,%ecx
call   1040 <lowerBinarySearch@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
mov    -0xc(%rbp),%r8d
sub    $0x1,%r8d
xor    %ecx,%ecx
call   1030 <upperBinarySearch@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x18(%rbp),%rax
movl   $0x2,(%rax)
mov    -0x20(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<searchRange>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r14
mov    %edx,%r15d
mov    %esi,%ebx
mov    %rdi,%r12
mov    $0x8,%edi
call   1050 <malloc@plt>
mov    %rax,%rbp
lea    -0x1(%rbx),%r13d
mov    %r12,%rdi
mov    %ebx,%esi
mov    %r15d,%edx
xor    %ecx,%ecx
mov    %r13d,%r8d
call   1040 <lowerBinarySearch@plt>
mov    %eax,0x0(%rbp)
mov    %r12,%rdi
mov    %ebx,%esi
mov    %r15d,%edx
xor    %ecx,%ecx
mov    %r13d,%r8d
call   1030 <upperBinarySearch@plt>
mov    %eax,0x4(%rbp)
movl   $0x2,(%r14)
mov    %rbp,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define i32* @searchRange(i32* %0, i32 %1, i32 %2, i32* %3) {
%5 = alloca i32*
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32*
%9 = alloca i32*
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32* %3, i32** %8
%10 = call i64 @malloc(i32 8)
%11 = inttoptr i64 %10 to i32*
store i32* %11, i32** %9
%12 = load i32*, i32** %5
%13 = load i32, i32* %6
%14 = load i32, i32* %7
%15 = load i32, i32* %6
%16 = sub nsw i32 %15, 1
%17 = call i32 @lowerBinarySearch(i32* %12, i32 %13, i32 %14, i32 0, i32 %16)
%18 = load i32*, i32** %9
%19 = getelementptr inbounds i32, i32* %18, i64 0
store i32 %17, i32* %19
%20 = load i32*, i32** %5
%21 = load i32, i32* %6
%22 = load i32, i32* %7
%23 = load i32, i32* %6
%24 = sub nsw i32 %23, 1
%25 = call i32 @upperBinarySearch(i32* %20, i32 %21, i32 %22, i32 0, i32 %24)
%26 = load i32*, i32** %9
%27 = getelementptr inbounds i32, i32* %26, i64 1
store i32 %25, i32* %27
%28 = load i32*, i32** %8
store i32 2, i32* %28
%29 = load i32*, i32** %9
ret i32* %29
}

LLVM IR (-O2):
define i32* @searchRange(i32* %0, i32 %1, i32 %2, i32* nocapture writeonly %3) {
%5 = tail call i64 @malloc(i32 8)
%6 = inttoptr i64 %5 to i32*
%7 = add nsw i32 %1, -1
%8 = tail call i32 @lowerBinarySearch(i32* %0, i32 %1, i32 %2, i32 0, i32 %7)
store i32 %8, i32* %6
%9 = tail call i32 @upperBinarySearch(i32* %0, i32 %1, i32 %2, i32 0, i32 %7)
%10 = getelementptr inbounds i32, i32* %6, i64 1
store i32 %9, i32* %10
store i32 2, i32* %3
ret i32* %6
}