#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*/ helper(int *, int, int /*<<< orphan*/, int, int *, int *);
scalar_t__ malloc(int);
int *searchRange(int *nums, int numsSize, int target, int *returnSize) {
  int left = 0, right = numsSize - 1, start = -1, end = -1, *ret;
  if (numsSize)
    helper(nums, target, 0, numsSize - 1, &start, &end);
  ret = (int *)malloc(2 * sizeof(int));
  ret[0] = start;
  ret[1] = end;
  *returnSize = 2;
  return ret;
}


x86 assembly (clang, -O0):
<searchRange>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x20(%rbp)
movl   $0xffffffff,-0x24(%rbp)
movl   $0xffffffff,-0x28(%rbp)
cmpl   $0x0,-0xc(%rbp)
je     117a <searchRange+0x5a>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%ecx
sub    $0x1,%ecx
xor    %edx,%edx
lea    -0x24(%rbp),%r8
lea    -0x28(%rbp),%r9
call   1040 <helper@plt>
mov    $0x8,%edi
call   1030 <malloc@plt>
mov    %rax,-0x30(%rbp)
mov    -0x24(%rbp),%ecx
mov    -0x30(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x28(%rbp),%ecx
mov    -0x30(%rbp),%rax
mov    %ecx,0x4(%rax)
mov    -0x18(%rbp),%rax
movl   $0x2,(%rax)
mov    -0x30(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<searchRange>:
push   %rbx
sub    $0x10,%rsp
mov    %rcx,%rbx
movl   $0xffffffff,0xc(%rsp)
ff
movl   $0xffffffff,0x8(%rsp)
ff
test   %esi,%esi
je     1154 <searchRange+0x34>
mov    %esi,%ecx
add    $0xffffffff,%ecx
lea    0xc(%rsp),%r8
lea    0x8(%rsp),%r9
mov    %edx,%esi
xor    %edx,%edx
call   1040 <helper@plt>
mov    $0x8,%edi
call   1030 <malloc@plt>
mov    0xc(%rsp),%ecx
mov    %ecx,(%rax)
mov    0x8(%rsp),%ecx
mov    %ecx,0x4(%rax)
movl   $0x2,(%rbx)
add    $0x10,%rsp
pop    %rbx
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
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32*
store i32* %0, i32** %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32* %3, i32** %8
store i32 0, i32* %9
%14 = load i32, i32* %6
%15 = sub nsw i32 %14, 1
store i32 %15, i32* %10
store i32 -1, i32* %11
store i32 -1, i32* %12
%16 = load i32, i32* %6
%17 = icmp ne i32 %16, 0
br i1 %17, label %18, label %24
18: ; preds = %4
%19 = load i32*, i32** %5
%20 = load i32, i32* %7
%21 = load i32, i32* %6
%22 = sub nsw i32 %21, 1
%23 = call i32 @helper(i32* %19, i32 %20, i32 0, i32 %22, i32* %11, i32* %12)
br label %24
24: ; preds = %18, %4
%25 = call i64 @malloc(i32 8)
%26 = inttoptr i64 %25 to i32*
store i32* %26, i32** %13
%27 = load i32, i32* %11
%28 = load i32*, i32** %13
%29 = getelementptr inbounds i32, i32* %28, i64 0
store i32 %27, i32* %29
%30 = load i32, i32* %12
%31 = load i32*, i32** %13
%32 = getelementptr inbounds i32, i32* %31, i64 1
store i32 %30, i32* %32
%33 = load i32*, i32** %8
store i32 2, i32* %33
%34 = load i32*, i32** %13
ret i32* %34
}

LLVM IR (-O2):
define i32* @searchRange(i32* %0, i32 %1, i32 %2, i32* nocapture writeonly %3) {
%5 = alloca i32
%6 = alloca i32
%7 = bitcast i32* %5 to i8*
store i32 -1, i32* %5
%8 = bitcast i32* %6 to i8*
store i32 -1, i32* %6
%9 = icmp eq i32 %1, 0
br i1 %9, label %13, label %10
10: ; preds = %4
%11 = add nsw i32 %1, -1
%12 = call i32 @helper(i32* %0, i32 %2, i32 0, i32 %11, i32* %5, i32* %6)
br label %13
13: ; preds = %10, %4
%14 = call i64 @malloc(i32 8)
%15 = inttoptr i64 %14 to i32*
%16 = load i32, i32* %5
store i32 %16, i32* %15
%17 = load i32, i32* %6
%18 = getelementptr inbounds i32, i32* %15, i64 1
store i32 %17, i32* %18
store i32 2, i32* %3
ret i32* %15
}