#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*/ printf(char *, unsigned int, ...);
void tube_SWI_Not_Known(unsigned int *reg) {
  unsigned int *lr = (unsigned int *)reg[13];
  printf("%08x %08x %08x %08x\r\n", reg[0], reg[1], reg[2], reg[3]);
  printf("SWI %08x not implemented ************\r\n", *(lr - 1) & 0xFFFFFF);
}


x86 assembly (clang, -O0):
<tube_SWI_Not_Known>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x34(%rax),%eax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%esi
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%edx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%r8d
lea    0xeb6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%rax
mov    -0x4(%rax),%esi
and    $0xffffff,%esi
lea    0xeb1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<tube_SWI_Not_Known>:
push   %rbx
mov    0x34(%rdi),%ebx
mov    (%rdi),%esi
mov    0x4(%rdi),%edx
mov    0x8(%rdi),%ecx
mov    0xc(%rdi),%r8d
lea    0xed9(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0xffffff,%esi
and    -0x4(%rbx),%esi
lea    0xed9(%rip),%rdi
xor    %eax,%eax
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [22 x i8] c"%08x %08x %08x %08x\0D\0A\00"
@.str.1 = [40 x i8] c"SWI %08x not implemented ************\0D\0A\00"
define void @tube_SWI_Not_Known(i32* %0) {
%2 = alloca i32*
%3 = alloca i32*
store i32* %0, i32** %2
%4 = load i32*, i32** %2
%5 = getelementptr inbounds i32, i32* %4, i64 13
%6 = load i32, i32* %5
%7 = zext i32 %6 to i64
%8 = inttoptr i64 %7 to i32*
store i32* %8, i32** %3
%9 = load i32*, i32** %2
%10 = getelementptr inbounds i32, i32* %9, i64 0
%11 = load i32, i32* %10
%12 = load i32*, i32** %2
%13 = getelementptr inbounds i32, i32* %12, i64 1
%14 = load i32, i32* %13
%15 = load i32*, i32** %2
%16 = getelementptr inbounds i32, i32* %15, i64 2
%17 = load i32, i32* %16
%18 = load i32*, i32** %2
%19 = getelementptr inbounds i32, i32* %18, i64 3
%20 = load i32, i32* %19
%21 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %11, i32 %14, i32 %17, i32 %20)
%22 = load i32*, i32** %3
%23 = getelementptr inbounds i32, i32* %22, i64 -1
%24 = load i32, i32* %23
%25 = and i32 %24, 16777215
%26 = call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i32 %25)
ret void
}

LLVM IR (-O2):
@.str = [22 x i8] c"%08x %08x %08x %08x\0D\0A\00"
@.str.1 = [40 x i8] c"SWI %08x not implemented ************\0D\0A\00"
define void @tube_SWI_Not_Known(i32* nocapture %0) {
%2 = getelementptr inbounds i32, i32* %0, i64 13
%3 = load i32, i32* %2
%4 = zext i32 %3 to i64
%5 = inttoptr i64 %4 to i32*
%6 = load i32, i32* %0
%7 = getelementptr inbounds i32, i32* %0, i64 1
%8 = load i32, i32* %7
%9 = getelementptr inbounds i32, i32* %0, i64 2
%10 = load i32, i32* %9
%11 = getelementptr inbounds i32, i32* %0, i64 3
%12 = load i32, i32* %11
%13 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i32 %6, i32 %8, i32 %10, i32 %12)
%14 = getelementptr inbounds i32, i32* %5, i64 -1
%15 = load i32, i32* %14
%16 = and i32 %15, 16777215
%17 = tail call i32 (i8*, i32, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.1, i64 0, i64 0), i32 %16)
ret void
}