#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*/ MPU_I2C_Read(int, unsigned char, int, unsigned char *);
int /*<<< orphan*/ ShortToHex(unsigned short, char *);
int /*<<< orphan*/ ShortToStr(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_map(int startAdress, int EndAdress) {
  unsigned char dat, dat_temp, mask, registerAdress;
  char stn_out[100], bit_string[10], adress_string[10];
  int i;
  for (registerAdress = startAdress; registerAdress <= EndAdress;
       registerAdress++) {
    MPU_I2C_Read(0x28, registerAdress, 1, &dat);
    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;
    strcpy(stn_out, "Adresse =");
    ShortToStr((short)registerAdress, adress_string);
    strcat(stn_out, adress_string);
    ShortToHex((unsigned short)registerAdress, adress_string);
    strcat(stn_out, " (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_map>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %al,-0xc(%rbp)
movzbl -0xc(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     12d2 <Print_MPU_register_map+0x162>
mov    $0x28,%edi
mov    $0x1,%edx
lea    -0x9(%rbp),%rcx
movzbl -0xc(%rbp),%esi
call   1070 <MPU_I2C_Read@plt>
movb   $0x1,-0xb(%rbp)
movl   $0x7,-0x88(%rbp)
cmpl   $0x0,-0x88(%rbp)
jl     121b <Print_MPU_register_map+0xab>
movzbl -0x9(%rbp),%eax
movzbl -0xb(%rbp),%ecx
and    %ecx,%eax
mov    %al,-0xa(%rbp)
movzbl -0xa(%rbp),%eax
cmp    $0x0,%eax
jle    11f1 <Print_MPU_register_map+0x81>
movslq -0x88(%rbp),%rax
movb   $0x31,-0x7a(%rbp,%rax,1)
jmp    11fd <Print_MPU_register_map+0x8d>
movslq -0x88(%rbp),%rax
movb   $0x30,-0x7a(%rbp,%rax,1)
movzbl -0xb(%rbp),%eax
shl    $0x1,%eax
mov    %al,-0xb(%rbp)
mov    -0x88(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x88(%rbp)
jmp    11b9 <Print_MPU_register_map+0x49>
movb   $0x0,-0x71(%rbp)
lea    -0x70(%rbp),%rdi
lea    0xdd6(%rip),%rsi
call   1030 <strcpy@plt>
movzbl -0xc(%rbp),%eax
lea    -0x84(%rbp),%rsi
movswl %ax,%edi
call   1040 <ShortToStr@plt>
lea    -0x70(%rbp),%rdi
lea    -0x84(%rbp),%rsi
call   1090 <strcat@plt>
movzbl -0xc(%rbp),%eax
lea    -0x84(%rbp),%rsi
movzwl %ax,%edi
call   1060 <ShortToHex@plt>
lea    -0x70(%rbp),%rdi
lea    0xd9a(%rip),%rsi
call   1090 <strcat@plt>
lea    -0x70(%rbp),%rdi
lea    -0x84(%rbp),%rsi
call   1090 <strcat@plt>
lea    -0x70(%rbp),%rdi
lea    0xd7f(%rip),%rsi
call   1090 <strcat@plt>
lea    -0x70(%rbp),%rdi
lea    -0x7a(%rbp),%rsi
call   1090 <strcat@plt>
lea    -0x70(%rbp),%rdi
lea    0xd71(%rip),%rsi
call   1090 <strcat@plt>
lea    -0x70(%rbp),%rdi
call   1050 <UART2_write_text@plt>
mov    $0x14,%edi
call   1080 <delay_ms@plt>
mov    -0xc(%rbp),%al
add    $0x1,%al
mov    %al,-0xc(%rbp)
jmp    1187 <Print_MPU_register_map+0x17>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Print_MPU_register_map>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x88,%rsp
mov    %edi,%ebp
movzbl %bpl,%eax
cmp    %esi,%eax
jg     12df <Print_MPU_register_map+0x16f>
mov    %esi,%r12d
lea    0x20(%rsp),%rbx
lea    0x16(%rsp),%r13
lea    0xc(%rsp),%r14
lea    0xe76(%rip),%r15
nopl   0x0(%rax,%rax,1)
movzbl %bpl,%ebp
mov    $0x28,%edi
mov    %ebp,%esi
mov    $0x1,%edx
lea    0xb(%rsp),%rcx
call   1070 <MPU_I2C_Read@plt>
movzbl 0xb(%rsp),%eax
mov    %eax,%ecx
and    $0x1,%cl
or     $0x30,%cl
mov    %eax,%edx
and    $0x2,%dl
cmp    $0x1,%dl
mov    $0x31,%dl
sbb    $0x0,%dl
mov    %cl,0x13(%rsp)
mov    %dl,0x12(%rsp)
mov    %eax,%ecx
and    $0x4,%cl
cmp    $0x1,%cl
mov    $0x31,%cl
sbb    $0x0,%cl
mov    %eax,%edx
and    $0x8,%dl
cmp    $0x1,%dl
mov    $0x31,%dl
sbb    $0x0,%dl
mov    %cl,0x11(%rsp)
mov    %dl,0x10(%rsp)
mov    %eax,%ecx
and    $0x10,%cl
cmp    $0x1,%cl
mov    $0x31,%cl
sbb    $0x0,%cl
mov    %eax,%edx
and    $0x20,%dl
cmp    $0x1,%dl
mov    $0x31,%dl
sbb    $0x0,%dl
mov    %cl,0xf(%rsp)
mov    %dl,0xe(%rsp)
mov    %eax,%ecx
and    $0x40,%cl
cmp    $0x1,%cl
mov    $0x31,%cl
sbb    $0x0,%cl
mov    %cl,0xd(%rsp)
shr    $0x7,%al
or     $0x30,%al
mov    %al,0xc(%rsp)
movb   $0x0,0x15(%rsp)
mov    %rbx,%rdi
lea    0xda7(%rip),%rsi
call   1030 <strcpy@plt>
mov    %ebp,%edi
mov    %r13,%rsi
call   1040 <ShortToStr@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1090 <strcat@plt>
mov    %ebp,%edi
mov    %r13,%rsi
call   1060 <ShortToHex@plt>
mov    %rbx,%rdi
lea    0xd83(%rip),%rsi
call   1090 <strcat@plt>
mov    %rbx,%rdi
mov    %r13,%rsi
call   1090 <strcat@plt>
mov    %rbx,%rdi
lea    0xd6e(%rip),%rsi
call   1090 <strcat@plt>
mov    %rbx,%rdi
mov    %r14,%rsi
call   1090 <strcat@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
call   1090 <strcat@plt>
mov    %rbx,%rdi
call   1050 <UART2_write_text@plt>
mov    $0x14,%edi
call   1080 <delay_ms@plt>
add    $0x1,%bpl
movzbl %bpl,%eax
cmp    %r12d,%eax
jle    11b0 <Print_MPU_register_map+0x40>
add    $0x88,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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