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

/* Variables and functions */
struct confctl_var *confctl_root(struct confctl *);
struct confctl_var *confctl_var_first_child(struct confctl_var *);
struct confctl_var *confctl_var_next(struct confctl_var *);
int /*<<< orphan*/ cv_print(struct confctl_var *, int /*<<< orphan*/ *,
                            int /*<<< orphan*/ *, int);
void cc_print(struct confctl *cc, FILE *fp, bool values_only) {
  struct confctl_var *cv, *child;
  cv = confctl_root(cc);
  for (child = confctl_var_first_child(cv); child != NULL;
       child = confctl_var_next(child))
    cv_print(child, fp, NULL, values_only);
}


x86 assembly (clang, -O0):
<cc_print>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <confctl_root@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <confctl_var_first_child@plt>
mov    %rax,-0x28(%rbp)
cmpq   $0x0,-0x28(%rbp)
je     119e <cc_print+0x5e>
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%ecx
xor    %eax,%eax
mov    %eax,%edx
call   1040 <cv_print@plt>
mov    -0x28(%rbp),%rdi
call   1060 <confctl_var_next@plt>
mov    %rax,-0x28(%rbp)
jmp    116d <cc_print+0x2d>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cc_print>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%r14d
mov    %rsi,%rbx
call   1050 <confctl_root@plt>
mov    %rax,%rdi
call   1030 <confctl_var_first_child@plt>
test   %rax,%rax
je     1180 <cc_print+0x40>
mov    %rax,%rbp
nop
mov    %rbp,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
mov    %r14d,%ecx
call   1040 <cv_print@plt>
mov    %rbp,%rdi
call   1060 <confctl_var_next@plt>
mov    %rax,%rbp
test   %rax,%rax
jne    1160 <cc_print+0x20>
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
%struct.confctl = type { i32 }
%struct.confctl_var = type { i32 }
define void @cc_print(%struct.confctl* %0, i32* %1, i32 %2) {
%4 = alloca %struct.confctl*
%5 = alloca i32*
%6 = alloca i32
%7 = alloca %struct.confctl_var*
%8 = alloca %struct.confctl_var*
store %struct.confctl* %0, %struct.confctl** %4
store i32* %1, i32** %5
store i32 %2, i32* %6
%9 = load %struct.confctl*, %struct.confctl** %4
%10 = call %struct.confctl_var* @confctl_root(%struct.confctl* %9)
store %struct.confctl_var* %10, %struct.confctl_var** %7
%11 = load %struct.confctl_var*, %struct.confctl_var** %7
%12 = call %struct.confctl_var* @confctl_var_first_child(%struct.confctl_var* %11)
store %struct.confctl_var* %12, %struct.confctl_var** %8
br label %13
13: ; preds = %21, %3
%14 = load %struct.confctl_var*, %struct.confctl_var** %8
%15 = icmp ne %struct.confctl_var* %14, null
br i1 %15, label %16, label %24
16: ; preds = %13
%17 = load %struct.confctl_var*, %struct.confctl_var** %8
%18 = load i32*, i32** %5
%19 = load i32, i32* %6
%20 = call i32 @cv_print(%struct.confctl_var* %17, i32* %18, i32* null, i32 %19)
br label %21
21: ; preds = %16
%22 = load %struct.confctl_var*, %struct.confctl_var** %8
%23 = call %struct.confctl_var* @confctl_var_next(%struct.confctl_var* %22)
store %struct.confctl_var* %23, %struct.confctl_var** %8
br label %13
24: ; preds = %13
ret void
}

LLVM IR (-O2):
%struct.confctl = type { i32 }
%struct.confctl_var = type { i32 }
define void @cc_print(%struct.confctl* %0, i32* %1, i32 %2) {
%4 = tail call %struct.confctl_var* @confctl_root(%struct.confctl* %0)
%5 = tail call %struct.confctl_var* @confctl_var_first_child(%struct.confctl_var* %4)
%6 = icmp eq %struct.confctl_var* %5, null
br i1 %6, label %12, label %7
7: ; preds = %3, %7
%8 = phi %struct.confctl_var* [ %10, %7 ], [ %5, %3 ]
%9 = tail call i32 @cv_print(%struct.confctl_var* %8, i32* %1, i32* null, i32 %2)
%10 = tail call %struct.confctl_var* @confctl_var_next(%struct.confctl_var* %8)
%11 = icmp eq %struct.confctl_var* %10, null
br i1 %11, label %12, label %7
12: ; preds = %7, %3
ret void
}