#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 */
struct lm {
  int dummy;
};
struct jsonElement {
  int dummy;
};
struct hash {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ getSpecificChar(char, char *, int *);
char *getStringLm(char *, int *, struct lm *);
int /*<<< orphan*/ hashAdd(struct hash *, char *, int /*<<< orphan*/);
int /*<<< orphan*/ jsonParseExpressionLm(char *, int *, struct lm *);
struct hash *newHashLm(int, struct lm *);
struct jsonElement *newJsonObjectLm(struct hash *, struct lm *);
int /*<<< orphan*/ skipLeadingSpacesWithPos(char *, int *);
struct jsonElement *jsonParseObjectLm(char *str, int *posPtr, struct lm *lm) {
  struct hash *h = newHashLm(5, lm);
  getSpecificChar('{', str, posPtr);
  while (str[*posPtr] != '}') {
    skipLeadingSpacesWithPos(str, posPtr);
    char *name = getStringLm(str, posPtr, lm);
    skipLeadingSpacesWithPos(str, posPtr);
    getSpecificChar(':', str, posPtr);
    skipLeadingSpacesWithPos(str, posPtr);
    hashAdd(h, name, jsonParseExpressionLm(str, posPtr, lm));
    skipLeadingSpacesWithPos(str, posPtr);
    if (str[*posPtr] == ',')
      (*posPtr)++;
    else
      break;
  }
  skipLeadingSpacesWithPos(str, posPtr);
  getSpecificChar('}', str, posPtr);
  return newJsonObjectLm(h, lm);
}


x86 assembly (clang, -O0):
<jsonParseObjectLm>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
mov    $0x5,%edi
call   1060 <newHashLm@plt>
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    $0x7b,%edi
call   1030 <getSpecificChar@plt>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq (%rcx),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x7d,%eax
je     127d <jsonParseObjectLm+0x10d>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <skipLeadingSpacesWithPos@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1040 <getStringLm@plt>
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <skipLeadingSpacesWithPos@plt>
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    $0x3a,%edi
call   1030 <getSpecificChar@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <skipLeadingSpacesWithPos@plt>
mov    -0x20(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x30(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1080 <jsonParseExpressionLm@plt>
mov    -0x38(%rbp),%rdi
mov    -0x30(%rbp),%rsi
mov    %eax,%edx
call   1070 <hashAdd@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <skipLeadingSpacesWithPos@plt>
mov    -0x8(%rbp),%rax
mov    -0x10(%rbp),%rcx
movslq (%rcx),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x2c,%eax
jne    1273 <jsonParseObjectLm+0x103>
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
jmp    1278 <jsonParseObjectLm+0x108>
jmp    127d <jsonParseObjectLm+0x10d>
jmp    11a8 <jsonParseObjectLm+0x38>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <skipLeadingSpacesWithPos@plt>
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    $0x7d,%edi
call   1030 <getSpecificChar@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1090 <newJsonObjectLm@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jsonParseObjectLm>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %rdx,%r14
mov    %rsi,%r15
mov    %rdi,%rbx
mov    $0x5,%edi
mov    %rdx,%rsi
call   1060 <newHashLm@plt>
mov    %rax,%r12
mov    $0x7b,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1030 <getSpecificChar@plt>
movslq (%r15),%rax
cmpb   $0x7d,(%rbx,%rax,1)
je     122f <jsonParseObjectLm+0xbf>
nop
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <skipLeadingSpacesWithPos@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1040 <getStringLm@plt>
mov    %rax,%r13
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <skipLeadingSpacesWithPos@plt>
mov    $0x3a,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1030 <getSpecificChar@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <skipLeadingSpacesWithPos@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
mov    %r14,%rdx
call   1080 <jsonParseExpressionLm@plt>
mov    %r12,%rdi
mov    %r13,%rsi
mov    %eax,%edx
call   1070 <hashAdd@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <skipLeadingSpacesWithPos@plt>
movslq (%r15),%rax
cmpb   $0x2c,(%rbx,%rax,1)
jne    122f <jsonParseObjectLm+0xbf>
lea    0x1(%rax),%rcx
mov    %ecx,(%r15)
cmpb   $0x7d,0x1(%rbx,%rax,1)
jne    11b0 <jsonParseObjectLm+0x40>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1050 <skipLeadingSpacesWithPos@plt>
mov    $0x7d,%edi
mov    %rbx,%rsi
mov    %r15,%rdx
call   1030 <getSpecificChar@plt>
mov    %r12,%rdi
mov    %r14,%rsi
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
jmp    1090 <newJsonObjectLm@plt>

LLVM IR (-O0):
%struct.jsonElement = type { i32 }
%struct.lm = type { i32 }
%struct.hash = type { i32 }
define %struct.jsonElement* @jsonParseObjectLm(i8* %0, i32* %1, %struct.lm* %2) {
%4 = alloca i8*
%5 = alloca i32*
%6 = alloca %struct.lm*
%7 = alloca %struct.hash*
%8 = alloca i8*
store i8* %0, i8** %4
store i32* %1, i32** %5
store %struct.lm* %2, %struct.lm** %6
%9 = load %struct.lm*, %struct.lm** %6
%10 = call %struct.hash* @newHashLm(i32 5, %struct.lm* %9)
store %struct.hash* %10, %struct.hash** %7
%11 = load i8*, i8** %4
%12 = load i32*, i32** %5
%13 = call i32 @getSpecificChar(i8 signext 123, i8* %11, i32* %12)
br label %14
14: ; preds = %63, %3
%15 = load i8*, i8** %4
%16 = load i32*, i32** %5
%17 = load i32, i32* %16
%18 = sext i32 %17 to i64
%19 = getelementptr inbounds i8, i8* %15, i64 %18
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp ne i32 %21, 125
br i1 %22, label %23, label %64
23: ; preds = %14
%24 = load i8*, i8** %4
%25 = load i32*, i32** %5
%26 = call i32 @skipLeadingSpacesWithPos(i8* %24, i32* %25)
%27 = load i8*, i8** %4
%28 = load i32*, i32** %5
%29 = load %struct.lm*, %struct.lm** %6
%30 = call i8* @getStringLm(i8* %27, i32* %28, %struct.lm* %29)
store i8* %30, i8** %8
%31 = load i8*, i8** %4
%32 = load i32*, i32** %5
%33 = call i32 @skipLeadingSpacesWithPos(i8* %31, i32* %32)
%34 = load i8*, i8** %4
%35 = load i32*, i32** %5
%36 = call i32 @getSpecificChar(i8 signext 58, i8* %34, i32* %35)
%37 = load i8*, i8** %4
%38 = load i32*, i32** %5
%39 = call i32 @skipLeadingSpacesWithPos(i8* %37, i32* %38)
%40 = load %struct.hash*, %struct.hash** %7
%41 = load i8*, i8** %8
%42 = load i8*, i8** %4
%43 = load i32*, i32** %5
%44 = load %struct.lm*, %struct.lm** %6
%45 = call i32 @jsonParseExpressionLm(i8* %42, i32* %43, %struct.lm* %44)
%46 = call i32 @hashAdd(%struct.hash* %40, i8* %41, i32 %45)
%47 = load i8*, i8** %4
%48 = load i32*, i32** %5
%49 = call i32 @skipLeadingSpacesWithPos(i8* %47, i32* %48)
%50 = load i8*, i8** %4
%51 = load i32*, i32** %5
%52 = load i32, i32* %51
%53 = sext i32 %52 to i64
%54 = getelementptr inbounds i8, i8* %50, i64 %53
%55 = load i8, i8* %54
%56 = sext i8 %55 to i32
%57 = icmp eq i32 %56, 44
br i1 %57, label %58, label %62
58: ; preds = %23
%59 = load i32*, i32** %5
%60 = load i32, i32* %59
%61 = add nsw i32 %60, 1
store i32 %61, i32* %59
br label %63
62: ; preds = %23
br label %64
63: ; preds = %58
br label %14
64: ; preds = %62, %14
%65 = load i8*, i8** %4
%66 = load i32*, i32** %5
%67 = call i32 @skipLeadingSpacesWithPos(i8* %65, i32* %66)
%68 = load i8*, i8** %4
%69 = load i32*, i32** %5
%70 = call i32 @getSpecificChar(i8 signext 125, i8* %68, i32* %69)
%71 = load %struct.hash*, %struct.hash** %7
%72 = load %struct.lm*, %struct.lm** %6
%73 = call %struct.jsonElement* @newJsonObjectLm(%struct.hash* %71, %struct.lm* %72)
ret %struct.jsonElement* %73
}

LLVM IR (-O2):
%struct.jsonElement = type { i32 }
%struct.lm = type { i32 }
%struct.hash = type { i32 }
define %struct.jsonElement* @jsonParseObjectLm(i8* %0, i32* %1, %struct.lm* %2) {
%4 = tail call %struct.hash* @newHashLm(i32 5, %struct.lm* %2)
%5 = tail call i32 @getSpecificChar(i8 signext 123, i8* %0, i32* %1)
%6 = load i32, i32* %1
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8, i8* %0, i64 %7
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 125
br i1 %10, label %31, label %11
11: ; preds = %3, %25
%12 = tail call i32 @skipLeadingSpacesWithPos(i8* %0, i32* %1)
%13 = tail call i8* @getStringLm(i8* %0, i32* %1, %struct.lm* %2)
%14 = tail call i32 @skipLeadingSpacesWithPos(i8* %0, i32* %1)
%15 = tail call i32 @getSpecificChar(i8 signext 58, i8* %0, i32* %1)
%16 = tail call i32 @skipLeadingSpacesWithPos(i8* %0, i32* %1)
%17 = tail call i32 @jsonParseExpressionLm(i8* %0, i32* %1, %struct.lm* %2)
%18 = tail call i32 @hashAdd(%struct.hash* %4, i8* %13, i32 %17)
%19 = tail call i32 @skipLeadingSpacesWithPos(i8* %0, i32* %1)
%20 = load i32, i32* %1
%21 = sext i32 %20 to i64
%22 = getelementptr inbounds i8, i8* %0, i64 %21
%23 = load i8, i8* %22
%24 = icmp eq i8 %23, 44
br i1 %24, label %25, label %31
25: ; preds = %11
%26 = add nsw i32 %20, 1
store i32 %26, i32* %1
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds i8, i8* %0, i64 %27
%29 = load i8, i8* %28
%30 = icmp eq i8 %29, 125
br i1 %30, label %31, label %11
31: ; preds = %25, %11, %3
%32 = tail call i32 @skipLeadingSpacesWithPos(i8* %0, i32* %1)
%33 = tail call i32 @getSpecificChar(i8 signext 125, i8* %0, i32* %1)
%34 = tail call %struct.jsonElement* @newJsonObjectLm(%struct.hash* %4, %struct.lm* %2)
ret %struct.jsonElement* %34
}