void test_empty() {
  gc_init(1000);
  if (0 != gc_num_roots()) {
    printf("\n%-30s failure on line %d; expecting %d found %d\n", __func__, 38,
           0, gc_num_roots());
  };
  if (0 != gc_num_object()) {
    printf("\n%-30s failure on line %d; expecting %d found %d\n", __func__, 39,
           0, gc_num_object());
  };
  if (0 != gc_num_live_object()) {
    printf("\n%-30s failure on line %d; expecting %d found %d\n", __func__, 40,
           0, gc_num_live_object());
  };
  gc_done();
}


x86 assembly (clang, -O0):
<test_empty>:
push   %rbp
mov    %rsp,%rbp
mov    $0x3e8,%edi
mov    $0x0,%al
call   1040 <gc_init@plt>
mov    $0x0,%al
call   1030 <gc_num_roots@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    %ecx,%eax
je     11a9 <test_empty+0x49>
mov    $0x0,%al
call   1030 <gc_num_roots@plt>
mov    %eax,%r8d
lea    0xe6c(%rip),%rdi
lea    0xe97(%rip),%rsi
mov    $0x26,%edx
xor    %ecx,%ecx
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   1080 <gc_num_object@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    %ecx,%eax
je     11e2 <test_empty+0x82>
mov    $0x0,%al
call   1080 <gc_num_object@plt>
mov    %eax,%r8d
lea    0xe33(%rip),%rdi
lea    0xe5e(%rip),%rsi
mov    $0x27,%edx
xor    %ecx,%ecx
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   1070 <gc_num_live_object@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    %ecx,%eax
je     121b <test_empty+0xbb>
mov    $0x0,%al
call   1070 <gc_num_live_object@plt>
mov    %eax,%r8d
lea    0xdfa(%rip),%rdi
lea    0xe25(%rip),%rsi
mov    $0x28,%edx
xor    %ecx,%ecx
mov    $0x0,%al
call   1060 <printf@plt>
mov    $0x0,%al
call   1050 <gc_done@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_empty>:
push   %rax
mov    $0x3e8,%edi
xor    %eax,%eax
call   1040 <gc_init@plt>
xor    %eax,%eax
call   1030 <gc_num_roots@plt>
test   %eax,%eax
je     119e <test_empty+0x3e>
xor    %eax,%eax
call   1030 <gc_num_roots@plt>
lea    0xe7a(%rip),%rdi
lea    0xea5(%rip),%rsi
mov    $0x26,%edx
xor    %ecx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1080 <gc_num_object@plt>
test   %eax,%eax
je     11cf <test_empty+0x6f>
xor    %eax,%eax
call   1080 <gc_num_object@plt>
lea    0xe49(%rip),%rdi
lea    0xe74(%rip),%rsi
mov    $0x27,%edx
xor    %ecx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
call   1070 <gc_num_live_object@plt>
test   %eax,%eax
je     1200 <test_empty+0xa0>
xor    %eax,%eax
call   1070 <gc_num_live_object@plt>
lea    0xe18(%rip),%rdi
lea    0xe43(%rip),%rsi
mov    $0x28,%edx
xor    %ecx,%ecx
mov    %eax,%r8d
xor    %eax,%eax
call   1060 <printf@plt>
xor    %eax,%eax
pop    %rcx
jmp    1050 <gc_done@plt>

LLVM IR (-O0):
@.str = [50 x i8] c"\0A%-30s failure on line %d; expecting %d found %d\0A\00"
@__func__.test_empty = [11 x i8] c"test_empty\00"
define void @test_empty() {
%1 = call i32 (i32, ...) bitcast (i32 (...)* @gc_init to i32 (i32, ...)*)(i32 1000)
%2 = call i32 (...) @gc_num_roots()
%3 = icmp ne i32 0, %2
br i1 %3, label %4, label %7
4: ; preds = %0
%5 = call i32 (...) @gc_num_roots()
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__func__.test_empty, i64 0, i64 0), i32 38, i32 0, i32 %5)
br label %7
7: ; preds = %4, %0
%8 = call i32 (...) @gc_num_object()
%9 = icmp ne i32 0, %8
br i1 %9, label %10, label %13
10: ; preds = %7
%11 = call i32 (...) @gc_num_object()
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__func__.test_empty, i64 0, i64 0), i32 39, i32 0, i32 %11)
br label %13
13: ; preds = %10, %7
%14 = call i32 (...) @gc_num_live_object()
%15 = icmp ne i32 0, %14
br i1 %15, label %16, label %19
16: ; preds = %13
%17 = call i32 (...) @gc_num_live_object()
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__func__.test_empty, i64 0, i64 0), i32 40, i32 0, i32 %17)
br label %19
19: ; preds = %16, %13
%20 = call i32 (...) @gc_done()
ret void
}

LLVM IR (-O2):
@.str = [50 x i8] c"\0A%-30s failure on line %d; expecting %d found %d\0A\00"
@__func__.test_empty = [11 x i8] c"test_empty\00"
define void @test_empty() {
%1 = tail call i32 (i32, ...) bitcast (i32 (...)* @gc_init to i32 (i32, ...)*)(i32 1000)
%2 = tail call i32 (...) @gc_num_roots()
%3 = icmp eq i32 %2, 0
br i1 %3, label %7, label %4
4: ; preds = %0
%5 = tail call i32 (...) @gc_num_roots()
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__func__.test_empty, i64 0, i64 0), i32 38, i32 0, i32 %5)
br label %7
7: ; preds = %4, %0
%8 = tail call i32 (...) @gc_num_object()
%9 = icmp eq i32 %8, 0
br i1 %9, label %13, label %10
10: ; preds = %7
%11 = tail call i32 (...) @gc_num_object()
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__func__.test_empty, i64 0, i64 0), i32 39, i32 0, i32 %11)
br label %13
13: ; preds = %10, %7
%14 = tail call i32 (...) @gc_num_live_object()
%15 = icmp eq i32 %14, 0
br i1 %15, label %19, label %16
16: ; preds = %13
%17 = tail call i32 (...) @gc_num_live_object()
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @__func__.test_empty, i64 0, i64 0), i32 40, i32 0, i32 %17)
br label %19
19: ; preds = %16, %13
%20 = tail call i32 (...) @gc_done()
ret void
}