void SL11BufWrite(short address, unsigned char *buffer, short byte_count) {
  if (byte_count <= 0)
    return;
  *((volatile unsigned char *)(((long unsigned int)(int)0xa0000000) |
                               (0x100C0000))) = (address);
  while (byte_count--)
    *((volatile unsigned char *)(((long unsigned int)(int)0xa0000000) |
                                 (0x100C0000 + 8))) = (*buffer++);
}


x86 assembly (clang, -O0):
<SL11BufWrite>:
push   %rbp
mov    %rsp,%rbp
mov    %dx,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %ax,-0x12(%rbp)
movswl -0x12(%rbp),%eax
cmp    $0x0,%eax
jg     1128 <SL11BufWrite+0x28>
jmp    116f <SL11BufWrite+0x6f>
mov    -0x2(%rbp),%ax
mov    %al,%cl
mov    $0xffffffffb00c0000,%rax
mov    %cl,(%rax)
mov    -0x12(%rbp),%ax
mov    %ax,%cx
add    $0xffff,%cx
mov    %cx,-0x12(%rbp)
cmp    $0x0,%ax
je     116f <SL11BufWrite+0x6f>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%cl
mov    $0xffffffffb00c0008,%rax
mov    %cl,(%rax)
jmp    1137 <SL11BufWrite+0x37>
pop    %rbp
ret

x86 assembly (clang, -O2):
<SL11BufWrite>:
test   %dx,%dx
jle    11c8 <SL11BufWrite+0xc8>
mov    %dil,0xffffffffb00c0000
b0
lea    -0x1(%rdx),%r8d
test   $0x7,%dl
je     1149 <SL11BufWrite+0x49>
movzwl %dx,%edi
and    $0x7,%edi
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movzbl (%rsi,%rcx,1),%eax
mov    %al,0xffffffffb00c0008
add    $0x1,%rcx
cmp    %cx,%di
jne    1130 <SL11BufWrite+0x30>
sub    %ecx,%edx
add    %rcx,%rsi
cmp    $0x7,%r8w
jb     11c8 <SL11BufWrite+0xc8>
movzwl %dx,%eax
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
movzbl (%rsi,%rcx,1),%edx
mov    %dl,0xffffffffb00c0008
movzbl 0x1(%rsi,%rcx,1),%edx
mov    %dl,0xffffffffb00c0008
movzbl 0x2(%rsi,%rcx,1),%edx
mov    %dl,0xffffffffb00c0008
movzbl 0x3(%rsi,%rcx,1),%edx
mov    %dl,0xffffffffb00c0008
movzbl 0x4(%rsi,%rcx,1),%edx
mov    %dl,0xffffffffb00c0008
movzbl 0x5(%rsi,%rcx,1),%edx
mov    %dl,0xffffffffb00c0008
movzbl 0x6(%rsi,%rcx,1),%edx
mov    %dl,0xffffffffb00c0008
movzbl 0x7(%rsi,%rcx,1),%edx
mov    %dl,0xffffffffb00c0008
add    $0x8,%rcx
cmp    %cx,%ax
jne    1160 <SL11BufWrite+0x60>
ret

LLVM IR (-O0):
define void @SL11BufWrite(i16 signext %0, i8* %1, i16 signext %2) {
%4 = alloca i16
%5 = alloca i8*
%6 = alloca i16
store i16 %0, i16* %4
store i8* %1, i8** %5
store i16 %2, i16* %6
%7 = load i16, i16* %6
%8 = sext i16 %7 to i32
%9 = icmp sle i32 %8, 0
br i1 %9, label %10, label %11
10: ; preds = %3
br label %22
11: ; preds = %3
%12 = load i16, i16* %4
%13 = trunc i16 %12 to i8
store volatile i8 %13, i8* inttoptr (i64 -1341390848 to i8*)
br label %14
14: ; preds = %18, %11
%15 = load i16, i16* %6
%16 = add i16 %15, -1
store i16 %16, i16* %6
%17 = icmp ne i16 %15, 0
br i1 %17, label %18, label %22
18: ; preds = %14
%19 = load i8*, i8** %5
%20 = getelementptr inbounds i8, i8* %19, i32 1
store i8* %20, i8** %5
%21 = load i8, i8* %19
store volatile i8 %21, i8* inttoptr (i64 -1341390840 to i8*)
br label %14
22: ; preds = %10, %14
ret void
}

LLVM IR (-O2):
define void @SL11BufWrite(i16 signext %0, i8* nocapture %1, i16 signext %2) {
%4 = icmp slt i16 %2, 1
br i1 %4, label %44, label %5
5: ; preds = %3
%6 = trunc i16 %0 to i8
store volatile i8 %6, i8* inttoptr (i64 -1341390848 to i8*)
%7 = add i16 %2, -1
%8 = and i16 %2, 7
%9 = icmp eq i16 %8, 0
br i1 %9, label %19, label %10
10: ; preds = %5, %10
%11 = phi i16 [ %14, %10 ], [ %2, %5 ]
%12 = phi i8* [ %15, %10 ], [ %1, %5 ]
%13 = phi i16 [ %17, %10 ], [ 0, %5 ]
%14 = add i16 %11, -1
%15 = getelementptr inbounds i8, i8* %12, i64 1
%16 = load i8, i8* %12
store volatile i8 %16, i8* inttoptr (i64 -1341390840 to i8*)
%17 = add i16 %13, 1
%18 = icmp eq i16 %17, %8
br i1 %18, label %19, label %10
19: ; preds = %10, %5
%20 = phi i16 [ %2, %5 ], [ %14, %10 ]
%21 = phi i8* [ %1, %5 ], [ %15, %10 ]
%22 = icmp ult i16 %7, 7
br i1 %22, label %44, label %23
23: ; preds = %19, %23
%24 = phi i16 [ %40, %23 ], [ %20, %19 ]
%25 = phi i8* [ %41, %23 ], [ %21, %19 ]
%26 = getelementptr inbounds i8, i8* %25, i64 1
%27 = load i8, i8* %25
store volatile i8 %27, i8* inttoptr (i64 -1341390840 to i8*)
%28 = getelementptr inbounds i8, i8* %25, i64 2
%29 = load i8, i8* %26
store volatile i8 %29, i8* inttoptr (i64 -1341390840 to i8*)
%30 = getelementptr inbounds i8, i8* %25, i64 3
%31 = load i8, i8* %28
store volatile i8 %31, i8* inttoptr (i64 -1341390840 to i8*)
%32 = getelementptr inbounds i8, i8* %25, i64 4
%33 = load i8, i8* %30
store volatile i8 %33, i8* inttoptr (i64 -1341390840 to i8*)
%34 = getelementptr inbounds i8, i8* %25, i64 5
%35 = load i8, i8* %32
store volatile i8 %35, i8* inttoptr (i64 -1341390840 to i8*)
%36 = getelementptr inbounds i8, i8* %25, i64 6
%37 = load i8, i8* %34
store volatile i8 %37, i8* inttoptr (i64 -1341390840 to i8*)
%38 = getelementptr inbounds i8, i8* %25, i64 7
%39 = load i8, i8* %36
store volatile i8 %39, i8* inttoptr (i64 -1341390840 to i8*)
%40 = add i16 %24, -8
%41 = getelementptr inbounds i8, i8* %25, i64 8
%42 = load i8, i8* %38
store volatile i8 %42, i8* inttoptr (i64 -1341390840 to i8*)
%43 = icmp eq i16 %40, 0
br i1 %43, label %44, label %23
44: ; preds = %19, %23, %3
ret void
}