void create_non_empty_dir(const char dir[], const char file[]) {
  create_empty_dir(dir);
  do {
    seatest_assert_int_equal(0, chdir(dir), __FUNCTION__, 16);
  } while (0);
  create_empty_file(file);
  do {
    seatest_assert_int_equal(0, chdir(".."), __FUNCTION__, 18);
  } while (0);
}


x86 assembly (clang, -O0):
<create_non_empty_dir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1040 <create_empty_dir@plt>
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1030 <chdir@plt>
mov    %eax,%esi
xor    %edi,%edi
lea    0xe8f(%rip),%rdx
mov    $0x10,%ecx
mov    $0x0,%al
call   1050 <seatest_assert_int_equal@plt>
mov    -0x10(%rbp),%rdi
mov    $0x0,%al
call   1060 <create_empty_file@plt>
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1030 <chdir@plt>
mov    %eax,%esi
xor    %edi,%edi
lea    0xe5f(%rip),%rdx
mov    $0x12,%ecx
mov    $0x0,%al
call   1050 <seatest_assert_int_equal@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<create_non_empty_dir>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <create_empty_dir@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <chdir@plt>
lea    0xe9e(%rip),%rbx
xor    %edi,%edi
mov    %eax,%esi
mov    %rbx,%rdx
mov    $0x10,%ecx
xor    %eax,%eax
call   1050 <seatest_assert_int_equal@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1060 <create_empty_file@plt>
lea    0xe8f(%rip),%rdi
xor    %eax,%eax
call   1030 <chdir@plt>
xor    %edi,%edi
mov    %eax,%esi
mov    %rbx,%rdx
mov    $0x12,%ecx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1050 <seatest_assert_int_equal@plt>

LLVM IR (-O0):
@__FUNCTION__.create_non_empty_dir = [21 x i8] c"create_non_empty_dir\00"
@.str = [3 x i8] c"..\00"
define void @create_non_empty_dir(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = call i32 (i8*, ...) bitcast (i32 (...)* @create_empty_dir to i32 (i8*, ...)*)(i8* %5)
br label %7
7: ; preds = %2
%8 = load i8*, i8** %3
%9 = call i32 (i8*, ...) bitcast (i32 (...)* @chdir to i32 (i8*, ...)*)(i8* %8)
%10 = call i32 (i32, i32, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_int_equal to i32 (i32, i32, i8*, i32, ...)*)(i32 0, i32 %9, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @__FUNCTION__.create_non_empty_dir, i64 0, i64 0), i32 16)
br label %11
11: ; preds = %7
%12 = load i8*, i8** %4
%13 = call i32 (i8*, ...) bitcast (i32 (...)* @create_empty_file to i32 (i8*, ...)*)(i8* %12)
br label %14
14: ; preds = %11
%15 = call i32 (i8*, ...) bitcast (i32 (...)* @chdir to i32 (i8*, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%16 = call i32 (i32, i32, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_int_equal to i32 (i32, i32, i8*, i32, ...)*)(i32 0, i32 %15, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @__FUNCTION__.create_non_empty_dir, i64 0, i64 0), i32 18)
br label %17
17: ; preds = %14
ret void
}

LLVM IR (-O2):
@__FUNCTION__.create_non_empty_dir = [21 x i8] c"create_non_empty_dir\00"
@.str = [3 x i8] c"..\00"
define void @create_non_empty_dir(i8* %0, i8* %1) {
%3 = tail call i32 (i8*, ...) bitcast (i32 (...)* @create_empty_dir to i32 (i8*, ...)*)(i8* %0)
%4 = tail call i32 (i8*, ...) bitcast (i32 (...)* @chdir to i32 (i8*, ...)*)(i8* %0)
%5 = tail call i32 (i32, i32, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_int_equal to i32 (i32, i32, i8*, i32, ...)*)(i32 0, i32 %4, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @__FUNCTION__.create_non_empty_dir, i64 0, i64 0), i32 16)
%6 = tail call i32 (i8*, ...) bitcast (i32 (...)* @create_empty_file to i32 (i8*, ...)*)(i8* %1)
%7 = tail call i32 (i8*, ...) bitcast (i32 (...)* @chdir to i32 (i8*, ...)*)(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 (i32, i32, i8*, i32, ...) bitcast (i32 (...)* @seatest_assert_int_equal to i32 (i32, i32, i8*, i32, ...)*)(i32 0, i32 %7, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @__FUNCTION__.create_non_empty_dir, i64 0, i64 0), i32 18)
ret void
}