void sd_print_item(struct item_head *ih, char *item) {
  printk("\tmode | size | nlinks | first direct | mtime\n");
  if (stat_data_v1(ih)) {
    struct stat_data_v1 *sd = (struct stat_data_v1 *)item;
    printk("\t0%-6o | %6u | %2u | %d | %s\n", sd_v1_mode(sd), sd_v1_size(sd),
           sd_v1_nlink(sd), sd_v1_first_direct_byte(sd),
           print_time(sd_v1_mtime(sd)));
  } else {
    struct stat_data *sd = (struct stat_data *)item;
    printk("\t0%-6o | %6Lu | %2u | %d | %s\n", sd_v2_mode(sd),
           (unsigned long long)sd_v2_size(sd), sd_v2_nlink(sd), sd_v2_rdev(sd),
           print_time(sd_v2_mtime(sd)));
  }
}


x86 assembly (clang, -O0):
<sd_print_item>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe19(%rip),%rdi
mov    $0x0,%al
call   1030 <printk@plt>
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1070 <stat_data_v1@plt>
cmp    $0x0,%eax
je     1279 <sd_print_item+0xa9>
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x0,%al
call   10d0 <sd_v1_mode@plt>
mov    %eax,-0x30(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x0,%al
call   10f0 <sd_v1_size@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x0,%al
call   1060 <sd_v1_nlink@plt>
mov    %eax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x0,%al
call   10a0 <sd_v1_first_direct_byte@plt>
mov    %eax,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
mov    $0x0,%al
call   1040 <sd_v1_mtime@plt>
mov    %eax,%edi
mov    $0x0,%al
call   10b0 <print_time@plt>
mov    -0x30(%rbp),%esi
mov    -0x2c(%rbp),%edx
mov    -0x28(%rbp),%ecx
mov    -0x24(%rbp),%r8d
mov    %eax,%r9d
lea    0xdc1(%rip),%rdi
mov    $0x0,%al
call   1030 <printk@plt>
jmp    12ef <sd_print_item+0x11f>
mov    -0x10(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    $0x0,%al
call   1080 <sd_v2_mode@plt>
mov    %eax,-0x44(%rbp)
mov    -0x20(%rbp),%rdi
mov    $0x0,%al
call   10c0 <sd_v2_size@plt>
cltq
mov    %rax,-0x40(%rbp)
mov    -0x20(%rbp),%rdi
mov    $0x0,%al
call   1090 <sd_v2_nlink@plt>
mov    %eax,-0x38(%rbp)
mov    -0x20(%rbp),%rdi
mov    $0x0,%al
call   10e0 <sd_v2_rdev@plt>
mov    %eax,-0x34(%rbp)
mov    -0x20(%rbp),%rdi
mov    $0x0,%al
call   1050 <sd_v2_mtime@plt>
mov    %eax,%edi
mov    $0x0,%al
call   10b0 <print_time@plt>
mov    -0x44(%rbp),%esi
mov    -0x40(%rbp),%rdx
mov    -0x38(%rbp),%ecx
mov    -0x34(%rbp),%r8d
mov    %eax,%r9d
lea    0xd64(%rip),%rdi
mov    $0x0,%al
call   1030 <printk@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sd_print_item>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rsi,%rbx
mov    %rdi,%rbp
lea    0xe1b(%rip),%rdi
xor    %eax,%eax
call   1030 <printk@plt>
mov    %rbp,%rdi
xor    %eax,%eax
call   1070 <stat_data_v1@plt>
mov    %rbx,%rdi
test   %eax,%eax
je     1265 <sd_print_item+0x95>
xor    %eax,%eax
call   10d0 <sd_v1_mode@plt>
mov    %eax,%r14d
mov    %rbx,%rdi
xor    %eax,%eax
call   10f0 <sd_v1_size@plt>
mov    %eax,%r15d
mov    %rbx,%rdi
xor    %eax,%eax
call   1060 <sd_v1_nlink@plt>
mov    %eax,%r12d
mov    %rbx,%rdi
xor    %eax,%eax
call   10a0 <sd_v1_first_direct_byte@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <sd_v1_mtime@plt>
mov    %eax,%edi
xor    %eax,%eax
call   10b0 <print_time@plt>
lea    0xde7(%rip),%rdi
mov    %r14d,%esi
mov    %r15d,%edx
mov    %r12d,%ecx
mov    %ebp,%r8d
mov    %eax,%r9d
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <printk@plt>
xor    %eax,%eax
call   1080 <sd_v2_mode@plt>
mov    %eax,%r14d
mov    %rbx,%rdi
xor    %eax,%eax
call   10c0 <sd_v2_size@plt>
movslq %eax,%r15
mov    %rbx,%rdi
xor    %eax,%eax
call   1090 <sd_v2_nlink@plt>
mov    %eax,%r12d
mov    %rbx,%rdi
xor    %eax,%eax
call   10e0 <sd_v2_rdev@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
xor    %eax,%eax
call   1050 <sd_v2_mtime@plt>
mov    %eax,%edi
xor    %eax,%eax
call   10b0 <print_time@plt>
lea    0xd9d(%rip),%rdi
mov    %r14d,%esi
mov    %r15,%rdx
mov    %r12d,%ecx
mov    %ebp,%r8d
mov    %eax,%r9d
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <printk@plt>

LLVM IR (-O0):
%struct.item_head = type opaque
%struct.stat_data_v1 = type opaque
%struct.stat_data = type opaque
@.str = [46 x i8] c"\09mode | size | nlinks | first direct | mtime\0A\00"
@.str.1 = [30 x i8] c"\090%-6o | %6u | %2u | %d | %s\0A\00"
@.str.2 = [31 x i8] c"\090%-6o | %6Lu | %2u | %d | %s\0A\00"
define void @sd_print_item(%struct.item_head* %0, i8* %1) {
%3 = alloca %struct.item_head*
%4 = alloca i8*
%5 = alloca %struct.stat_data_v1*
%6 = alloca %struct.stat_data*
store %struct.item_head* %0, %struct.item_head** %3
store i8* %1, i8** %4
%7 = call i32 (i8*, ...) bitcast (i32 (...)* @printk to i32 (i8*, ...)*)(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%8 = load %struct.item_head*, %struct.item_head** %3
%9 = call i32 (%struct.item_head*, ...) bitcast (i32 (...)* @stat_data_v1 to i32 (%struct.item_head*, ...)*)(%struct.item_head* %8)
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %26
11: ; preds = %2
%12 = load i8*, i8** %4
%13 = bitcast i8* %12 to %struct.stat_data_v1*
store %struct.stat_data_v1* %13, %struct.stat_data_v1** %5
%14 = load %struct.stat_data_v1*, %struct.stat_data_v1** %5
%15 = call i32 (%struct.stat_data_v1*, ...) bitcast (i32 (...)* @sd_v1_mode to i32 (%struct.stat_data_v1*, ...)*)(%struct.stat_data_v1* %14)
%16 = load %struct.stat_data_v1*, %struct.stat_data_v1** %5
%17 = call i32 (%struct.stat_data_v1*, ...) bitcast (i32 (...)* @sd_v1_size to i32 (%struct.stat_data_v1*, ...)*)(%struct.stat_data_v1* %16)
%18 = load %struct.stat_data_v1*, %struct.stat_data_v1** %5
%19 = call i32 (%struct.stat_data_v1*, ...) bitcast (i32 (...)* @sd_v1_nlink to i32 (%struct.stat_data_v1*, ...)*)(%struct.stat_data_v1* %18)
%20 = load %struct.stat_data_v1*, %struct.stat_data_v1** %5
%21 = call i32 (%struct.stat_data_v1*, ...) bitcast (i32 (...)* @sd_v1_first_direct_byte to i32 (%struct.stat_data_v1*, ...)*)(%struct.stat_data_v1* %20)
%22 = load %struct.stat_data_v1*, %struct.stat_data_v1** %5
%23 = call i32 (%struct.stat_data_v1*, ...) bitcast (i32 (...)* @sd_v1_mtime to i32 (%struct.stat_data_v1*, ...)*)(%struct.stat_data_v1* %22)
%24 = call i32 (i32, ...) bitcast (i32 (...)* @print_time to i32 (i32, ...)*)(i32 %23)
%25 = call i32 (i8*, i32, i32, i32, i32, i32, ...) bitcast (i32 (...)* @printk to i32 (i8*, i32, i32, i32, i32, i32, ...)*)(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %15, i32 %17, i32 %19, i32 %21, i32 %24)
br label %42
26: ; preds = %2
%27 = load i8*, i8** %4
%28 = bitcast i8* %27 to %struct.stat_data*
store %struct.stat_data* %28, %struct.stat_data** %6
%29 = load %struct.stat_data*, %struct.stat_data** %6
%30 = call i32 (%struct.stat_data*, ...) bitcast (i32 (...)* @sd_v2_mode to i32 (%struct.stat_data*, ...)*)(%struct.stat_data* %29)
%31 = load %struct.stat_data*, %struct.stat_data** %6
%32 = call i32 (%struct.stat_data*, ...) bitcast (i32 (...)* @sd_v2_size to i32 (%struct.stat_data*, ...)*)(%struct.stat_data* %31)
%33 = sext i32 %32 to i64
%34 = load %struct.stat_data*, %struct.stat_data** %6
%35 = call i32 (%struct.stat_data*, ...) bitcast (i32 (...)* @sd_v2_nlink to i32 (%struct.stat_data*, ...)*)(%struct.stat_data* %34)
%36 = load %struct.stat_data*, %struct.stat_data** %6
%37 = call i32 (%struct.stat_data*, ...) bitcast (i32 (...)* @sd_v2_rdev to i32 (%struct.stat_data*, ...)*)(%struct.stat_data* %36)
%38 = load %struct.stat_data*, %struct.stat_data** %6
%39 = call i32 (%struct.stat_data*, ...) bitcast (i32 (...)* @sd_v2_mtime to i32 (%struct.stat_data*, ...)*)(%struct.stat_data* %38)
%40 = call i32 (i32, ...) bitcast (i32 (...)* @print_time to i32 (i32, ...)*)(i32 %39)
%41 = call i32 (i8*, i32, i64, i32, i32, i32, ...) bitcast (i32 (...)* @printk to i32 (i8*, i32, i64, i32, i32, i32, ...)*)(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 %30, i64 %33, i32 %35, i32 %37, i32 %40)
br label %42
42: ; preds = %26, %11
ret void
}

LLVM IR (-O2):
%struct.item_head = type opaque
%struct.stat_data_v1 = type opaque
%struct.stat_data = type opaque
@.str = [46 x i8] c"\09mode | size | nlinks | first direct | mtime\0A\00"
@.str.1 = [30 x i8] c"\090%-6o | %6u | %2u | %d | %s\0A\00"
@.str.2 = [31 x i8] c"\090%-6o | %6Lu | %2u | %d | %s\0A\00"
define void @sd_print_item(%struct.item_head* %0, i8* %1) {
%3 = tail call i32 (i8*, ...) bitcast (i32 (...)* @printk to i32 (i8*, ...)*)(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 (%struct.item_head*, ...) bitcast (i32 (...)* @stat_data_v1 to i32 (%struct.item_head*, ...)*)(%struct.item_head* %0)
%5 = icmp eq i32 %4, 0
br i1 %5, label %15, label %6
6: ; preds = %2
%7 = bitcast i8* %1 to %struct.stat_data_v1*
%8 = tail call i32 (%struct.stat_data_v1*, ...) bitcast (i32 (...)* @sd_v1_mode to i32 (%struct.stat_data_v1*, ...)*)(%struct.stat_data_v1* %7)
%9 = tail call i32 (%struct.stat_data_v1*, ...) bitcast (i32 (...)* @sd_v1_size to i32 (%struct.stat_data_v1*, ...)*)(%struct.stat_data_v1* %7)
%10 = tail call i32 (%struct.stat_data_v1*, ...) bitcast (i32 (...)* @sd_v1_nlink to i32 (%struct.stat_data_v1*, ...)*)(%struct.stat_data_v1* %7)
%11 = tail call i32 (%struct.stat_data_v1*, ...) bitcast (i32 (...)* @sd_v1_first_direct_byte to i32 (%struct.stat_data_v1*, ...)*)(%struct.stat_data_v1* %7)
%12 = tail call i32 (%struct.stat_data_v1*, ...) bitcast (i32 (...)* @sd_v1_mtime to i32 (%struct.stat_data_v1*, ...)*)(%struct.stat_data_v1* %7)
%13 = tail call i32 (i32, ...) bitcast (i32 (...)* @print_time to i32 (i32, ...)*)(i32 %12)
%14 = tail call i32 (i8*, i32, i32, i32, i32, i32, ...) bitcast (i32 (...)* @printk to i32 (i8*, i32, i32, i32, i32, i32, ...)*)(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.1, i64 0, i64 0), i32 %8, i32 %9, i32 %10, i32 %11, i32 %13)
br label %25
15: ; preds = %2
%16 = bitcast i8* %1 to %struct.stat_data*
%17 = tail call i32 (%struct.stat_data*, ...) bitcast (i32 (...)* @sd_v2_mode to i32 (%struct.stat_data*, ...)*)(%struct.stat_data* %16)
%18 = tail call i32 (%struct.stat_data*, ...) bitcast (i32 (...)* @sd_v2_size to i32 (%struct.stat_data*, ...)*)(%struct.stat_data* %16)
%19 = sext i32 %18 to i64
%20 = tail call i32 (%struct.stat_data*, ...) bitcast (i32 (...)* @sd_v2_nlink to i32 (%struct.stat_data*, ...)*)(%struct.stat_data* %16)
%21 = tail call i32 (%struct.stat_data*, ...) bitcast (i32 (...)* @sd_v2_rdev to i32 (%struct.stat_data*, ...)*)(%struct.stat_data* %16)
%22 = tail call i32 (%struct.stat_data*, ...) bitcast (i32 (...)* @sd_v2_mtime to i32 (%struct.stat_data*, ...)*)(%struct.stat_data* %16)
%23 = tail call i32 (i32, ...) bitcast (i32 (...)* @print_time to i32 (i32, ...)*)(i32 %22)
%24 = tail call i32 (i8*, i32, i64, i32, i32, i32, ...) bitcast (i32 (...)* @printk to i32 (i8*, i32, i64, i32, i32, i32, ...)*)(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0), i32 %17, i64 %19, i32 %20, i32 %21, i32 %23)
br label %25
25: ; preds = %15, %6
ret void
}