#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*/ ShortToHex(unsigned short, char *);
int /*<<< orphan*/ UART2_write_text(char *);
int /*<<< orphan*/ delay_ms(int);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
void Print_MPU_register(unsigned char registerAdress, unsigned char dat) {
  unsigned char dat_temp, mask;
  char stn_out[100], bit_string[10], adress_string[10];
  int i;
  mask = 0b00000001;
  for (i = 7; i >= 0; i--) {
    dat_temp = dat & mask;
    if (dat_temp > 0)
      bit_string[i] = '1';
    else
      bit_string[i] = '0';
    mask = mask << 1;
  }
  bit_string[9] = 0;
  ShortToHex((unsigned short)registerAdress, adress_string);
  strcpy(stn_out, "Adresse = 0x");
  strcat(stn_out, adress_string);
  strcat(stn_out, "  Inhalt = 0b");
  strcat(stn_out, bit_string);
  strcat(stn_out, "\x0D");
  UART2_write_text(stn_out);
  delay_ms(20);
}


x86 assembly (clang, -O0):
<Print_MPU_register>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %sil,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %al,-0x2(%rbp)
movb   $0x1,-0x4(%rbp)
movl   $0x7,-0x88(%rbp)
cmpl   $0x0,-0x88(%rbp)
jl     11d7 <Print_MPU_register+0x87>
movzbl -0x2(%rbp),%eax
movzbl -0x4(%rbp),%ecx
and    %ecx,%eax
mov    %al,-0x3(%rbp)
movzbl -0x3(%rbp),%eax
cmp    $0x0,%eax
jle    11ad <Print_MPU_register+0x5d>
movslq -0x88(%rbp),%rax
movb   $0x31,-0x7a(%rbp,%rax,1)
jmp    11b9 <Print_MPU_register+0x69>
movslq -0x88(%rbp),%rax
movb   $0x30,-0x7a(%rbp,%rax,1)
movzbl -0x4(%rbp),%eax
shl    $0x1,%eax
mov    %al,-0x4(%rbp)
mov    -0x88(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x88(%rbp)
jmp    1175 <Print_MPU_register+0x25>
movb   $0x0,-0x71(%rbp)
movzbl -0x1(%rbp),%eax
lea    -0x84(%rbp),%rsi
movzwl %ax,%edi
call   1050 <ShortToHex@plt>
lea    -0x70(%rbp),%rdi
lea    0xe07(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x70(%rbp),%rdi
lea    -0x84(%rbp),%rsi
call   1070 <strcat@plt>
lea    -0x70(%rbp),%rdi
lea    0xdf4(%rip),%rsi
call   1070 <strcat@plt>
lea    -0x70(%rbp),%rdi
lea    -0x7a(%rbp),%rsi
call   1070 <strcat@plt>
lea    -0x70(%rbp),%rdi
lea    0xde5(%rip),%rsi
call   1070 <strcat@plt>
lea    -0x70(%rbp),%rdi
call   1040 <UART2_write_text@plt>
mov    $0x14,%edi
call   1060 <delay_ms@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Print_MPU_register>:
push   %r14
push   %rbx
sub    $0x88,%rsp
mov    %esi,%eax
and    $0x1,%al
or     $0x30,%al
mov    %al,0x13(%rsp)
mov    %esi,%eax
and    $0x2,%al
cmp    $0x1,%al
mov    $0x31,%al
mov    $0x31,%cl
sbb    $0x0,%cl
mov    %cl,0x12(%rsp)
mov    %esi,%ecx
and    $0x4,%cl
cmp    $0x1,%cl
mov    $0x31,%cl
sbb    $0x0,%cl
mov    %cl,0x11(%rsp)
mov    %esi,%ecx
and    $0x8,%cl
cmp    $0x1,%cl
mov    $0x31,%cl
sbb    $0x0,%cl
mov    %cl,0x10(%rsp)
mov    %esi,%ecx
and    $0x10,%cl
cmp    $0x1,%cl
mov    $0x31,%cl
sbb    $0x0,%cl
mov    %cl,0xf(%rsp)
mov    %esi,%ecx
and    $0x20,%cl
cmp    $0x1,%cl
mov    $0x31,%cl
sbb    $0x0,%cl
mov    %cl,0xe(%rsp)
mov    %esi,%ecx
and    $0x40,%cl
cmp    $0x1,%cl
sbb    $0x0,%al
mov    %al,0xd(%rsp)
shr    $0x7,%sil
or     $0x30,%sil
mov    %sil,0xc(%rsp)
movb   $0x0,0x15(%rsp)
lea    0x16(%rsp),%r14
mov    %r14,%rsi
call   1050 <ShortToHex@plt>
lea    0xe13(%rip),%rsi
lea    0x20(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1070 <strcat@plt>
lea    0xe01(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strcat@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1070 <strcat@plt>
lea    0xdf3(%rip),%rsi
mov    %rbx,%rdi
call   1070 <strcat@plt>
mov    %rbx,%rdi
call   1040 <UART2_write_text@plt>
mov    $0x14,%edi
call   1060 <delay_ms@plt>
add    $0x88,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [13 x i8] c"Adresse = 0x\00"
@.str.1 = [14 x i8] c" Inhalt = 0b\00"
@.str.2 = [2 x i8] c"\0D\00"
define void @Print_MPU_register(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca i8
%4 = alloca i8
%5 = alloca i8
%6 = alloca i8
%7 = alloca [100 x i8]
%8 = alloca [10 x i8]
%9 = alloca [10 x i8]
%10 = alloca i32
store i8 %0, i8* %3
store i8 %1, i8* %4
store i8 1, i8* %6
store i32 7, i32* %10
br label %11
11: ; preds = %37, %2
%12 = load i32, i32* %10
%13 = icmp sge i32 %12, 0
br i1 %13, label %14, label %40
14: ; preds = %11
%15 = load i8, i8* %4
%16 = zext i8 %15 to i32
%17 = load i8, i8* %6
%18 = zext i8 %17 to i32
%19 = and i32 %16, %18
%20 = trunc i32 %19 to i8
store i8 %20, i8* %5
%21 = load i8, i8* %5
%22 = zext i8 %21 to i32
%23 = icmp sgt i32 %22, 0
br i1 %23, label %24, label %28
24: ; preds = %14
%25 = load i32, i32* %10
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 %26
store i8 49, i8* %27
br label %32
28: ; preds = %14
%29 = load i32, i32* %10
%30 = sext i32 %29 to i64
%31 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 %30
store i8 48, i8* %31
br label %32
32: ; preds = %28, %24
%33 = load i8, i8* %6
%34 = zext i8 %33 to i32
%35 = shl i32 %34, 1
%36 = trunc i32 %35 to i8
store i8 %36, i8* %6
br label %37
37: ; preds = %32
%38 = load i32, i32* %10
%39 = add nsw i32 %38, -1
store i32 %39, i32* %10
br label %11
40: ; preds = %11
%41 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 9
store i8 0, i8* %41
%42 = load i8, i8* %3
%43 = zext i8 %42 to i16
%44 = getelementptr inbounds [10 x i8], [10 x i8]* %9, i64 0, i64 0
%45 = call i32 @ShortToHex(i16 zeroext %43, i8* %44)
%46 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%47 = call i32 @strcpy(i8* %46, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%48 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%49 = getelementptr inbounds [10 x i8], [10 x i8]* %9, i64 0, i64 0
%50 = call i32 @strcat(i8* %48, i8* %49)
%51 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%52 = call i32 @strcat(i8* %51, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%53 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%54 = getelementptr inbounds [10 x i8], [10 x i8]* %8, i64 0, i64 0
%55 = call i32 @strcat(i8* %53, i8* %54)
%56 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%57 = call i32 @strcat(i8* %56, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%58 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%59 = call i32 @UART2_write_text(i8* %58)
%60 = call i32 @delay_ms(i32 20)
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"Adresse = 0x\00"
@.str.1 = [14 x i8] c" Inhalt = 0b\00"
@.str.2 = [2 x i8] c"\0D\00"
define void @Print_MPU_register(i8 zeroext %0, i8 zeroext %1) {
%3 = alloca [100 x i8]
%4 = alloca [10 x i8]
%5 = alloca [10 x i8]
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %3, i64 0, i64 0
%7 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%8 = getelementptr inbounds [10 x i8], [10 x i8]* %5, i64 0, i64 0
%9 = and i8 %1, 1
%10 = or i8 %9, 48
%11 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 7
store i8 %10, i8* %11
%12 = and i8 %1, 2
%13 = icmp eq i8 %12, 0
%14 = select i1 %13, i8 48, i8 49
%15 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 6
store i8 %14, i8* %15
%16 = and i8 %1, 4
%17 = icmp eq i8 %16, 0
%18 = select i1 %17, i8 48, i8 49
%19 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 5
store i8 %18, i8* %19
%20 = and i8 %1, 8
%21 = icmp eq i8 %20, 0
%22 = select i1 %21, i8 48, i8 49
%23 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 4
store i8 %22, i8* %23
%24 = and i8 %1, 16
%25 = icmp eq i8 %24, 0
%26 = select i1 %25, i8 48, i8 49
%27 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 3
store i8 %26, i8* %27
%28 = and i8 %1, 32
%29 = icmp eq i8 %28, 0
%30 = select i1 %29, i8 48, i8 49
%31 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 2
store i8 %30, i8* %31
%32 = and i8 %1, 64
%33 = icmp eq i8 %32, 0
%34 = select i1 %33, i8 48, i8 49
%35 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 1
store i8 %34, i8* %35
%36 = icmp sgt i8 %1, -1
%37 = select i1 %36, i8 48, i8 49
store i8 %37, i8* %7
%38 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 9
store i8 0, i8* %38
%39 = zext i8 %0 to i16
%40 = call i32 @ShortToHex(i16 zeroext %39, i8* %8)
%41 = call i32 @strcpy(i8* %6, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%42 = call i32 @strcat(i8* %6, i8* %8)
%43 = call i32 @strcat(i8* %6, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%44 = call i32 @strcat(i8* %6, i8* %7)
%45 = call i32 @strcat(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%46 = call i32 @UART2_write_text(i8* %6)
%47 = call i32 @delay_ms(i32 20)
ret void
}