#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 testJSONSnippet(char const *, char const *);
int testJSON(void) {
  int val;
  const char *benc_str;
  const char *expected;
  benc_str = "i6e";
  expected = "6";
  if ((val = testJSONSnippet(benc_str, expected)))
    return val;
  benc_str = "d5:helloi1e5:worldi2ee";
  expected = "{\"hello\":1,\"world\":2}";
  if ((val = testJSONSnippet(benc_str, expected)))
    return val;
  benc_str = "d5:helloi1e5:worldi2e3:fooli1ei2ei3eee";
  expected = "{\"foo\":[1,2,3],\"hello\":1,\"world\":2}";
  if ((val = testJSONSnippet(benc_str, expected)))
    return val;
  benc_str = "d5:helloi1e5:worldi2e3:fooli1ei2ei3ed1:ai0eeee";
  expected = "{\"foo\":[1,2,3,{\"a\":0}],\"hello\":1,\"world\":2}";
  if ((val = testJSONSnippet(benc_str, expected)))
    return val;
  benc_str = "d4:argsd6:statusle7:status2lee6:result7:successe";
  expected = "{\"args\":{\"status\":[],\"status2\":[]},\"result\":\"success\"}";
  if ((val = testJSONSnippet(benc_str, expected)))
    return val;
  return 0;
}


