#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*/ kill_time(int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ self_testing_mode();
void init_can(char *mode, char *self_test) {
  volatile unsigned char r_val;
  if (mode == "Basic") {
    printf("********** Basic Can Mode **********\n");
    printf("Switch on Reset Mode\n");
    r_val = *((volatile unsigned char *)(0xfff20000 + 0x0000)) | 0x01;
    *((volatile unsigned char *)(0xfff20000 + 0x0000)) = r_val;
    r_val = *((volatile unsigned char *)(0xfff20000 + 0x001F)) & 0x7F | 0x07;
    *((volatile unsigned char *)(0xfff20000 + 0x001F)) = r_val;
    *((volatile unsigned char *)(0xfff20000 + 0x0006)) = 0x83;
    *((volatile unsigned char *)(0xfff20000 + 0x0007)) = 0x25;
    *((volatile unsigned char *)(0xfff20000 + 0x0004)) = 0xEA;
    *((volatile unsigned char *)(0xfff20000 + 0x0005)) = 0x0F;
    kill_time(50);
    printf("Switch off reset mode\n");
    r_val = *((volatile unsigned char *)(0xfff20000 + 0x0000)) & 0xFE;
    *((volatile unsigned char *)(0xfff20000 + 0x0000)) = r_val;
    kill_time(50);
  } else if (mode == "Extended") {
    printf("************************************\n");
    printf("******** Extended Can Mode *********\n");
    printf("************************************\n");
    printf("Switch on Reset Mode\n");
    r_val = *((volatile unsigned char *)(0xfff20000 + 0x0000)) | 0x01;
    *((volatile unsigned char *)(0xfff20000 + 0x0000)) = r_val;
    printf("control_register: 0x%X \n\n",
           *((volatile unsigned char *)(0xfff20000 + 0x0000)));
    kill_time(50);
    printf("Set clock divider register to extended can mode\n");
    r_val = *((volatile unsigned char *)(0xfff20000 + 0x001F)) | 0x80 | 0x07;
    *((volatile unsigned char *)(0xfff20000 + 0x001F)) = r_val;
    printf("clock_divider_register: 0x%X \n\n",
           *((volatile unsigned char *)(0xfff20000 + 0x001F)));
    kill_time(50);
    printf("Set bus timing register 0\n");
    printf("Sync Jump Width = 2  Baudrate Prescaler = 1\n");
    *((volatile unsigned char *)(0xfff20000 + 0x0006)) = 0xA8;
    printf("bus timing register 0: 0x%X \n\n",
           *((volatile unsigned char *)(0xfff20000 + 0x0006)));
    printf("Set bus timing register 1\n");
    printf("SAM = 0 ---> Single Sampling\n");
    *((volatile unsigned char *)(0xfff20000 + 0x0007)) = 0x34;
    printf("bus timing register 1: 0x%X \n\n",
           *((volatile unsigned char *)(0xfff20000 + 0x0007)));
    printf("Set acceptance code register\n");
    *((volatile unsigned char *)(0xfff20000 + 0x0010)) = 0xA6;
    printf("acceptance code register 0: 0x%X \n",
           *((volatile unsigned char *)(0xfff20000 + 0x0010)));
    *((volatile unsigned char *)(0xfff20000 + 0x0011)) = 0xB0;
    printf("acceptance code register 1: 0x%X \n",
           *((volatile unsigned char *)(0xfff20000 + 0x0011)));
    *((volatile unsigned char *)(0xfff20000 + 0x0012)) = 0x12;
    printf("acceptance code register 2: 0x%X \n",
           *((volatile unsigned char *)(0xfff20000 + 0x0012)));
    *((volatile unsigned char *)(0xfff20000 + 0x0013)) = 0x30;
    printf("acceptance code register 3: 0x%X \n\n",
           *((volatile unsigned char *)(0xfff20000 + 0x0013)));
    printf("Set acceptance mask register\n");
    *((volatile unsigned char *)(0xfff20000 + 0x0014)) = 0x00;
    printf("acceptance mask register: 0x%X \n",
           *((volatile unsigned char *)(0xfff20000 + 0x0014)));
    *((volatile unsigned char *)(0xfff20000 + 0x0015)) = 0x00;
    printf("acceptance mask register: 0x%X \n",
           *((volatile unsigned char *)(0xfff20000 + 0x0015)));
    *((volatile unsigned char *)(0xfff20000 + 0x0016)) = 0x00;
    printf("acceptance mask register: 0x%X \n",
           *((volatile unsigned char *)(0xfff20000 + 0x0016)));
    *((volatile unsigned char *)(0xfff20000 + 0x0017)) = 0x00;
    printf("acceptance mask register: 0x%X \n\n",
           *((volatile unsigned char *)(0xfff20000 + 0x0017)));
    if (self_test == "self_test") {
      self_testing_mode();
    }
    printf("Switch off reset mode\n");
    r_val = *((volatile unsigned char *)(0xfff20000 + 0x0000)) & 0xFE;
    *((volatile unsigned char *)(0xfff20000 + 0x0000)) = r_val;
    printf("control_register 0x%X \n\n",
           *((volatile unsigned char *)(0xfff20000 + 0x0000)));
    kill_time(50);
  }
}


