#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 *, ...);
void self_testing_mode() {
  volatile unsigned char r_val;
  printf("************************************\n");
  printf("***** Set to self testing mode *****\n");
  printf("************************************\n");
  r_val = *((volatile unsigned char *)(0xfff20000 + 0x0000)) | 0x04;
  *((volatile unsigned char *)(0xfff20000 + 0x0000)) = r_val;
  printf("control_register 0x%X \n\n",
         *((volatile unsigned char *)(0xfff20000 + 0x0000)));
}


x86 assembly (clang, -O0):
<self_testing_mode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xee1(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xef9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0xfff20000,%eax
mov    (%rax),%al
movzbl %al,%eax
or     $0x4,%eax
mov    %al,-0x1(%rbp)
mov    -0x1(%rbp),%cl
mov    $0xfff20000,%eax
mov    %cl,(%rax)
mov    $0xfff20000,%eax
mov    (%rax),%al
movzbl %al,%esi
lea    0xedf(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<self_testing_mode>:
push   %rbx
sub    $0x10,%rsp
lea    0xf12(%rip),%rbx
mov    %rbx,%rdi
call   1030 <puts@plt>
lea    0xede(%rip),%rdi
call   1030 <puts@plt>
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    $0xfff20000,%eax
mov    (%rax),%cl
or     $0x4,%cl
mov    %cl,0xf(%rsp)
mov    0xf(%rsp),%cl
mov    %cl,(%rax)
movzbl (%rax),%esi
lea    0xe9a(%rip),%rdi
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
jmp    1040 <printf@plt>

LLVM IR (-O0):
@.str = [38 x i8] c"************************************\0A\00"
@.str.1 = [38 x i8] c"***** Set to self testing mode *****\0A\00"
@.str.2 = [25 x i8] c"control_register 0x%X \0A\0A\00"
define void @self_testing_mode() {
%1 = alloca i8
%2 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%5 = load volatile i8, i8* inttoptr (i64 4294049792 to i8*)
%6 = zext i8 %5 to i32
%7 = or i32 %6, 4
%8 = trunc i32 %7 to i8
store volatile i8 %8, i8* %1
%9 = load volatile i8, i8* %1
store volatile i8 %9, i8* inttoptr (i64 4294049792 to i8*)
%10 = load volatile i8, i8* inttoptr (i64 4294049792 to i8*)
%11 = zext i8 %10 to i32
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %11)
ret void
}

LLVM IR (-O2):
@.str.2 = [25 x i8] c"control_register 0x%X \0A\0A\00"
@str.3 = [37 x i8] c"***** Set to self testing mode *****\00"
@str.4 = [37 x i8] c"************************************\00"
define void @self_testing_mode() {
%1 = alloca i8
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.4, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.3, i64 0, i64 0))
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.4, i64 0, i64 0))
%5 = load volatile i8, i8* inttoptr (i64 4294049792 to i8*)
%6 = or i8 %5, 4
store volatile i8 %6, i8* %1
%7 = load volatile i8, i8* %1
store volatile i8 %7, i8* inttoptr (i64 4294049792 to i8*)
%8 = load volatile i8, i8* inttoptr (i64 4294049792 to i8*)
%9 = zext i8 %8 to i32
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %9)
ret void
}