#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 */
char *findJsonBeginningParams(char const *, size_t, int *, int *);
char *findJsonEndParams(char const *, size_t, int *, int *, int *);
const char *getPushJson(const char *data, size_t dataSize, int *start,
                        int *length) {
  int inString = 0;
  int pos = 0;
  const char *beginning =
      findJsonBeginningParams(data, dataSize, &inString, &pos);
  if (!beginning) {
    *start = -1;
    *length = -1;
    return NULL;
  }
  inString = 0;
  int endPos = 0;
  int level = 0;
  const char *end;
  end =
      findJsonEndParams(data + pos, dataSize - pos, &inString, &level, &endPos);
  *start = pos;
  if (end)
    *length = endPos + 1;
  else
    *length = -1;
  return data + pos;
}


x86 assembly (clang, -O0):
<getPushJson>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x30(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
lea    -0x2c(%rbp),%rdx
lea    -0x30(%rbp),%rcx
call   1030 <findJsonBeginningParams@plt>
mov    %rax,-0x38(%rbp)
cmpq   $0x0,-0x38(%rbp)
jne    118b <getPushJson+0x6b>
mov    -0x20(%rbp),%rax
movl   $0xffffffff,(%rax)
mov    -0x28(%rbp),%rax
movl   $0xffffffff,(%rax)
movq   $0x0,-0x8(%rbp)
jmp    1209 <getPushJson+0xe9>
movl   $0x0,-0x2c(%rbp)
movl   $0x0,-0x3c(%rbp)
movl   $0x0,-0x40(%rbp)
mov    -0x10(%rbp),%rdi
movslq -0x30(%rbp),%rax
add    %rax,%rdi
mov    -0x18(%rbp),%rsi
movslq -0x30(%rbp),%rax
sub    %rax,%rsi
lea    -0x2c(%rbp),%rdx
lea    -0x40(%rbp),%rcx
lea    -0x3c(%rbp),%r8
call   1040 <findJsonEndParams@plt>
mov    %rax,-0x48(%rbp)
mov    -0x30(%rbp),%ecx
mov    -0x20(%rbp),%rax
mov    %ecx,(%rax)
cmpq   $0x0,-0x48(%rbp)
je     11f0 <getPushJson+0xd0>
mov    -0x3c(%rbp),%ecx
add    $0x1,%ecx
mov    -0x28(%rbp),%rax
mov    %ecx,(%rax)
jmp    11fa <getPushJson+0xda>
mov    -0x28(%rbp),%rax
movl   $0xffffffff,(%rax)
mov    -0x10(%rbp),%rax
movslq -0x30(%rbp),%rcx
add    %rcx,%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getPushJson>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x18,%rsp
mov    %rcx,%r14
mov    %rdx,%r15
mov    %rsi,%rbx
mov    %rdi,%r12
movl   $0x0,0xc(%rsp)
movl   $0x0,0x8(%rsp)
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
call   1030 <findJsonBeginningParams@plt>
test   %rax,%rax
je     11b5 <getPushJson+0x95>
movl   $0x0,0xc(%rsp)
movl   $0x0,0x10(%rsp)
movl   $0x0,0x14(%rsp)
movslq 0x8(%rsp),%rax
lea    (%r12,%rax,1),%rdi
sub    %rax,%rbx
lea    0xc(%rsp),%rdx
lea    0x14(%rsp),%rcx
lea    0x10(%rsp),%r8
mov    %rbx,%rsi
call   1040 <findJsonEndParams@plt>
movslq 0x8(%rsp),%rcx
mov    %ecx,(%r15)
mov    0x10(%rsp),%edx
add    $0x1,%edx
cmp    $0x1,%rax
sbb    %eax,%eax
or     %edx,%eax
mov    %eax,(%r14)
add    %rcx,%r12
jmp    11c6 <getPushJson+0xa6>
movl   $0xffffffff,(%r15)
movl   $0xffffffff,(%r14)
xor    %r12d,%r12d
mov    %r12,%rax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @getPushJson(i8* %0, i64 %1, i32* %2, i32* %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i32*
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i32
%12 = alloca i8*
%13 = alloca i32
%14 = alloca i32
%15 = alloca i8*
store i8* %0, i8** %6
store i64 %1, i64* %7
store i32* %2, i32** %8
store i32* %3, i32** %9
store i32 0, i32* %10
store i32 0, i32* %11
%16 = load i8*, i8** %6
%17 = load i64, i64* %7
%18 = call i8* @findJsonBeginningParams(i8* %16, i64 %17, i32* %10, i32* %11)
store i8* %18, i8** %12
%19 = load i8*, i8** %12
%20 = icmp ne i8* %19, null
br i1 %20, label %24, label %21
21: ; preds = %4
%22 = load i32*, i32** %8
store i32 -1, i32* %22
%23 = load i32*, i32** %9
store i32 -1, i32* %23
store i8* null, i8** %5
br label %49
24: ; preds = %4
store i32 0, i32* %10
store i32 0, i32* %13
store i32 0, i32* %14
%25 = load i8*, i8** %6
%26 = load i32, i32* %11
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %25, i64 %27
%29 = load i64, i64* %7
%30 = load i32, i32* %11
%31 = sext i32 %30 to i64
%32 = sub i64 %29, %31
%33 = call i8* @findJsonEndParams(i8* %28, i64 %32, i32* %10, i32* %14, i32* %13)
store i8* %33, i8** %15
%34 = load i32, i32* %11
%35 = load i32*, i32** %8
store i32 %34, i32* %35
%36 = load i8*, i8** %15
%37 = icmp ne i8* %36, null
br i1 %37, label %38, label %42
38: ; preds = %24
%39 = load i32, i32* %13
%40 = add nsw i32 %39, 1
%41 = load i32*, i32** %9
store i32 %40, i32* %41
br label %44
42: ; preds = %24
%43 = load i32*, i32** %9
store i32 -1, i32* %43
br label %44
44: ; preds = %42, %38
%45 = load i8*, i8** %6
%46 = load i32, i32* %11
%47 = sext i32 %46 to i64
%48 = getelementptr inbounds i8, i8* %45, i64 %47
store i8* %48, i8** %5
br label %49
49: ; preds = %44, %21
%50 = load i8*, i8** %5
ret i8* %50
}

LLVM IR (-O2):
define i8* @getPushJson(i8* %0, i64 %1, i32* nocapture writeonly %2, i32* nocapture writeonly %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = bitcast i32* %5 to i8*
store i32 0, i32* %5
%10 = bitcast i32* %6 to i8*
store i32 0, i32* %6
%11 = call i8* @findJsonBeginningParams(i8* %0, i64 %1, i32* %5, i32* %6)
%12 = icmp eq i8* %11, null
br i1 %12, label %13, label %14
13: ; preds = %4
store i32 -1, i32* %2
store i32 -1, i32* %3
br label %29
14: ; preds = %4
store i32 0, i32* %5
%15 = bitcast i32* %7 to i8*
store i32 0, i32* %7
%16 = bitcast i32* %8 to i8*
store i32 0, i32* %8
%17 = load i32, i32* %6
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %0, i64 %18
%20 = sub i64 %1, %18
%21 = call i8* @findJsonEndParams(i8* %19, i64 %20, i32* %5, i32* %8, i32* %7)
%22 = load i32, i32* %6
store i32 %22, i32* %2
%23 = icmp eq i8* %21, null
%24 = load i32, i32* %7
%25 = add nsw i32 %24, 1
%26 = select i1 %23, i32 -1, i32 %25
store i32 %26, i32* %3
%27 = sext i32 %22 to i64
%28 = getelementptr inbounds i8, i8* %0, i64 %27
br label %29
29: ; preds = %14, %13
%30 = phi i8* [ %28, %14 ], [ null, %13 ]
ret i8* %30
}