x86 assembly (clang, -O0):
<testJSON>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xee1(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xeda(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <testJSONSnippet@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
je     1152 <testJSON+0x42>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1241 <testJSON+0x131>
lea    0xead(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xeb9(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <testJSONSnippet@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
je     118c <testJSON+0x7c>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1241 <testJSON+0x131>
lea    0xea0(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xebc(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <testJSONSnippet@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
je     11c6 <testJSON+0xb6>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1241 <testJSON+0x131>
lea    0xeb1(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xed5(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <testJSONSnippet@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
je     1200 <testJSON+0xf0>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1241 <testJSON+0x131>
lea    0xed2(%rip),%rax
mov    %rax,-0x10(%rbp)
lea    0xef8(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1030 <testJSONSnippet@plt>
mov    %eax,-0x8(%rbp)
cmp    $0x0,%eax
je     123a <testJSON+0x12a>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1241 <testJSON+0x131>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testJSON>:
push   %rax
lea    0xee8(%rip),%rdi
lea    0xee5(%rip),%rsi
call   1030 <testJSONSnippet@plt>
test   %eax,%eax
jne    116d <testJSON+0x5d>
lea    0xed7(%rip),%rdi
lea    0xee7(%rip),%rsi
call   1030 <testJSONSnippet@plt>
test   %eax,%eax
jne    116d <testJSON+0x5d>
lea    0xeed(%rip),%rdi
lea    0xf0d(%rip),%rsi
call   1030 <testJSONSnippet@plt>
test   %eax,%eax
jne    116d <testJSON+0x5d>
lea    0xf21(%rip),%rdi
lea    0xf49(%rip),%rsi
call   1030 <testJSONSnippet@plt>
test   %eax,%eax
je     116f <testJSON+0x5f>
pop    %rcx
ret
lea    0xf63(%rip),%rdi
lea    0xf8d(%rip),%rsi
pop    %rax
jmp    1030 <testJSONSnippet@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"i6e\00"
@.str.1 = [2 x i8] c"6\00"
@.str.2 = [23 x i8] c"d5:helloi1e5:worldi2ee\00"
@.str.3 = [22 x i8] c"{\22hello\22:1,\22world\22:2}\00"
@.str.4 = [39 x i8] c"d5:helloi1e5:worldi2e3:fooli1ei2ei3eee\00"
@.str.5 = [36 x i8] c"{\22foo\22:[1,2,3],\22hello\22:1,\22world\22:2}\00"
@.str.6 = [47 x i8] c"d5:helloi1e5:worldi2e3:fooli1ei2ei3ed1:ai0eeee\00"
@.str.7 = [44 x i8] c"{\22foo\22:[1,2,3,{\22a\22:0}],\22hello\22:1,\22world\22:2}\00"
@.str.8 = [49 x i8] c"d4:argsd6:statusle7:status2lee6:result7:successe\00"
@.str.9 = [55 x i8] c"{\22args\22:{\22status\22:[],\22status2\22:[]},\22result\22:\22success\22}\00"
define i32 @testJSON() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i8*
store i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8** %3
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8** %4
%5 = load i8*, i8** %3
%6 = load i8*, i8** %4
%7 = call i32 @testJSONSnippet(i8* %5, i8* %6)
store i32 %7, i32* %2
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %0
%10 = load i32, i32* %2
store i32 %10, i32* %1
br label %40
11: ; preds = %0
store i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8** %3
store i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0), i8** %4
%12 = load i8*, i8** %3
%13 = load i8*, i8** %4
%14 = call i32 @testJSONSnippet(i8* %12, i8* %13)
store i32 %14, i32* %2
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %18
16: ; preds = %11
%17 = load i32, i32* %2
store i32 %17, i32* %1
br label %40
18: ; preds = %11
store i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0), i8** %3
store i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), i8** %4
%19 = load i8*, i8** %3
%20 = load i8*, i8** %4
%21 = call i32 @testJSONSnippet(i8* %19, i8* %20)
store i32 %21, i32* %2
%22 = icmp ne i32 %21, 0
br i1 %22, label %23, label %25
23: ; preds = %18
%24 = load i32, i32* %2
store i32 %24, i32* %1
br label %40
25: ; preds = %18
store i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.6, i64 0, i64 0), i8** %3
store i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.7, i64 0, i64 0), i8** %4
%26 = load i8*, i8** %3
%27 = load i8*, i8** %4
%28 = call i32 @testJSONSnippet(i8* %26, i8* %27)
store i32 %28, i32* %2
%29 = icmp ne i32 %28, 0
br i1 %29, label %30, label %32
30: ; preds = %25
%31 = load i32, i32* %2
store i32 %31, i32* %1
br label %40
32: ; preds = %25
store i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.8, i64 0, i64 0), i8** %3
store i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.9, i64 0, i64 0), i8** %4
%33 = load i8*, i8** %3
%34 = load i8*, i8** %4
%35 = call i32 @testJSONSnippet(i8* %33, i8* %34)
store i32 %35, i32* %2
%36 = icmp ne i32 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %32
%38 = load i32, i32* %2
store i32 %38, i32* %1
br label %40
39: ; preds = %32
store i32 0, i32* %1
br label %40
40: ; preds = %39, %37, %30, %23, %16, %9
%41 = load i32, i32* %1
ret i32 %41
}

LLVM IR (-O2):
@.str = [4 x i8] c"i6e\00"
@.str.1 = [2 x i8] c"6\00"
@.str.2 = [23 x i8] c"d5:helloi1e5:worldi2ee\00"
@.str.3 = [22 x i8] c"{\22hello\22:1,\22world\22:2}\00"
@.str.4 = [39 x i8] c"d5:helloi1e5:worldi2e3:fooli1ei2ei3eee\00"
@.str.5 = [36 x i8] c"{\22foo\22:[1,2,3],\22hello\22:1,\22world\22:2}\00"
@.str.6 = [47 x i8] c"d5:helloi1e5:worldi2e3:fooli1ei2ei3ed1:ai0eeee\00"
@.str.7 = [44 x i8] c"{\22foo\22:[1,2,3,{\22a\22:0}],\22hello\22:1,\22world\22:2}\00"
@.str.8 = [49 x i8] c"d4:argsd6:statusle7:status2lee6:result7:successe\00"
@.str.9 = [55 x i8] c"{\22args\22:{\22status\22:[],\22status2\22:[]},\22result\22:\22success\22}\00"
define i32 @testJSON() {
%1 = tail call i32 @testJSONSnippet(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%2 = icmp eq i32 %1, 0
br i1 %2, label %3, label %14
3: ; preds = %0
%4 = tail call i32 @testJSONSnippet(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.3, i64 0, i64 0))
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %14
6: ; preds = %3
%7 = tail call i32 @testJSONSnippet(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0))
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %14
9: ; preds = %6
%10 = tail call i32 @testJSONSnippet(i8* getelementptr inbounds ([47 x i8], [47 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.7, i64 0, i64 0))
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %9
%13 = tail call i32 @testJSONSnippet(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.8, i64 0, i64 0), i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.9, i64 0, i64 0))
br label %14
14: ; preds = %12, %9, %6, %3, %0
%15 = phi i32 [ %1, %0 ], [ %4, %3 ], [ %7, %6 ], [ %10, %9 ], [ %13, %12 ]
ret i32 %15
}