#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 cramfs_inode {
  int /*<<< orphan*/ mode;
};

/* Variables and functions */
scalar_t__ S_ISDIR(int /*<<< orphan*/);
scalar_t__ S_ISLNK(int /*<<< orphan*/);
scalar_t__ S_ISREG(int /*<<< orphan*/);
int /*<<< orphan*/ do_directory(char *, struct cramfs_inode *);
int /*<<< orphan*/ do_file(char *, struct cramfs_inode *);
int /*<<< orphan*/ do_special_inode(char *, struct cramfs_inode *);
int /*<<< orphan*/ do_symlink(char *, struct cramfs_inode *);
void expand_fs(char *path, struct cramfs_inode *inode) {
  if (S_ISDIR(inode->mode)) {
    do_directory(path, inode);
  } else if (S_ISREG(inode->mode)) {
    do_file(path, inode);
  } else if (S_ISLNK(inode->mode)) {
    do_symlink(path, inode);
  } else {
    do_special_inode(path, inode);
  }
}


x86 assembly (clang, -O0):
<expand_fs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
call   1060 <S_ISDIR@plt>
cmp    $0x0,%rax
je     11a7 <expand_fs+0x37>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1080 <do_directory@plt>
jmp    120c <expand_fs+0x9c>
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
call   1090 <S_ISREG@plt>
cmp    $0x0,%rax
je     11ce <expand_fs+0x5e>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <do_file@plt>
jmp    1207 <expand_fs+0x97>
mov    -0x10(%rbp),%rax
mov    (%rax),%edi
call   1040 <S_ISLNK@plt>
cmp    $0x0,%rax
je     11f5 <expand_fs+0x85>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1070 <do_symlink@plt>
jmp    1202 <expand_fs+0x92>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <do_special_inode@plt>
jmp    1207 <expand_fs+0x97>
jmp    120c <expand_fs+0x9c>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<expand_fs>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    (%rsi),%edi
call   1060 <S_ISDIR@plt>
test   %rax,%rax
je     1198 <expand_fs+0x28>
mov    %r14,%rdi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1080 <do_directory@plt>
mov    (%rbx),%edi
call   1090 <S_ISREG@plt>
test   %rax,%rax
je     11b6 <expand_fs+0x46>
mov    %r14,%rdi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <do_file@plt>
mov    (%rbx),%edi
call   1040 <S_ISLNK@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
add    $0x8,%rsp
test   %rax,%rax
je     11d4 <expand_fs+0x64>
pop    %rbx
pop    %r14
jmp    1070 <do_symlink@plt>
pop    %rbx
pop    %r14
jmp    1050 <do_special_inode@plt>

LLVM IR (-O0):
%struct.cramfs_inode = type { i32 }
define void @expand_fs(i8* %0, %struct.cramfs_inode* %1) {
%3 = alloca i8*
%4 = alloca %struct.cramfs_inode*
store i8* %0, i8** %3
store %struct.cramfs_inode* %1, %struct.cramfs_inode** %4
%5 = load %struct.cramfs_inode*, %struct.cramfs_inode** %4
%6 = getelementptr inbounds %struct.cramfs_inode, %struct.cramfs_inode* %5, i32 0, i32 0
%7 = load i32, i32* %6
%8 = call i64 @S_ISDIR(i32 %7)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %14
10: ; preds = %2
%11 = load i8*, i8** %3
%12 = load %struct.cramfs_inode*, %struct.cramfs_inode** %4
%13 = call i32 @do_directory(i8* %11, %struct.cramfs_inode* %12)
br label %40
14: ; preds = %2
%15 = load %struct.cramfs_inode*, %struct.cramfs_inode** %4
%16 = getelementptr inbounds %struct.cramfs_inode, %struct.cramfs_inode* %15, i32 0, i32 0
%17 = load i32, i32* %16
%18 = call i64 @S_ISREG(i32 %17)
%19 = icmp ne i64 %18, 0
br i1 %19, label %20, label %24
20: ; preds = %14
%21 = load i8*, i8** %3
%22 = load %struct.cramfs_inode*, %struct.cramfs_inode** %4
%23 = call i32 @do_file(i8* %21, %struct.cramfs_inode* %22)
br label %39
24: ; preds = %14
%25 = load %struct.cramfs_inode*, %struct.cramfs_inode** %4
%26 = getelementptr inbounds %struct.cramfs_inode, %struct.cramfs_inode* %25, i32 0, i32 0
%27 = load i32, i32* %26
%28 = call i64 @S_ISLNK(i32 %27)
%29 = icmp ne i64 %28, 0
br i1 %29, label %30, label %34
30: ; preds = %24
%31 = load i8*, i8** %3
%32 = load %struct.cramfs_inode*, %struct.cramfs_inode** %4
%33 = call i32 @do_symlink(i8* %31, %struct.cramfs_inode* %32)
br label %38
34: ; preds = %24
%35 = load i8*, i8** %3
%36 = load %struct.cramfs_inode*, %struct.cramfs_inode** %4
%37 = call i32 @do_special_inode(i8* %35, %struct.cramfs_inode* %36)
br label %38
38: ; preds = %34, %30
br label %39
39: ; preds = %38, %20
br label %40
40: ; preds = %39, %10
ret void
}

LLVM IR (-O2):
%struct.cramfs_inode = type { i32 }
define void @expand_fs(i8* %0, %struct.cramfs_inode* %1) {
%3 = getelementptr inbounds %struct.cramfs_inode, %struct.cramfs_inode* %1, i64 0, i32 0
%4 = load i32, i32* %3
%5 = tail call i64 @S_ISDIR(i32 %4)
%6 = icmp eq i64 %5, 0
br i1 %6, label %9, label %7
7: ; preds = %2
%8 = tail call i32 @do_directory(i8* %0, %struct.cramfs_inode* %1)
br label %23
9: ; preds = %2
%10 = load i32, i32* %3
%11 = tail call i64 @S_ISREG(i32 %10)
%12 = icmp eq i64 %11, 0
br i1 %12, label %15, label %13
13: ; preds = %9
%14 = tail call i32 @do_file(i8* %0, %struct.cramfs_inode* %1)
br label %23
15: ; preds = %9
%16 = load i32, i32* %3
%17 = tail call i64 @S_ISLNK(i32 %16)
%18 = icmp eq i64 %17, 0
br i1 %18, label %21, label %19
19: ; preds = %15
%20 = tail call i32 @do_symlink(i8* %0, %struct.cramfs_inode* %1)
br label %23
21: ; preds = %15
%22 = tail call i32 @do_special_inode(i8* %0, %struct.cramfs_inode* %1)
br label %23
23: ; preds = %13, %21, %19, %7
ret void
}