#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 */
typedef int /*<<< orphan*/ cProp;

/* Variables and functions */
scalar_t__ _jsonIsString(char *, char **);
char *_jsonNext(char *, char);
int /*<<< orphan*/ strcpy(char *, char *);
size_t strlen(char *);
int /*<<< orphan*/ strncpyz(char *, char *, int);
int /*<<< orphan*/ strtrim(char *, int);
char *_jsonGetProp(char *pcSrc, size_t iPropSize, char **ppcProp,
                   char **ppcNext) {
  char cProp[256];
  char *pcEOD;
  *(*ppcProp) = '\0';
  if (_jsonIsString(pcSrc, &pcEOD)) {
    if ((pcEOD - pcSrc) < sizeof(cProp)) {
      strncpyz(cProp, pcSrc, (pcEOD - pcSrc));
      strtrim(cProp, (3 | 64));
      if (strlen(cProp) < iPropSize) {
        if ((pcEOD = _jsonNext(pcEOD, ':'))) {
          strcpy(*ppcProp, cProp);
          *ppcNext = pcEOD;
          return *ppcProp;
        }
      }
    }
  }
  return NULL;
}


x86 assembly (clang, -O0):
<_jsonGetProp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x140,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %rcx,-0x28(%rbp)
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
movb   $0x0,(%rax)
mov    -0x10(%rbp),%rdi
lea    -0x138(%rbp),%rsi
call   1040 <_jsonIsString@plt>
cmp    $0x0,%rax
je     1262 <_jsonGetProp+0x102>
mov    -0x138(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
cmp    $0x100,%rax
jae    125d <_jsonGetProp+0xfd>
lea    -0x130(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x138(%rbp),%rax
mov    -0x10(%rbp),%rcx
sub    %rcx,%rax
mov    %eax,%edx
call   1060 <strncpyz@plt>
lea    -0x130(%rbp),%rdi
mov    $0x43,%esi
call   1070 <strtrim@plt>
lea    -0x130(%rbp),%rdi
call   1050 <strlen@plt>
cmp    -0x18(%rbp),%rax
jae    1258 <_jsonGetProp+0xf8>
mov    -0x138(%rbp),%rdi
mov    $0x3a,%esi
call   1080 <_jsonNext@plt>
mov    %rax,-0x138(%rbp)
cmp    $0x0,%rax
je     1253 <_jsonGetProp+0xf3>
mov    -0x20(%rbp),%rax
mov    (%rax),%rdi
lea    -0x130(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x138(%rbp),%rcx
mov    -0x28(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x8(%rbp)
jmp    126a <_jsonGetProp+0x10a>
jmp    1258 <_jsonGetProp+0xf8>
jmp    125d <_jsonGetProp+0xfd>
jmp    1262 <_jsonGetProp+0x102>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x140,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_jsonGetProp>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x110,%rsp
mov    %rcx,%r14
mov    %rdx,%r12
mov    %rsi,%r15
mov    %rdi,%rbx
mov    (%rdx),%rax
movb   $0x0,(%rax)
lea    0x8(%rsp),%rsi
call   1040 <_jsonIsString@plt>
test   %rax,%rax
je     1201 <_jsonGetProp+0xa1>
mov    0x8(%rsp),%rdx
sub    %rbx,%rdx
cmp    $0xff,%rdx
ja     1201 <_jsonGetProp+0xa1>
lea    0x10(%rsp),%r13
mov    %r13,%rdi
mov    %rbx,%rsi
call   1060 <strncpyz@plt>
mov    %r13,%rdi
mov    $0x43,%esi
call   1070 <strtrim@plt>
mov    %r13,%rdi
call   1050 <strlen@plt>
cmp    %r15,%rax
jae    1201 <_jsonGetProp+0xa1>
mov    0x8(%rsp),%rdi
mov    $0x3a,%esi
call   1080 <_jsonNext@plt>
mov    %rax,0x8(%rsp)
test   %rax,%rax
je     1201 <_jsonGetProp+0xa1>
mov    (%r12),%rdi
lea    0x10(%rsp),%rsi
call   1030 <strcpy@plt>
mov    0x8(%rsp),%rax
mov    %rax,(%r14)
mov    (%r12),%rax
jmp    1203 <_jsonGetProp+0xa3>
xor    %eax,%eax
add    $0x110,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define i8* @_jsonGetProp(i8* %0, i64 %1, i8** %2, i8** %3) {
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i8**
%9 = alloca i8**
%10 = alloca [256 x i8]
%11 = alloca i8*
store i8* %0, i8** %6
store i64 %1, i64* %7
store i8** %2, i8*** %8
store i8** %3, i8*** %9
%12 = load i8**, i8*** %8
%13 = load i8*, i8** %12
store i8 0, i8* %13
%14 = load i8*, i8** %6
%15 = call i64 @_jsonIsString(i8* %14, i8** %11)
%16 = icmp ne i64 %15, 0
br i1 %16, label %17, label %56
17: ; preds = %4
%18 = load i8*, i8** %11
%19 = load i8*, i8** %6
%20 = ptrtoint i8* %18 to i64
%21 = ptrtoint i8* %19 to i64
%22 = sub i64 %20, %21
%23 = icmp ult i64 %22, 256
br i1 %23, label %24, label %55
24: ; preds = %17
%25 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%26 = load i8*, i8** %6
%27 = load i8*, i8** %11
%28 = load i8*, i8** %6
%29 = ptrtoint i8* %27 to i64
%30 = ptrtoint i8* %28 to i64
%31 = sub i64 %29, %30
%32 = trunc i64 %31 to i32
%33 = call i32 @strncpyz(i8* %25, i8* %26, i32 %32)
%34 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%35 = call i32 @strtrim(i8* %34, i32 67)
%36 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%37 = call i64 @strlen(i8* %36)
%38 = load i64, i64* %7
%39 = icmp ult i64 %37, %38
br i1 %39, label %40, label %54
40: ; preds = %24
%41 = load i8*, i8** %11
%42 = call i8* @_jsonNext(i8* %41, i8 signext 58)
store i8* %42, i8** %11
%43 = icmp ne i8* %42, null
br i1 %43, label %44, label %53
44: ; preds = %40
%45 = load i8**, i8*** %8
%46 = load i8*, i8** %45
%47 = getelementptr inbounds [256 x i8], [256 x i8]* %10, i64 0, i64 0
%48 = call i32 @strcpy(i8* %46, i8* %47)
%49 = load i8*, i8** %11
%50 = load i8**, i8*** %9
store i8* %49, i8** %50
%51 = load i8**, i8*** %8
%52 = load i8*, i8** %51
store i8* %52, i8** %5
br label %57
53: ; preds = %40
br label %54
54: ; preds = %53, %24
br label %55
55: ; preds = %54, %17
br label %56
56: ; preds = %55, %4
store i8* null, i8** %5
br label %57
57: ; preds = %56, %44
%58 = load i8*, i8** %5
ret i8* %58
}

LLVM IR (-O2):
define i8* @_jsonGetProp(i8* %0, i64 %1, i8** nocapture %2, i8** nocapture writeonly %3) {
%5 = alloca [256 x i8]
%6 = alloca i8*
%7 = getelementptr inbounds [256 x i8], [256 x i8]* %5, i64 0, i64 0
%8 = bitcast i8** %6 to i8*
%9 = load i8*, i8** %2
store i8 0, i8* %9
%10 = call i64 @_jsonIsString(i8* %0, i8** %6)
%11 = icmp eq i64 %10, 0
br i1 %11, label %33, label %12
12: ; preds = %4
%13 = load i8*, i8** %6
%14 = ptrtoint i8* %13 to i64
%15 = ptrtoint i8* %0 to i64
%16 = sub i64 %14, %15
%17 = icmp ult i64 %16, 256
br i1 %17, label %18, label %33
18: ; preds = %12
%19 = trunc i64 %16 to i32
%20 = call i32 @strncpyz(i8* %7, i8* %0, i32 %19)
%21 = call i32 @strtrim(i8* %7, i32 67)
%22 = call i64 @strlen(i8* %7)
%23 = icmp ult i64 %22, %1
br i1 %23, label %24, label %33
24: ; preds = %18
%25 = load i8*, i8** %6
%26 = call i8* @_jsonNext(i8* %25, i8 signext 58)
store i8* %26, i8** %6
%27 = icmp eq i8* %26, null
br i1 %27, label %33, label %28
28: ; preds = %24
%29 = load i8*, i8** %2
%30 = call i32 @strcpy(i8* %29, i8* %7)
%31 = load i8*, i8** %6
store i8* %31, i8** %3
%32 = load i8*, i8** %2
br label %33
33: ; preds = %4, %18, %24, %12, %28
%34 = phi i8* [ %32, %28 ], [ null, %12 ], [ null, %24 ], [ null, %18 ], [ null, %4 ]
ret i8* %34
}