#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 device {
  int dummy;
};

/* Variables and functions */
char *dev_path(struct device *);
int /*<<< orphan*/ printf(char *, char const *, ...);
int /*<<< orphan*/ show_devs_tree(struct device *, int, int /*<<< orphan*/,
                                  int);
void show_devs_subtree(struct device *root, int debug_level, const char *msg) {
  printf("Show all devs in subtree %s...%s\n", dev_path(root), msg);
  printf("%s\n", msg);
  show_devs_tree(root, debug_level, 0, -1);
}


x86 assembly (clang, -O0):
<show_devs_subtree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
call   1050 <dev_path@plt>
mov    %rax,%rsi
mov    -0x18(%rbp),%rdx
lea    0xea6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rsi
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
xor    %edx,%edx
mov    $0xffffffff,%ecx
call   1040 <show_devs_tree@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<show_devs_subtree>:
push   %rbp
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %esi,%r14d
mov    %rdi,%rbp
call   1050 <dev_path@plt>
lea    0xeb7(%rip),%rdi
mov    %rax,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec1(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
mov    %rbp,%rdi
mov    %r14d,%esi
xor    %edx,%edx
mov    $0xffffffff,%ecx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <show_devs_tree@plt>

LLVM IR (-O0):
%struct.device = type { i32 }
@.str = [34 x i8] c"Show all devs in subtree %s...%s\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define void @show_devs_subtree(%struct.device* %0, i32 %1, i8* %2) {
%4 = alloca %struct.device*
%5 = alloca i32
%6 = alloca i8*
store %struct.device* %0, %struct.device** %4
store i32 %1, i32* %5
store i8* %2, i8** %6
%7 = load %struct.device*, %struct.device** %4
%8 = call i8* @dev_path(%struct.device* %7)
%9 = load i8*, i8** %6
%10 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %8, i8* %9)
%11 = load i8*, i8** %6
%12 = call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %11)
%13 = load %struct.device*, %struct.device** %4
%14 = load i32, i32* %5
%15 = call i32 @show_devs_tree(%struct.device* %13, i32 %14, i32 0, i32 -1)
ret void
}

LLVM IR (-O2):
%struct.device = type { i32 }
@.str = [34 x i8] c"Show all devs in subtree %s...%s\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define void @show_devs_subtree(%struct.device* %0, i32 %1, i8* %2) {
%4 = tail call i8* @dev_path(%struct.device* %0)
%5 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str, i64 0, i64 0), i8* %4, i8* %2)
%6 = tail call i32 (i8*, i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %2)
%7 = tail call i32 @show_devs_tree(%struct.device* %0, i32 %1, i32 0, i32 -1)
ret void
}