#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 */

/* Variables and functions */
int /*<<< orphan*/ Uart_Printf(char *, ...);
void Printf_Regs(int r0, int r1, int r2, int r3) {
  int *addr;
  Uart_Printf("R0-R4:%x %x %x %x\n", r0, r1, r2, r3);
  addr = (int *)(r1 + r0 * 4);
  Uart_Printf("addr:%x,[addr]:%x\n", addr, *addr);
  Uart_Printf("&pISR_TIMER0:%x pISR_TIMER0:%x\n",
              &(*(unsigned *)(0x3fff0000 + 0x74)),
              (*(unsigned *)(0x3fff0000 + 0x74)));
}


x86 assembly (clang, -O0):
<Printf_Regs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
mov    -0x10(%rbp),%r8d
lea    0xec8(%rip),%rdi
mov    $0x0,%al
call   1030 <Uart_Printf@plt>
mov    -0x8(%rbp),%eax
mov    -0x4(%rbp),%ecx
shl    $0x2,%ecx
add    %ecx,%eax
cltq
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    (%rax),%edx
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <Uart_Printf@plt>
mov    $0x3fff0074,%eax
mov    (%rax),%edx
lea    0xeb0(%rip),%rdi
mov    $0x3fff0074,%esi
mov    $0x0,%al
call   1030 <Uart_Printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Printf_Regs>:
push   %rbp
push   %rbx
push   %rax
mov    %ecx,%r8d
mov    %edx,%ecx
mov    %esi,%ebx
mov    %edi,%ebp
lea    0xedd(%rip),%rdi
mov    %ebp,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1030 <Uart_Printf@plt>
movslq %ebp,%rax
movslq %ebx,%rcx
lea    (%rcx,%rax,4),%rsi
mov    (%rcx,%rax,4),%edx
lea    0xed1(%rip),%rdi
xor    %eax,%eax
call   1030 <Uart_Printf@plt>
mov    0x3fff0074,%edx
lea    0xecf(%rip),%rdi
mov    $0x3fff0074,%esi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <Uart_Printf@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"R0-R4:%x %x %x %x\0A\00"
@.str.1 = [19 x i8] c"addr:%x,[addr]:%x\0A\00"
@.str.2 = [32 x i8] c"&pISR_TIMER0:%x pISR_TIMER0:%x\0A\00"
define void @Printf_Regs(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32*
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
%10 = load i32, i32* %5
%11 = load i32, i32* %6
%12 = load i32, i32* %7
%13 = load i32, i32* %8
%14 = call i32 (i8*, ...) @Uart_Printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %11, i32 %12, i32 %13)
%15 = load i32, i32* %6
%16 = load i32, i32* %5
%17 = mul nsw i32 %16, 4
%18 = add nsw i32 %15, %17
%19 = sext i32 %18 to i64
%20 = inttoptr i64 %19 to i32*
store i32* %20, i32** %9
%21 = load i32*, i32** %9
%22 = load i32*, i32** %9
%23 = load i32, i32* %22
%24 = call i32 (i8*, ...) @Uart_Printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32* %21, i32 %23)
%25 = load i32, i32* inttoptr (i64 1073676404 to i32*)
%26 = call i32 (i8*, ...) @Uart_Printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32* inttoptr (i64 1073676404 to i32*), i32 %25)
ret void
}

LLVM IR (-O2):
@.str = [19 x i8] c"R0-R4:%x %x %x %x\0A\00"
@.str.1 = [19 x i8] c"addr:%x,[addr]:%x\0A\00"
@.str.2 = [32 x i8] c"&pISR_TIMER0:%x pISR_TIMER0:%x\0A\00"
define void @Printf_Regs(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = tail call i32 (i8*, ...) @Uart_Printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0), i32 %0, i32 %1, i32 %2, i32 %3)
%6 = shl nsw i32 %0, 2
%7 = add nsw i32 %6, %1
%8 = sext i32 %7 to i64
%9 = inttoptr i64 %8 to i32*
%10 = load i32, i32* %9
%11 = tail call i32 (i8*, ...) @Uart_Printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32* %9, i32 %10)
%12 = load i32, i32* inttoptr (i64 1073676404 to i32*)
%13 = tail call i32 (i8*, ...) @Uart_Printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.2, i64 0, i64 0), i32* inttoptr (i64 1073676404 to i32*), i32 %12)
ret void
}