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

/* Variables and functions */
int /*<<< orphan*/ data_fprintf(int /*<<< orphan*/ *, unsigned int, char *);
int /*<<< orphan*/ data_to_json_(struct data_node *, int /*<<< orphan*/ *,
                                 unsigned int, int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *);
void data_to_json(struct data_node *self, FILE *f, unsigned int padd) {
  fprintf(f, "{\n");
  data_to_json_(self, f, padd + 1, 1);
  data_fprintf(f, padd, "}");
}


x86 assembly (clang, -O0):
<data_to_json>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xeb2(%rip),%rsi
call   1050 <fprintf@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
add    $0x1,%edx
mov    $0x1,%ecx
call   1040 <data_to_json_@plt>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
lea    0xe8a(%rip),%rdx
call   1030 <data_fprintf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<data_to_json>:
push   %r15
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
mov    %rdi,%r15
lea    0xebb(%rip),%rdi
mov    $0x2,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1050 <fwrite@plt>
lea    0x1(%r14),%edx
mov    %r15,%rdi
mov    %rbx,%rsi
mov    $0x1,%ecx
call   1040 <data_to_json_@plt>
lea    0xe91(%rip),%rdx
mov    %rbx,%rdi
mov    %r14d,%esi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <data_fprintf@plt>

LLVM IR (-O0):
%struct.data_node = type { i32 }
@.str = [3 x i8] c"{\0A\00"
@.str.1 = [2 x i8] c"}\00"
define void @data_to_json(%struct.data_node* %0, i32* %1, i32 %2) {
%4 = alloca %struct.data_node*
%5 = alloca i32*
%6 = alloca i32
store %struct.data_node* %0, %struct.data_node** %4
store i32* %1, i32** %5
store i32 %2, i32* %6
%7 = load i32*, i32** %5
%8 = call i32 @fprintf(i32* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%9 = load %struct.data_node*, %struct.data_node** %4
%10 = load i32*, i32** %5
%11 = load i32, i32* %6
%12 = add i32 %11, 1
%13 = call i32 @data_to_json_(%struct.data_node* %9, i32* %10, i32 %12, i32 1)
%14 = load i32*, i32** %5
%15 = load i32, i32* %6
%16 = call i32 @data_fprintf(i32* %14, i32 %15, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.data_node = type { i32 }
@.str = [3 x i8] c"{\0A\00"
@.str.1 = [2 x i8] c"}\00"
define void @data_to_json(%struct.data_node* %0, i32* %1, i32 %2) {
%4 = tail call i64 @fwrite(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i64 2, i64 1, i32* %1)
%5 = add i32 %2, 1
%6 = tail call i32 @data_to_json_(%struct.data_node* %0, i32* %1, i32 %5, i32 1)
%7 = tail call i32 @data_fprintf(i32* %1, i32 %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
ret void
}