#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*/ supply_register_by_name(char *, unsigned long *);
void cris_write_data_breakpoint(int bp, unsigned long start,
                                unsigned long end) {
  switch (bp) {
  case 0:
    supply_register_by_name("s3", &start);
    supply_register_by_name("s4", &end);
    break;
  case 1:
    supply_register_by_name("s5", &start);
    supply_register_by_name("s6", &end);
    break;
  case 2:
    supply_register_by_name("s7", &start);
    supply_register_by_name("s8", &end);
    break;
  case 3:
    supply_register_by_name("s9", &start);
    supply_register_by_name("s10", &end);
    break;
  case 4:
    supply_register_by_name("s11", &start);
    supply_register_by_name("s12", &end);
    break;
  case 5:
    supply_register_by_name("s13", &start);
    supply_register_by_name("s14", &end);
    break;
  }
}


x86 assembly (clang, -O0):
<cris_write_data_breakpoint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x4(%rbp),%eax
mov    %rax,-0x20(%rbp)
sub    $0x5,%rax
ja     1221 <cris_write_data_breakpoint+0x111>
mov    -0x20(%rbp),%rax
lea    0xec1(%rip),%rcx
movslq (%rcx,%rax,4),%rax
add    %rcx,%rax
jmp    *%rax
lea    0xec9(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <supply_register_by_name@plt>
lea    0xebc(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <supply_register_by_name@plt>
jmp    1221 <cris_write_data_breakpoint+0x111>
lea    0xeaa(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <supply_register_by_name@plt>
lea    0xe9d(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <supply_register_by_name@plt>
jmp    1221 <cris_write_data_breakpoint+0x111>
lea    0xe8b(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <supply_register_by_name@plt>
lea    0xe7e(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <supply_register_by_name@plt>
jmp    1221 <cris_write_data_breakpoint+0x111>
lea    0xe6c(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <supply_register_by_name@plt>
lea    0xe5f(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <supply_register_by_name@plt>
jmp    1221 <cris_write_data_breakpoint+0x111>
lea    0xe4e(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <supply_register_by_name@plt>
lea    0xe42(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <supply_register_by_name@plt>
jmp    1221 <cris_write_data_breakpoint+0x111>
lea    0xe31(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <supply_register_by_name@plt>
lea    0xe25(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1030 <supply_register_by_name@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cris_write_data_breakpoint>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,0x8(%rsp)
mov    %rdx,(%rsp)
cmp    $0x5,%edi
ja     1157 <cris_write_data_breakpoint+0x47>
movslq %edi,%rax
lea    0xeff(%rip),%rcx
movslq (%rcx,%rax,4),%rdi
add    %rcx,%rdi
lea    0xf09(%rip),%rcx
movslq (%rcx,%rax,4),%rbx
add    %rcx,%rbx
lea    0x8(%rsp),%rsi
call   1030 <supply_register_by_name@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1030 <supply_register_by_name@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"s3\00"
@.str.1 = [3 x i8] c"s4\00"
@.str.2 = [3 x i8] c"s5\00"
@.str.3 = [3 x i8] c"s6\00"
@.str.4 = [3 x i8] c"s7\00"
@.str.5 = [3 x i8] c"s8\00"
@.str.6 = [3 x i8] c"s9\00"
@.str.7 = [4 x i8] c"s10\00"
@.str.8 = [4 x i8] c"s11\00"
@.str.9 = [4 x i8] c"s12\00"
@.str.10 = [4 x i8] c"s13\00"
@.str.11 = [4 x i8] c"s14\00"
define void @cris_write_data_breakpoint(i32 %0, i64 %1, i64 %2) {
%4 = alloca i32
%5 = alloca i64
%6 = alloca i64
store i32 %0, i32* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load i32, i32* %4
switch i32 %7, label %26 [
i32 0, label %8
i32 1, label %11
i32 2, label %14
i32 3, label %17
i32 4, label %20
i32 5, label %23
]
8: ; preds = %3
%9 = call i32 @supply_register_by_name(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i64* %5)
%10 = call i32 @supply_register_by_name(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i64* %6)
br label %26
11: ; preds = %3
%12 = call i32 @supply_register_by_name(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i64* %5)
%13 = call i32 @supply_register_by_name(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i64* %6)
br label %26
14: ; preds = %3
%15 = call i32 @supply_register_by_name(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i64* %5)
%16 = call i32 @supply_register_by_name(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), i64* %6)
br label %26
17: ; preds = %3
%18 = call i32 @supply_register_by_name(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), i64* %5)
%19 = call i32 @supply_register_by_name(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.7, i64 0, i64 0), i64* %6)
br label %26
20: ; preds = %3
%21 = call i32 @supply_register_by_name(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.8, i64 0, i64 0), i64* %5)
%22 = call i32 @supply_register_by_name(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.9, i64 0, i64 0), i64* %6)
br label %26
23: ; preds = %3
%24 = call i32 @supply_register_by_name(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.10, i64 0, i64 0), i64* %5)
%25 = call i32 @supply_register_by_name(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.11, i64 0, i64 0), i64* %6)
br label %26
26: ; preds = %3, %23, %20, %17, %14, %11, %8
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"s3\00"
@.str.1 = [3 x i8] c"s4\00"
@.str.2 = [3 x i8] c"s5\00"
@.str.3 = [3 x i8] c"s6\00"
@.str.4 = [3 x i8] c"s7\00"
@.str.5 = [3 x i8] c"s8\00"
@.str.6 = [3 x i8] c"s9\00"
@.str.7 = [4 x i8] c"s10\00"
@.str.8 = [4 x i8] c"s11\00"
@.str.9 = [4 x i8] c"s12\00"
@.str.10 = [4 x i8] c"s13\00"
@.str.11 = [4 x i8] c"s14\00"
@reltable.cris_write_data_breakpoint = [6 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str to i64), i64 ptrtoint ([6 x i32]* @reltable.cris_write_data_breakpoint to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.2 to i64), i64 ptrtoint ([6 x i32]* @reltable.cris_write_data_breakpoint to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.4 to i64), i64 ptrtoint ([6 x i32]* @reltable.cris_write_data_breakpoint to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.6 to i64), i64 ptrtoint ([6 x i32]* @reltable.cris_write_data_breakpoint to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.8 to i64), i64 ptrtoint ([6 x i32]* @reltable.cris_write_data_breakpoint to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.10 to i64), i64 ptrtoint ([6 x i32]* @reltable.cris_write_data_breakpoint to i64)) to i32)]
@reltable.cris_write_data_breakpoint.13 = [6 x i32] [i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.1 to i64), i64 ptrtoint ([6 x i32]* @reltable.cris_write_data_breakpoint.13 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.3 to i64), i64 ptrtoint ([6 x i32]* @reltable.cris_write_data_breakpoint.13 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([3 x i8]* @.str.5 to i64), i64 ptrtoint ([6 x i32]* @reltable.cris_write_data_breakpoint.13 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.7 to i64), i64 ptrtoint ([6 x i32]* @reltable.cris_write_data_breakpoint.13 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.9 to i64), i64 ptrtoint ([6 x i32]* @reltable.cris_write_data_breakpoint.13 to i64)) to i32), i32 trunc (i64 sub (i64 ptrtoint ([4 x i8]* @.str.11 to i64), i64 ptrtoint ([6 x i32]* @reltable.cris_write_data_breakpoint.13 to i64)) to i32)]
define void @cris_write_data_breakpoint(i32 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
store i64 %1, i64* %4
store i64 %2, i64* %5
%6 = icmp ult i32 %0, 6
br i1 %6, label %7, label %16
7: ; preds = %3
%8 = sext i32 %0 to i64
%9 = shl i64 %8, 2
%10 = call i8* @llvm.load.relative.i64(i8* bitcast ([6 x i32]* @reltable.cris_write_data_breakpoint to i8*), i64 %9)
%11 = sext i32 %0 to i64
%12 = shl i64 %11, 2
%13 = call i8* @llvm.load.relative.i64(i8* bitcast ([6 x i32]* @reltable.cris_write_data_breakpoint.13 to i8*), i64 %12)
%14 = call i32 @supply_register_by_name(i8* %10, i64* %4)
%15 = call i32 @supply_register_by_name(i8* %13, i64* %5)
br label %16
16: ; preds = %3, %7
ret void
}