x86 assembly (clang, -O0):
<init_can>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb9(%rip),%rax
cmp    %rax,-0x8(%rbp)
jne    1207 <init_can+0xd7>
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xec6(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xfff20000,%eax
mov    (%rax),%al
movzbl %al,%eax
or     $0x1,%eax
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%cl
mov    $0xfff20000,%eax
mov    %cl,(%rax)
mov    $0xfff2001f,%eax
mov    (%rax),%al
movzbl %al,%eax
and    $0x7f,%eax
or     $0x7,%eax
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%cl
mov    $0xfff2001f,%eax
mov    %cl,(%rax)
mov    $0xfff20006,%eax
movb   $0x83,(%rax)
mov    $0xfff20007,%eax
movb   $0x25,(%rax)
mov    $0xfff20004,%eax
movb   $0xea,(%rax)
mov    $0xfff20005,%eax
movb   $0xf,(%rax)
mov    $0x32,%edi
call   1030 <kill_time@plt>
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xfff20000,%eax
mov    (%rax),%al
movzbl %al,%eax
and    $0xfe,%eax
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%cl
mov    $0xfff20000,%eax
mov    %cl,(%rax)
mov    $0x32,%edi
call   1030 <kill_time@plt>
jmp    14d8 <init_can+0x3a8>
lea    0xe4b(%rip),%rax
cmp    %rax,-0x8(%rbp)
jne    14d3 <init_can+0x3a3>
lea    0xe43(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe5b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe27(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xde3(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xfff20000,%eax
mov    (%rax),%al
movzbl %al,%eax
or     $0x1,%eax
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%cl
mov    $0xfff20000,%eax
mov    %cl,(%rax)
mov    $0xfff20000,%eax
mov    (%rax),%al
movzbl %al,%esi
lea    0xe33(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x32,%edi
call   1030 <kill_time@plt>
lea    0xe35(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xfff2001f,%eax
mov    (%rax),%al
movzbl %al,%eax
or     $0x80,%eax
or     $0x7,%eax
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%cl
mov    $0xfff2001f,%eax
mov    %cl,(%rax)
mov    $0xfff2001f,%eax
mov    (%rax),%al
movzbl %al,%esi
lea    0xe2f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x32,%edi
call   1030 <kill_time@plt>
lea    0xe37(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe44(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xfff20006,%eax
movb   $0xa8,(%rax)
mov    $0xfff20006,%eax
mov    (%rax),%al
movzbl %al,%esi
lea    0xe51(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe6f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xfff20007,%eax
movb   $0x34,(%rax)
mov    $0xfff20007,%eax
mov    (%rax),%al
movzbl %al,%esi
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe7e(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xfff20010,%eax
movb   $0xa6,(%rax)
mov    $0xfff20010,%eax
mov    (%rax),%al
movzbl %al,%esi
lea    0xe7c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xfff20011,%eax
movb   $0xb0,(%rax)
mov    $0xfff20011,%eax
mov    (%rax),%al
movzbl %al,%esi
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xfff20012,%eax
movb   $0x12,(%rax)
mov    $0xfff20012,%eax
mov    (%rax),%al
movzbl %al,%esi
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xfff20013,%eax
movb   $0x30,(%rax)
mov    $0xfff20013,%eax
mov    (%rax),%al
movzbl %al,%esi
lea    0xe85(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xfff20014,%eax
movb   $0x0,(%rax)
mov    $0xfff20014,%eax
mov    (%rax),%al
movzbl %al,%esi
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xfff20015,%eax
movb   $0x0,(%rax)
mov    $0xfff20015,%eax
mov    (%rax),%al
movzbl %al,%esi
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xfff20016,%eax
movb   $0x0,(%rax)
mov    $0xfff20016,%eax
mov    (%rax),%al
movzbl %al,%esi
lea    0xe59(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xfff20017,%eax
movb   $0x0,(%rax)
mov    $0xfff20017,%eax
mov    (%rax),%al
movzbl %al,%esi
lea    0xe5a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe6e(%rip),%rax
cmp    %rax,-0x10(%rbp)
jne    1487 <init_can+0x357>
mov    $0x0,%al
call   1040 <self_testing_mode@plt>
lea    0xbb4(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0xfff20000,%eax
mov    (%rax),%al
movzbl %al,%eax
and    $0xfe,%eax
mov    %al,-0x11(%rbp)
mov    -0x11(%rbp),%cl
mov    $0xfff20000,%eax
mov    %cl,(%rax)
mov    $0xfff20000,%eax
mov    (%rax),%al
movzbl %al,%esi
lea    0xe2c(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    $0x32,%edi
call   1030 <kill_time@plt>
jmp    14d8 <init_can+0x3a8>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_can>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xeb0(%rip),%rax
cmp    %rax,%rdi
je     116f <init_can+0x2f>
lea    0xeaa(%rip),%rax
cmp    %rax,%rdi
je     11e5 <init_can+0xa5>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret
lea    0x1135(%rip),%rdi
call   1040 <puts@plt>
lea    0x114e(%rip),%rdi
call   1040 <puts@plt>
mov    $0xfff20000,%ebx
mov    (%rbx),%al
or     $0x1,%al
mov    %al,0xf(%rsp)
mov    0xf(%rsp),%al
mov    %al,(%rbx)
mov    0x1f(%rbx),%al
and    $0x78,%al
or     $0x7,%al
mov    %al,0xf(%rsp)
mov    0xf(%rsp),%al
mov    %al,0x1f(%rbx)
movb   $0x83,0x6(%rbx)
movb   $0x25,0x7(%rbx)
movb   $0xea,0x4(%rbx)
movb   $0xf,0x5(%rbx)
mov    $0x32,%edi
call   1030 <kill_time@plt>
lea    0x1118(%rip),%rdi
call   1040 <puts@plt>
mov    (%rbx),%al
and    $0xfe,%al
mov    %al,0xf(%rsp)
mov    0xf(%rsp),%al
mov    %al,(%rbx)
jmp    13da <init_can+0x29a>
mov    %rsi,%r14
mov    $0xfff20000,%ebx
lea    0xfab(%rip),%r15
mov    %r15,%rdi
call   1040 <puts@plt>
lea    0xf77(%rip),%rdi
call   1040 <puts@plt>
mov    %r15,%rdi
call   1040 <puts@plt>
lea    0x10b9(%rip),%rdi
call   1040 <puts@plt>
mov    (%rbx),%al
or     $0x1,%al
mov    %al,0xf(%rsp)
mov    0xf(%rsp),%al
mov    %al,(%rbx)
movzbl (%rbx),%esi
lea    0xddb(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x32,%edi
call   1030 <kill_time@plt>
lea    0xf78(%rip),%rdi
call   1040 <puts@plt>
mov    0x1f(%rbx),%al
or     $0x87,%al
mov    %al,0xf(%rsp)
mov    0xf(%rsp),%al
mov    %al,0x1f(%rbx)
movzbl 0x1f(%rbx),%esi
lea    0xdbd(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x32,%edi
call   1030 <kill_time@plt>
lea    0xf70(%rip),%rdi
call   1040 <puts@plt>
lea    0xf7e(%rip),%rdi
call   1040 <puts@plt>
movb   $0xa8,0x6(%rbx)
movzbl 0x6(%rbx),%esi
lea    0xda5(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xf88(%rip),%rdi
call   1040 <puts@plt>
lea    0xf96(%rip),%rdi
call   1040 <puts@plt>
movb   $0x34,0x7(%rbx)
movzbl 0x7(%rbx),%esi
lea    0xd96(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xf91(%rip),%rdi
call   1040 <puts@plt>
movb   $0xa6,0x10(%rbx)
movzbl 0x10(%rbx),%esi
lea    0xd93(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movb   $0xb0,0x11(%rbx)
movzbl 0x11(%rbx),%esi
lea    0xda0(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movb   $0x12,0x12(%rbx)
movzbl 0x12(%rbx),%esi
lea    0xdad(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movb   $0x30,0x13(%rbx)
movzbl 0x13(%rbx),%esi
lea    0xdba(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xf4a(%rip),%rdi
call   1040 <puts@plt>
movb   $0x0,0x14(%rbx)
movzbl 0x14(%rbx),%esi
lea    0xdbc(%rip),%r15
mov    %r15,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movb   $0x0,0x15(%rbx)
movzbl 0x15(%rbx),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movb   $0x0,0x16(%rbx)
movzbl 0x16(%rbx),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1060 <printf@plt>
movb   $0x0,0x17(%rbx)
movzbl 0x17(%rbx),%esi
lea    0xda0(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
lea    0xdb4(%rip),%rax
cmp    %rax,%r14
jne    13af <init_can+0x26f>
xor    %eax,%eax
call   1050 <self_testing_mode@plt>
lea    0xf2f(%rip),%rdi
call   1040 <puts@plt>
mov    (%rbx),%al
and    $0xfe,%al
mov    %al,0xf(%rsp)
mov    0xf(%rsp),%al
mov    %al,(%rbx)
movzbl (%rbx),%esi
lea    0xd8e(%rip),%rdi
xor    %eax,%eax
call   1060 <printf@plt>
mov    $0x32,%edi
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <kill_time@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"Basic\00"
@.str.1 = [38 x i8] c"********** Basic Can Mode **********\0A\00"
@.str.2 = [22 x i8] c"Switch on Reset Mode\0A\00"
@.str.3 = [23 x i8] c"Switch off reset mode\0A\00"
@.str.4 = [9 x i8] c"Extended\00"
@.str.5 = [38 x i8] c"************************************\0A\00"
@.str.6 = [38 x i8] c"******** Extended Can Mode *********\0A\00"
@.str.7 = [26 x i8] c"control_register: 0x%X \0A\0A\00"
@.str.8 = [49 x i8] c"Set clock divider register to extended can mode\0A\00"
@.str.9 = [32 x i8] c"clock_divider_register: 0x%X \0A\0A\00"
@.str.10 = [27 x i8] c"Set bus timing register 0\0A\00"
@.str.11 = [45 x i8] c"Sync Jump Width = 2 Baudrate Prescaler = 1\0A\00"
@.str.12 = [31 x i8] c"bus timing register 0: 0x%X \0A\0A\00"
@.str.13 = [27 x i8] c"Set bus timing register 1\0A\00"
@.str.14 = [30 x i8] c"SAM = 0 ---> Single Sampling\0A\00"
@.str.15 = [31 x i8] c"bus timing register 1: 0x%X \0A\0A\00"
@.str.16 = [30 x i8] c"Set acceptance code register\0A\00"
@.str.17 = [35 x i8] c"acceptance code register 0: 0x%X \0A\00"
@.str.18 = [35 x i8] c"acceptance code register 1: 0x%X \0A\00"
@.str.19 = [35 x i8] c"acceptance code register 2: 0x%X \0A\00"
@.str.20 = [36 x i8] c"acceptance code register 3: 0x%X \0A\0A\00"
@.str.21 = [30 x i8] c"Set acceptance mask register\0A\00"
@.str.22 = [33 x i8] c"acceptance mask register: 0x%X \0A\00"
@.str.23 = [34 x i8] c"acceptance mask register: 0x%X \0A\0A\00"
@.str.24 = [10 x i8] c"self_test\00"
@.str.25 = [25 x i8] c"control_register 0x%X \0A\0A\00"
define void @init_can(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = icmp eq i8* %6, getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
br i1 %7, label %8, label %30
8: ; preds = %2
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.1, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%11 = load volatile i8, i8* inttoptr (i64 4294049792 to i8*)
%12 = zext i8 %11 to i32
%13 = or i32 %12, 1
%14 = trunc i32 %13 to i8
store volatile i8 %14, i8* %5
%15 = load volatile i8, i8* %5
store volatile i8 %15, i8* inttoptr (i64 4294049792 to i8*)
%16 = load volatile i8, i8* inttoptr (i64 4294049823 to i8*)
%17 = zext i8 %16 to i32
%18 = and i32 %17, 127
%19 = or i32 %18, 7
%20 = trunc i32 %19 to i8
store volatile i8 %20, i8* %5
%21 = load volatile i8, i8* %5
store volatile i8 %21, i8* inttoptr (i64 4294049823 to i8*)
store volatile i8 -125, i8* inttoptr (i64 4294049798 to i8*)
store volatile i8 37, i8* inttoptr (i64 4294049799 to i8*)
store volatile i8 -22, i8* inttoptr (i64 4294049796 to i8*)
store volatile i8 15, i8* inttoptr (i64 4294049797 to i8*)
%22 = call i32 @kill_time(i32 50)
%23 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%24 = load volatile i8, i8* inttoptr (i64 4294049792 to i8*)
%25 = zext i8 %24 to i32
%26 = and i32 %25, 254
%27 = trunc i32 %26 to i8
store volatile i8 %27, i8* %5
%28 = load volatile i8, i8* %5
store volatile i8 %28, i8* inttoptr (i64 4294049792 to i8*)
%29 = call i32 @kill_time(i32 50)
br label %110
30: ; preds = %2
%31 = load i8*, i8** %3
%32 = icmp eq i8* %31, getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0)
br i1 %32, label %33, label %109
33: ; preds = %30
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0))
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.6, i64 0, i64 0))
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.5, i64 0, i64 0))
%37 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.2, i64 0, i64 0))
%38 = load volatile i8, i8* inttoptr (i64 4294049792 to i8*)
%39 = zext i8 %38 to i32
%40 = or i32 %39, 1
%41 = trunc i32 %40 to i8
store volatile i8 %41, i8* %5
%42 = load volatile i8, i8* %5
store volatile i8 %42, i8* inttoptr (i64 4294049792 to i8*)
%43 = load volatile i8, i8* inttoptr (i64 4294049792 to i8*)
%44 = zext i8 %43 to i32
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i32 %44)
%46 = call i32 @kill_time(i32 50)
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([49 x i8], [49 x i8]* @.str.8, i64 0, i64 0))
%48 = load volatile i8, i8* inttoptr (i64 4294049823 to i8*)
%49 = zext i8 %48 to i32
%50 = or i32 %49, 128
%51 = or i32 %50, 7
%52 = trunc i32 %51 to i8
store volatile i8 %52, i8* %5
%53 = load volatile i8, i8* %5
store volatile i8 %53, i8* inttoptr (i64 4294049823 to i8*)
%54 = load volatile i8, i8* inttoptr (i64 4294049823 to i8*)
%55 = zext i8 %54 to i32
%56 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.9, i64 0, i64 0), i32 %55)
%57 = call i32 @kill_time(i32 50)
%58 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.10, i64 0, i64 0))
%59 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.11, i64 0, i64 0))
store volatile i8 -88, i8* inttoptr (i64 4294049798 to i8*)
%60 = load volatile i8, i8* inttoptr (i64 4294049798 to i8*)
%61 = zext i8 %60 to i32
%62 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.12, i64 0, i64 0), i32 %61)
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.13, i64 0, i64 0))
%64 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.14, i64 0, i64 0))
store volatile i8 52, i8* inttoptr (i64 4294049799 to i8*)
%65 = load volatile i8, i8* inttoptr (i64 4294049799 to i8*)
%66 = zext i8 %65 to i32
%67 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.15, i64 0, i64 0), i32 %66)
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.16, i64 0, i64 0))
store volatile i8 -90, i8* inttoptr (i64 4294049808 to i8*)
%69 = load volatile i8, i8* inttoptr (i64 4294049808 to i8*)
%70 = zext i8 %69 to i32
%71 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.17, i64 0, i64 0), i32 %70)
store volatile i8 -80, i8* inttoptr (i64 4294049809 to i8*)
%72 = load volatile i8, i8* inttoptr (i64 4294049809 to i8*)
%73 = zext i8 %72 to i32
%74 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.18, i64 0, i64 0), i32 %73)
store volatile i8 18, i8* inttoptr (i64 4294049810 to i8*)
%75 = load volatile i8, i8* inttoptr (i64 4294049810 to i8*)
%76 = zext i8 %75 to i32
%77 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.19, i64 0, i64 0), i32 %76)
store volatile i8 48, i8* inttoptr (i64 4294049811 to i8*)
%78 = load volatile i8, i8* inttoptr (i64 4294049811 to i8*)
%79 = zext i8 %78 to i32
%80 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.20, i64 0, i64 0), i32 %79)
%81 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.21, i64 0, i64 0))
store volatile i8 0, i8* inttoptr (i64 4294049812 to i8*)
%82 = load volatile i8, i8* inttoptr (i64 4294049812 to i8*)
%83 = zext i8 %82 to i32
%84 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.22, i64 0, i64 0), i32 %83)
store volatile i8 0, i8* inttoptr (i64 4294049813 to i8*)
%85 = load volatile i8, i8* inttoptr (i64 4294049813 to i8*)
%86 = zext i8 %85 to i32
%87 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.22, i64 0, i64 0), i32 %86)
store volatile i8 0, i8* inttoptr (i64 4294049814 to i8*)
%88 = load volatile i8, i8* inttoptr (i64 4294049814 to i8*)
%89 = zext i8 %88 to i32
%90 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.22, i64 0, i64 0), i32 %89)
store volatile i8 0, i8* inttoptr (i64 4294049815 to i8*)
%91 = load volatile i8, i8* inttoptr (i64 4294049815 to i8*)
%92 = zext i8 %91 to i32
%93 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.23, i64 0, i64 0), i32 %92)
%94 = load i8*, i8** %4
%95 = icmp eq i8* %94, getelementptr inbounds ([10 x i8], [10 x i8]* @.str.24, i64 0, i64 0)
br i1 %95, label %96, label %98
96: ; preds = %33
%97 = call i32 (...) @self_testing_mode()
br label %98
98: ; preds = %96, %33
%99 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.3, i64 0, i64 0))
%100 = load volatile i8, i8* inttoptr (i64 4294049792 to i8*)
%101 = zext i8 %100 to i32
%102 = and i32 %101, 254
%103 = trunc i32 %102 to i8
store volatile i8 %103, i8* %5
%104 = load volatile i8, i8* %5
store volatile i8 %104, i8* inttoptr (i64 4294049792 to i8*)
%105 = load volatile i8, i8* inttoptr (i64 4294049792 to i8*)
%106 = zext i8 %105 to i32
%107 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.25, i64 0, i64 0), i32 %106)
%108 = call i32 @kill_time(i32 50)
br label %109
109: ; preds = %98, %30
br label %110
110: ; preds = %109, %8
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"Basic\00"
@.str.4 = [9 x i8] c"Extended\00"
@.str.7 = [26 x i8] c"control_register: 0x%X \0A\0A\00"
@.str.9 = [32 x i8] c"clock_divider_register: 0x%X \0A\0A\00"
@.str.12 = [31 x i8] c"bus timing register 0: 0x%X \0A\0A\00"
@.str.15 = [31 x i8] c"bus timing register 1: 0x%X \0A\0A\00"
@.str.17 = [35 x i8] c"acceptance code register 0: 0x%X \0A\00"
@.str.18 = [35 x i8] c"acceptance code register 1: 0x%X \0A\00"
@.str.19 = [35 x i8] c"acceptance code register 2: 0x%X \0A\00"
@.str.20 = [36 x i8] c"acceptance code register 3: 0x%X \0A\0A\00"
@.str.22 = [33 x i8] c"acceptance mask register: 0x%X \0A\00"
@.str.23 = [34 x i8] c"acceptance mask register: 0x%X \0A\0A\00"
@.str.24 = [10 x i8] c"self_test\00"
@.str.25 = [25 x i8] c"control_register 0x%X \0A\0A\00"
@str.26 = [37 x i8] c"******** Extended Can Mode *********\00"
@str.27 = [37 x i8] c"************************************\00"
@str.29 = [48 x i8] c"Set clock divider register to extended can mode\00"
@str.30 = [26 x i8] c"Set bus timing register 0\00"
@str.31 = [44 x i8] c"Sync Jump Width = 2 Baudrate Prescaler = 1\00"
@str.32 = [26 x i8] c"Set bus timing register 1\00"
@str.33 = [29 x i8] c"SAM = 0 ---> Single Sampling\00"
@str.34 = [29 x i8] c"Set acceptance code register\00"
@str.35 = [29 x i8] c"Set acceptance mask register\00"
@str.37 = [37 x i8] c"********** Basic Can Mode **********\00"
@str.38 = [21 x i8] c"Switch on Reset Mode\00"
@str.39 = [22 x i8] c"Switch off reset mode\00"
define void @init_can(i8* readnone %0, i8* readnone %1) {
%3 = alloca i8
%4 = icmp eq i8* %0, getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0)
br i1 %4, label %5, label %20
5: ; preds = %2
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.37, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.38, i64 0, i64 0))
%8 = load volatile i8, i8* inttoptr (i64 4294049792 to i8*)
%9 = or i8 %8, 1
store volatile i8 %9, i8* %3
%10 = load volatile i8, i8* %3
store volatile i8 %10, i8* inttoptr (i64 4294049792 to i8*)
%11 = load volatile i8, i8* inttoptr (i64 4294049823 to i8*)
%12 = and i8 %11, 120
%13 = or i8 %12, 7
store volatile i8 %13, i8* %3
%14 = load volatile i8, i8* %3
store volatile i8 %14, i8* inttoptr (i64 4294049823 to i8*)
store volatile i8 -125, i8* inttoptr (i64 4294049798 to i8*)
store volatile i8 37, i8* inttoptr (i64 4294049799 to i8*)
store volatile i8 -22, i8* inttoptr (i64 4294049796 to i8*)
store volatile i8 15, i8* inttoptr (i64 4294049797 to i8*)
%15 = tail call i32 @kill_time(i32 50)
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.39, i64 0, i64 0))
%17 = load volatile i8, i8* inttoptr (i64 4294049792 to i8*)
%18 = and i8 %17, -2
store volatile i8 %18, i8* %3
%19 = load volatile i8, i8* %3
store volatile i8 %19, i8* inttoptr (i64 4294049792 to i8*)
br label %89
20: ; preds = %2
%21 = icmp eq i8* %0, getelementptr inbounds ([9 x i8], [9 x i8]* @.str.4, i64 0, i64 0)
br i1 %21, label %22, label %91
22: ; preds = %20
%23 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.27, i64 0, i64 0))
%24 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.26, i64 0, i64 0))
%25 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str.27, i64 0, i64 0))
%26 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @str.38, i64 0, i64 0))
%27 = load volatile i8, i8* inttoptr (i64 4294049792 to i8*)
%28 = or i8 %27, 1
store volatile i8 %28, i8* %3
%29 = load volatile i8, i8* %3
store volatile i8 %29, i8* inttoptr (i64 4294049792 to i8*)
%30 = load volatile i8, i8* inttoptr (i64 4294049792 to i8*)
%31 = zext i8 %30 to i32
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.7, i64 0, i64 0), i32 %31)
%33 = tail call i32 @kill_time(i32 50)
%34 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @str.29, i64 0, i64 0))
%35 = load volatile i8, i8* inttoptr (i64 4294049823 to i8*)
%36 = or i8 %35, -121
store volatile i8 %36, i8* %3
%37 = load volatile i8, i8* %3
store volatile i8 %37, i8* inttoptr (i64 4294049823 to i8*)
%38 = load volatile i8, i8* inttoptr (i64 4294049823 to i8*)
%39 = zext i8 %38 to i32
%40 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.9, i64 0, i64 0), i32 %39)
%41 = tail call i32 @kill_time(i32 50)
%42 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.30, i64 0, i64 0))
%43 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @str.31, i64 0, i64 0))
store volatile i8 -88, i8* inttoptr (i64 4294049798 to i8*)
%44 = load volatile i8, i8* inttoptr (i64 4294049798 to i8*)
%45 = zext i8 %44 to i32
%46 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.12, i64 0, i64 0), i32 %45)
%47 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.32, i64 0, i64 0))
%48 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.33, i64 0, i64 0))
store volatile i8 52, i8* inttoptr (i64 4294049799 to i8*)
%49 = load volatile i8, i8* inttoptr (i64 4294049799 to i8*)
%50 = zext i8 %49 to i32
%51 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.15, i64 0, i64 0), i32 %50)
%52 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.34, i64 0, i64 0))
store volatile i8 -90, i8* inttoptr (i64 4294049808 to i8*)
%53 = load volatile i8, i8* inttoptr (i64 4294049808 to i8*)
%54 = zext i8 %53 to i32
%55 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.17, i64 0, i64 0), i32 %54)
store volatile i8 -80, i8* inttoptr (i64 4294049809 to i8*)
%56 = load volatile i8, i8* inttoptr (i64 4294049809 to i8*)
%57 = zext i8 %56 to i32
%58 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.18, i64 0, i64 0), i32 %57)
store volatile i8 18, i8* inttoptr (i64 4294049810 to i8*)
%59 = load volatile i8, i8* inttoptr (i64 4294049810 to i8*)
%60 = zext i8 %59 to i32
%61 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.19, i64 0, i64 0), i32 %60)
store volatile i8 48, i8* inttoptr (i64 4294049811 to i8*)
%62 = load volatile i8, i8* inttoptr (i64 4294049811 to i8*)
%63 = zext i8 %62 to i32
%64 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @.str.20, i64 0, i64 0), i32 %63)
%65 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str.35, i64 0, i64 0))
store volatile i8 0, i8* inttoptr (i64 4294049812 to i8*)
%66 = load volatile i8, i8* inttoptr (i64 4294049812 to i8*)
%67 = zext i8 %66 to i32
%68 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.22, i64 0, i64 0), i32 %67)
store volatile i8 0, i8* inttoptr (i64 4294049813 to i8*)
%69 = load volatile i8, i8* inttoptr (i64 4294049813 to i8*)
%70 = zext i8 %69 to i32
%71 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.22, i64 0, i64 0), i32 %70)
store volatile i8 0, i8* inttoptr (i64 4294049814 to i8*)
%72 = load volatile i8, i8* inttoptr (i64 4294049814 to i8*)
%73 = zext i8 %72 to i32
%74 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.22, i64 0, i64 0), i32 %73)
store volatile i8 0, i8* inttoptr (i64 4294049815 to i8*)
%75 = load volatile i8, i8* inttoptr (i64 4294049815 to i8*)
%76 = zext i8 %75 to i32
%77 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.23, i64 0, i64 0), i32 %76)
%78 = icmp eq i8* %1, getelementptr inbounds ([10 x i8], [10 x i8]* @.str.24, i64 0, i64 0)
br i1 %78, label %79, label %81
79: ; preds = %22
%80 = tail call i32 (...) @self_testing_mode()
br label %81
81: ; preds = %79, %22
%82 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str.39, i64 0, i64 0))
%83 = load volatile i8, i8* inttoptr (i64 4294049792 to i8*)
%84 = and i8 %83, -2
store volatile i8 %84, i8* %3
%85 = load volatile i8, i8* %3
store volatile i8 %85, i8* inttoptr (i64 4294049792 to i8*)
%86 = load volatile i8, i8* inttoptr (i64 4294049792 to i8*)
%87 = zext i8 %86 to i32
%88 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.25, i64 0, i64 0), i32 %87)
br label %89
89: ; preds = %5, %81
%90 = tail call i32 @kill_time(i32 50)
br label %91
91: ; preds = %89, %20
ret void
}