#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 _json_attribute {
  int dummy;
};
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int EOF;
int fgetc(int /*<<< orphan*/ *);
struct _json_attribute *get_next_attribute(int /*<<< orphan*/ *,
                                           int /*<<< orphan*/ *);
struct _json_attribute *json_next(FILE *json_input) {
  int ch;
  struct _json_attribute *attrs = NULL;
  while (1) {
    ch = fgetc(json_input);
    if (ch == EOF)
      break;
    switch (ch) {
    case ' ':
    case '\t':
      continue;
    case '{':
      attrs = get_next_attribute(json_input, NULL);
      break;
    }
  }
  return attrs;
}


x86 assembly (clang, -O0):
<json_next>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <fgetc@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    0x2e9e(%rip),%rcx
cmp    (%rcx),%eax
jne    1157 <json_next+0x37>
jmp    11a8 <json_next+0x88>
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
sub    $0x9,%eax
je     118d <json_next+0x6d>
jmp    116b <json_next+0x4b>
mov    -0x1c(%rbp),%eax
sub    $0x20,%eax
je     118d <json_next+0x6d>
jmp    117c <json_next+0x5c>
mov    -0x1c(%rbp),%eax
sub    $0x7b,%eax
je     1192 <json_next+0x72>
jmp    11a3 <json_next+0x83>
jmp    1134 <json_next+0x14>
mov    -0x8(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
call   1030 <get_next_attribute@plt>
mov    %rax,-0x18(%rbp)
jmp    1134 <json_next+0x14>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<json_next>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%rbx
call   1040 <fgetc@plt>
mov    0x2eb4(%rip),%r15
cmp    (%r15),%eax
jne    1145 <json_next+0x25>
xor    %r14d,%r14d
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %r15
ret
xor    %r14d,%r14d
jmp    115d <json_next+0x3d>
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1040 <fgetc@plt>
cmp    (%r15),%eax
je     113c <json_next+0x1c>
cmp    $0x9,%eax
je     1150 <json_next+0x30>
cmp    $0x20,%eax
je     1150 <json_next+0x30>
cmp    $0x7b,%eax
jne    1150 <json_next+0x30>
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <get_next_attribute@plt>
mov    %rax,%r14
jmp    1150 <json_next+0x30>

LLVM IR (-O0):
%struct._json_attribute = type { i32 }
@EOF = global i32 0
define %struct._json_attribute* @json_next(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca %struct._json_attribute*
store i32* %0, i32** %2
store %struct._json_attribute* null, %struct._json_attribute** %4
br label %5
5: ; preds = %1, %14, %18
%6 = load i32*, i32** %2
%7 = call i32 @fgetc(i32* %6)
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = load i32, i32* @EOF
%10 = icmp eq i32 %8, %9
br i1 %10, label %11, label %12
11: ; preds = %5
br label %19
12: ; preds = %5
%13 = load i32, i32* %3
switch i32 %13, label %18 [
i32 32, label %14
i32 9, label %14
i32 123, label %15
]
14: ; preds = %12, %12
br label %5
15: ; preds = %12
%16 = load i32*, i32** %2
%17 = call %struct._json_attribute* @get_next_attribute(i32* %16, i32* null)
store %struct._json_attribute* %17, %struct._json_attribute** %4
br label %18
18: ; preds = %12, %15
br label %5
19: ; preds = %11
%20 = load %struct._json_attribute*, %struct._json_attribute** %4
ret %struct._json_attribute* %20
}

LLVM IR (-O2):
%struct._json_attribute = type { i32 }
@EOF = global i32 0
define %struct._json_attribute* @json_next(i32* %0) {
%2 = tail call i32 @fgetc(i32* %0)
%3 = load i32, i32* @EOF
%4 = icmp eq i32 %2, %3
br i1 %4, label %21, label %5
5: ; preds = %1, %16
%6 = phi i32 [ %18, %16 ], [ %2, %1 ]
%7 = phi %struct._json_attribute* [ %17, %16 ], [ null, %1 ]
br label %8
8: ; preds = %5, %10
%9 = phi i32 [ %6, %5 ], [ %11, %10 ]
switch i32 %9, label %16 [
i32 32, label %10
i32 9, label %10
i32 123, label %14
]
10: ; preds = %8, %8
%11 = tail call i32 @fgetc(i32* %0)
%12 = load i32, i32* @EOF
%13 = icmp eq i32 %11, %12
br i1 %13, label %21, label %8
14: ; preds = %8
%15 = tail call %struct._json_attribute* @get_next_attribute(i32* %0, i32* null)
br label %16
16: ; preds = %8, %14
%17 = phi %struct._json_attribute* [ %15, %14 ], [ %7, %8 ]
%18 = tail call i32 @fgetc(i32* %0)
%19 = load i32, i32* @EOF
%20 = icmp eq i32 %18, %19
br i1 %20, label %21, label %5
21: ; preds = %16, %10, %1
%22 = phi %struct._json_attribute* [ null, %1 ], [ %7, %10 ], [ %17, %16 ]
ret %struct._json_attribute* %22
}