void sample_string_B(char *s, int i) {
  s[0] = (char)(1 + (i % 254));
  s[1] = (char)(1 + ((i / 254) % 254));
  s[2] = (char)(1 + (((i / 254) / 254) % 254));
  s[3] = 'a';
  s[4] = (char)(1 + ((i * (i - 3)) % 217));
  s[5] = (char)(1 + ((17 * i + 129) % 233));
  s[6] = '\0';
}


x86 assembly (clang, -O0):
<sample_string_B>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    $0xfe,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %dl,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0xc(%rbp),%eax
mov    $0xfe,%ecx
cltd
idiv   %ecx
mov    $0xfe,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %dl,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0xc(%rbp),%eax
mov    $0xfe,%ecx
cltd
idiv   %ecx
mov    $0xfe,%ecx
cltd
idiv   %ecx
mov    $0xfe,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %dl,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0x8(%rbp),%rax
movb   $0x61,0x3(%rax)
mov    -0xc(%rbp),%eax
mov    -0xc(%rbp),%ecx
sub    $0x3,%ecx
imul   %ecx,%eax
mov    $0xd9,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %dl,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x4(%rax)
imul   $0x11,-0xc(%rbp),%eax
add    $0x81,%eax
mov    $0xe9,%ecx
cltd
idiv   %ecx
add    $0x1,%edx
mov    %dl,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x5(%rax)
mov    -0x8(%rbp),%rax
movb   $0x0,0x6(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<sample_string_B>:
movslq %esi,%rax
imul   $0xffffffff81020409,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0x7,%ecx
add    %edx,%ecx
lea    (%rcx,%rcx,1),%edx
add    %eax,%edx
add    $0x1,%dl
mov    %dl,(%rdi)
movslq %ecx,%rcx
imul   $0xffffffff81020409,%rcx,%rdx
shr    $0x20,%rdx
add    %ecx,%edx
mov    %edx,%esi
shr    $0x1f,%esi
shr    $0x7,%edx
add    %esi,%edx
add    %edx,%edx
add    %ecx,%edx
add    $0x1,%dl
mov    %dl,0x1(%rdi)
imul   $0xffffffff82061029,%rax,%rcx
shr    $0x20,%rcx
add    %eax,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
sar    $0xf,%ecx
add    %edx,%ecx
movslq %ecx,%rcx
imul   $0xffffffff81020409,%rcx,%rdx
shr    $0x20,%rdx
add    %ecx,%edx
mov    %edx,%esi
shr    $0x1f,%esi
shr    $0x7,%edx
add    %esi,%edx
add    %edx,%edx
add    %ecx,%edx
add    $0x1,%dl
mov    %dl,0x2(%rdi)
movb   $0x61,0x3(%rdi)
lea    -0x3(%rax),%ecx
imul   %eax,%ecx
movslq %ecx,%rcx
imul   $0xffffffff97012e03,%rcx,%rdx
shr    $0x20,%rdx
add    %ecx,%edx
mov    %edx,%esi
shr    $0x1f,%esi
shr    $0x7,%edx
add    %esi,%edx
imul   $0xd9,%edx,%edx
sub    %edx,%ecx
add    $0x1,%cl
mov    %cl,0x4(%rdi)
mov    %eax,%ecx
shl    $0x4,%ecx
lea    (%rax,%rcx,1),%edx
add    %ecx,%eax
add    $0x81,%eax
cltq
imul   $0xffffffff8ca29c05,%rax,%rcx
shr    $0x20,%rcx
add    %edx,%ecx
add    $0x81,%ecx
mov    %ecx,%edx
shr    $0x1f,%edx
shr    $0x7,%ecx
add    %edx,%ecx
imul   $0xe9,%ecx,%ecx
sub    %ecx,%eax
add    $0x1,%al
mov    %al,0x5(%rdi)
movb   $0x0,0x6(%rdi)
ret

LLVM IR (-O0):
define void @sample_string_B(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = srem i32 %5, 254
%7 = add nsw i32 1, %6
%8 = trunc i32 %7 to i8
%9 = load i8*, i8** %3
%10 = getelementptr inbounds i8, i8* %9, i64 0
store i8 %8, i8* %10
%11 = load i32, i32* %4
%12 = sdiv i32 %11, 254
%13 = srem i32 %12, 254
%14 = add nsw i32 1, %13
%15 = trunc i32 %14 to i8
%16 = load i8*, i8** %3
%17 = getelementptr inbounds i8, i8* %16, i64 1
store i8 %15, i8* %17
%18 = load i32, i32* %4
%19 = sdiv i32 %18, 254
%20 = sdiv i32 %19, 254
%21 = srem i32 %20, 254
%22 = add nsw i32 1, %21
%23 = trunc i32 %22 to i8
%24 = load i8*, i8** %3
%25 = getelementptr inbounds i8, i8* %24, i64 2
store i8 %23, i8* %25
%26 = load i8*, i8** %3
%27 = getelementptr inbounds i8, i8* %26, i64 3
store i8 97, i8* %27
%28 = load i32, i32* %4
%29 = load i32, i32* %4
%30 = sub nsw i32 %29, 3
%31 = mul nsw i32 %28, %30
%32 = srem i32 %31, 217
%33 = add nsw i32 1, %32
%34 = trunc i32 %33 to i8
%35 = load i8*, i8** %3
%36 = getelementptr inbounds i8, i8* %35, i64 4
store i8 %34, i8* %36
%37 = load i32, i32* %4
%38 = mul nsw i32 17, %37
%39 = add nsw i32 %38, 129
%40 = srem i32 %39, 233
%41 = add nsw i32 1, %40
%42 = trunc i32 %41 to i8
%43 = load i8*, i8** %3
%44 = getelementptr inbounds i8, i8* %43, i64 5
store i8 %42, i8* %44
%45 = load i8*, i8** %3
%46 = getelementptr inbounds i8, i8* %45, i64 6
store i8 0, i8* %46
ret void
}

LLVM IR (-O2):
define void @sample_string_B(i8* nocapture writeonly %0, i32 %1) {
%3 = srem i32 %1, 254
%4 = trunc i32 %3 to i8
%5 = add i8 %4, 1
store i8 %5, i8* %0
%6 = sdiv i32 %1, 254
%7 = srem i32 %6, 254
%8 = trunc i32 %7 to i8
%9 = add i8 %8, 1
%10 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %9, i8* %10
%11 = sdiv i32 %1, 64516
%12 = srem i32 %11, 254
%13 = trunc i32 %12 to i8
%14 = add i8 %13, 1
%15 = getelementptr inbounds i8, i8* %0, i64 2
store i8 %14, i8* %15
%16 = getelementptr inbounds i8, i8* %0, i64 3
store i8 97, i8* %16
%17 = add nsw i32 %1, -3
%18 = mul nsw i32 %17, %1
%19 = srem i32 %18, 217
%20 = trunc i32 %19 to i8
%21 = add i8 %20, 1
%22 = getelementptr inbounds i8, i8* %0, i64 4
store i8 %21, i8* %22
%23 = mul nsw i32 %1, 17
%24 = add nsw i32 %23, 129
%25 = srem i32 %24, 233
%26 = trunc i32 %25 to i8
%27 = add i8 %26, 1
%28 = getelementptr inbounds i8, i8* %0, i64 5
store i8 %27, i8* %28
%29 = getelementptr inbounds i8, i8* %0, i64 6
store i8 0, i8* %29
ret void
}