#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 */
char *agetcwd();
int /*<<< orphan*/ craftev(char *);
int /*<<< orphan*/ dohotplug();
int /*<<< orphan*/ free(char *);
int /*<<< orphan*/ recurse(char const *, void (*)(char const *));
scalar_t__ strcmp(char const *, char *);
void populatedev(const char *path) {
  char *cwd;
  recurse(path, populatedev);
  if (strcmp(path, "dev") == 0) {
    cwd = agetcwd();
    if (!craftev(cwd))
      dohotplug();
    free(cwd);
  }
}


x86 assembly (clang, -O0):
<populatedev>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2e61(%rip),%rsi
call   1030 <recurse@plt>
mov    -0x8(%rbp),%rdi
lea    0xe79(%rip),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
jne    11c3 <populatedev+0x63>
mov    $0x0,%al
call   1070 <agetcwd@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1080 <craftev@plt>
cmp    $0x0,%eax
jne    11ba <populatedev+0x5a>
mov    $0x0,%al
call   1050 <dohotplug@plt>
mov    -0x10(%rbp),%rdi
call   1040 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<populatedev>:
push   %rbx
mov    %rdi,%rbx
mov    0x2e6d(%rip),%rsi
call   1030 <recurse@plt>
lea    0xe89(%rip),%rsi
mov    %rbx,%rdi
call   1060 <strcmp@plt>
test   %rax,%rax
je     1186 <populatedev+0x26>
pop    %rbx
ret
xor    %eax,%eax
call   1070 <agetcwd@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1080 <craftev@plt>
test   %eax,%eax
jne    11a3 <populatedev+0x43>
xor    %eax,%eax
call   1050 <dohotplug@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1040 <free@plt>

LLVM IR (-O0):
@.str = [4 x i8] c"dev\00"
define void @populatedev(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i32 @recurse(i8* %4, void (i8*)* @populatedev)
%6 = load i8*, i8** %2
%7 = call i64 @strcmp(i8* %6, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %19
9: ; preds = %1
%10 = call i8* (...) @agetcwd()
store i8* %10, i8** %3
%11 = load i8*, i8** %3
%12 = call i32 @craftev(i8* %11)
%13 = icmp ne i32 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %9
%15 = call i32 (...) @dohotplug()
br label %16
16: ; preds = %14, %9
%17 = load i8*, i8** %3
%18 = call i32 @free(i8* %17)
br label %19
19: ; preds = %16, %1
ret void
}

LLVM IR (-O2):
@.str = [4 x i8] c"dev\00"
define void @populatedev(i8* %0) {
%2 = tail call i32 @recurse(i8* %0, void (i8*)* @populatedev)
%3 = tail call i64 @strcmp(i8* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %13
5: ; preds = %1
%6 = tail call i8* (...) @agetcwd()
%7 = tail call i32 @craftev(i8* %6)
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %5
%10 = tail call i32 (...) @dohotplug()
br label %11
11: ; preds = %9, %5
%12 = tail call i32 @free(i8* %6)
br label %13
13: ; preds = %11, %1
ret void
}