void ls1c_spi_print_all_regs_info(void *spi_base) {
  printf("[%s] SPCR=0x%x, SPSR=0x%x, SPER=0x%x, SFC_PARAM=0x%x, "
         "SFC_SOFTCS=0x%x, SFC_TIMING=0x%x\r\n",
         __FUNCTION__, reg_read_8(spi_base + (0)), reg_read_8(spi_base + (1)),
         reg_read_8(spi_base + (3)), reg_read_8(spi_base + (4)),
         reg_read_8(spi_base + (5)), reg_read_8(spi_base + (6)));
  return;
}


x86 assembly (clang, -O0):
<ls1c_spi_print_all_regs_info>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x0,%al
call   1040 <reg_read_8@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x1,%rdi
mov    $0x0,%al
call   1040 <reg_read_8@plt>
mov    %eax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x3,%rdi
mov    $0x0,%al
call   1040 <reg_read_8@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x4,%rdi
mov    $0x0,%al
call   1040 <reg_read_8@plt>
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x5,%rdi
mov    $0x0,%al
call   1040 <reg_read_8@plt>
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
add    $0x6,%rdi
mov    $0x0,%al
call   1040 <reg_read_8@plt>
mov    -0x1c(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x14(%rbp),%r8d
mov    -0x10(%rbp),%r9d
mov    -0xc(%rbp),%r10d
lea    0xe56(%rip),%rdi
lea    0xea8(%rip),%rsi
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ls1c_spi_print_all_regs_info>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdi,%rbx
xor    %eax,%eax
call   1040 <reg_read_8@plt>
mov    %eax,%r14d
lea    0x1(%rbx),%rdi
xor    %eax,%eax
call   1040 <reg_read_8@plt>
mov    %eax,%r15d
lea    0x3(%rbx),%rdi
xor    %eax,%eax
call   1040 <reg_read_8@plt>
mov    %eax,%r12d
lea    0x4(%rbx),%rdi
xor    %eax,%eax
call   1040 <reg_read_8@plt>
mov    %eax,%r13d
lea    0x5(%rbx),%rdi
xor    %eax,%eax
call   1040 <reg_read_8@plt>
mov    %eax,%ebp
add    $0x6,%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <reg_read_8@plt>
mov    %eax,%ebx
lea    0xe7a(%rip),%rdi
lea    0xecc(%rip),%rsi
mov    %r14d,%edx
mov    %r15d,%ecx
mov    %r12d,%r8d
mov    %r13d,%r9d
xor    %eax,%eax
push   %rbx
push   %rbp
call   1030 <printf@plt>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [89 x i8] c"[%s] SPCR=0x%x, SPSR=0x%x, SPER=0x%x, SFC_PARAM=0x%x, SFC_SOFTCS=0x%x, SFC_TIMING=0x%x\0D\0A\00"
@__FUNCTION__.ls1c_spi_print_all_regs_info = [29 x i8] c"ls1c_spi_print_all_regs_info\00"
define void @ls1c_spi_print_all_regs_info(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = getelementptr i8, i8* %3, i64 0
%5 = call i32 (i8*, ...) bitcast (i32 (...)* @reg_read_8 to i32 (i8*, ...)*)(i8* %4)
%6 = load i8*, i8** %2
%7 = getelementptr i8, i8* %6, i64 1
%8 = call i32 (i8*, ...) bitcast (i32 (...)* @reg_read_8 to i32 (i8*, ...)*)(i8* %7)
%9 = load i8*, i8** %2
%10 = getelementptr i8, i8* %9, i64 3
%11 = call i32 (i8*, ...) bitcast (i32 (...)* @reg_read_8 to i32 (i8*, ...)*)(i8* %10)
%12 = load i8*, i8** %2
%13 = getelementptr i8, i8* %12, i64 4
%14 = call i32 (i8*, ...) bitcast (i32 (...)* @reg_read_8 to i32 (i8*, ...)*)(i8* %13)
%15 = load i8*, i8** %2
%16 = getelementptr i8, i8* %15, i64 5
%17 = call i32 (i8*, ...) bitcast (i32 (...)* @reg_read_8 to i32 (i8*, ...)*)(i8* %16)
%18 = load i8*, i8** %2
%19 = getelementptr i8, i8* %18, i64 6
%20 = call i32 (i8*, ...) bitcast (i32 (...)* @reg_read_8 to i32 (i8*, ...)*)(i8* %19)
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([89 x i8], [89 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @__FUNCTION__.ls1c_spi_print_all_regs_info, i64 0, i64 0), i32 %5, i32 %8, i32 %11, i32 %14, i32 %17, i32 %20)
ret void
}

LLVM IR (-O2):
@.str = [89 x i8] c"[%s] SPCR=0x%x, SPSR=0x%x, SPER=0x%x, SFC_PARAM=0x%x, SFC_SOFTCS=0x%x, SFC_TIMING=0x%x\0D\0A\00"
@__FUNCTION__.ls1c_spi_print_all_regs_info = [29 x i8] c"ls1c_spi_print_all_regs_info\00"
define void @ls1c_spi_print_all_regs_info(i8* %0) {
%2 = tail call i32 (i8*, ...) bitcast (i32 (...)* @reg_read_8 to i32 (i8*, ...)*)(i8* %0)
%3 = getelementptr i8, i8* %0, i64 1
%4 = tail call i32 (i8*, ...) bitcast (i32 (...)* @reg_read_8 to i32 (i8*, ...)*)(i8* %3)
%5 = getelementptr i8, i8* %0, i64 3
%6 = tail call i32 (i8*, ...) bitcast (i32 (...)* @reg_read_8 to i32 (i8*, ...)*)(i8* %5)
%7 = getelementptr i8, i8* %0, i64 4
%8 = tail call i32 (i8*, ...) bitcast (i32 (...)* @reg_read_8 to i32 (i8*, ...)*)(i8* %7)
%9 = getelementptr i8, i8* %0, i64 5
%10 = tail call i32 (i8*, ...) bitcast (i32 (...)* @reg_read_8 to i32 (i8*, ...)*)(i8* %9)
%11 = getelementptr i8, i8* %0, i64 6
%12 = tail call i32 (i8*, ...) bitcast (i32 (...)* @reg_read_8 to i32 (i8*, ...)*)(i8* %11)
%13 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([89 x i8], [89 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @__FUNCTION__.ls1c_spi_print_all_regs_info, i64 0, i64 0), i32 %2, i32 %4, i32 %6, i32 %8, i32 %10, i32 %12)
ret void
}