#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*/ test(char const *, char *);
int main() {
  const char *text =
      "{ \"number\" : -001234, \"name\": \"lijie\", \"language\" : \"c\"}";
  test(text, "number");
  test(text, "name");
  test(text, "language");
  test(text, "failed");
  const char *text2 = "{ \"id\": abc, \"name\": \"lijie\" }";
  test(text2, "id");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xf04(%rip),%rsi
call   1030 <test@plt>
mov    -0x10(%rbp),%rdi
lea    0xefb(%rip),%rsi
call   1030 <test@plt>
mov    -0x10(%rbp),%rdi
lea    0xef0(%rip),%rsi
call   1030 <test@plt>
mov    -0x10(%rbp),%rdi
lea    0xee9(%rip),%rsi
call   1030 <test@plt>
lea    0xee4(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xef4(%rip),%rsi
call   1030 <test@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
lea    0xee8(%rip),%rbx
lea    0xf1a(%rip),%rsi
mov    %rbx,%rdi
call   1030 <test@plt>
lea    0xf12(%rip),%rsi
mov    %rbx,%rdi
call   1030 <test@plt>
lea    0xf08(%rip),%rsi
mov    %rbx,%rdi
call   1030 <test@plt>
lea    0xf02(%rip),%rsi
mov    %rbx,%rdi
call   1030 <test@plt>
lea    0xefa(%rip),%rdi
lea    0xf12(%rip),%rsi
call   1030 <test@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [57 x i8] c"{ \22number\22 : -001234, \22name\22: \22lijie\22, \22language\22 : \22c\22}\00"
@.str.1 = [7 x i8] c"number\00"
@.str.2 = [5 x i8] c"name\00"
@.str.3 = [9 x i8] c"language\00"
@.str.4 = [7 x i8] c"failed\00"
@.str.5 = [31 x i8] c"{ \22id\22: abc, \22name\22: \22lijie\22 }\00"
@.str.6 = [3 x i8] c"id\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
%3 = alloca i8*
store i32 0, i32* %1
store i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @test(i8* %4, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%6 = load i8*, i8** %2
%7 = call i32 @test(i8* %6, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%8 = load i8*, i8** %2
%9 = call i32 @test(i8* %8, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%10 = load i8*, i8** %2
%11 = call i32 @test(i8* %10, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
store i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0), i8** %3
%12 = load i8*, i8** %3
%13 = call i32 @test(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [57 x i8] c"{ \22number\22 : -001234, \22name\22: \22lijie\22, \22language\22 : \22c\22}\00"
@.str.1 = [7 x i8] c"number\00"
@.str.2 = [5 x i8] c"name\00"
@.str.3 = [9 x i8] c"language\00"
@.str.4 = [7 x i8] c"failed\00"
@.str.5 = [31 x i8] c"{ \22id\22: abc, \22name\22: \22lijie\22 }\00"
@.str.6 = [3 x i8] c"id\00"
define i32 @main() {
%1 = tail call i32 @test(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.1, i64 0, i64 0))
%2 = tail call i32 @test(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
%3 = tail call i32 @test(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.3, i64 0, i64 0))
%4 = tail call i32 @test(i8* getelementptr inbounds ([57 x i8], [57 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0))
%5 = tail call i32 @test(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
ret i32 0
}