#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 */
struct ascii85 {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ ascii85_encode(struct ascii85 *, char const);
void _ascii85_write_toneline(struct ascii85 *a, const char *buf, size_t ss,
                             size_t count) {
  int x;
  if (ss == 0 || count == 0)
    return;
  for (x = 0; x < ss * count; x += ss)
    ascii85_encode(a, buf[x]);
}


x86 assembly (clang, -O0):
<_ascii85_write_toneline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
cmpq   $0x0,-0x18(%rbp)
je     113e <_ascii85_write_toneline+0x2e>
cmpq   $0x0,-0x20(%rbp)
jne    1143 <_ascii85_write_toneline+0x33>
jmp    1188 <_ascii85_write_toneline+0x78>
movl   $0x0,-0x24(%rbp)
movslq -0x24(%rbp),%rax
mov    -0x18(%rbp),%rcx
imul   -0x20(%rbp),%rcx
cmp    %rcx,%rax
jae    1188 <_ascii85_write_toneline+0x78>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
movslq -0x24(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
call   1030 <ascii85_encode@plt>
mov    -0x18(%rbp),%rcx
movslq -0x24(%rbp),%rax
add    %rcx,%rax
mov    %eax,-0x24(%rbp)
jmp    114a <_ascii85_write_toneline+0x3a>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_ascii85_write_toneline>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
test   %rdx,%rdx
je     1158 <_ascii85_write_toneline+0x48>
mov    %rcx,%r13
test   %rcx,%rcx
je     1158 <_ascii85_write_toneline+0x48>
mov    %rdx,%r14
imul   %rdx,%r13
test   %r13,%r13
je     1158 <_ascii85_write_toneline+0x48>
mov    %rsi,%r15
mov    %rdi,%r12
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
movsbl (%r15,%rbx,1),%esi
mov    %r12,%rdi
call   1030 <ascii85_encode@plt>
add    %r14d,%ebx
movslq %ebx,%rbx
cmp    %r13,%rbx
jb     1140 <_ascii85_write_toneline+0x30>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
%struct.ascii85 = type { i32 }
define void @_ascii85_write_toneline(%struct.ascii85* %0, i8* %1, i64 %2, i64 %3) {
%5 = alloca %struct.ascii85*
%6 = alloca i8*
%7 = alloca i64
%8 = alloca i64
%9 = alloca i32
store %struct.ascii85* %0, %struct.ascii85** %5
store i8* %1, i8** %6
store i64 %2, i64* %7
store i64 %3, i64* %8
%10 = load i64, i64* %7
%11 = icmp eq i64 %10, 0
br i1 %11, label %15, label %12
12: ; preds = %4
%13 = load i64, i64* %8
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %12, %4
br label %38
16: ; preds = %12
store i32 0, i32* %9
br label %17
17: ; preds = %32, %16
%18 = load i32, i32* %9
%19 = sext i32 %18 to i64
%20 = load i64, i64* %7
%21 = load i64, i64* %8
%22 = mul i64 %20, %21
%23 = icmp ult i64 %19, %22
br i1 %23, label %24, label %38
24: ; preds = %17
%25 = load %struct.ascii85*, %struct.ascii85** %5
%26 = load i8*, i8** %6
%27 = load i32, i32* %9
%28 = sext i32 %27 to i64
%29 = getelementptr inbounds i8, i8* %26, i64 %28
%30 = load i8, i8* %29
%31 = call i32 @ascii85_encode(%struct.ascii85* %25, i8 signext %30)
br label %32
32: ; preds = %24
%33 = load i64, i64* %7
%34 = load i32, i32* %9
%35 = sext i32 %34 to i64
%36 = add i64 %35, %33
%37 = trunc i64 %36 to i32
store i32 %37, i32* %9
br label %17
38: ; preds = %15, %17
ret void
}

LLVM IR (-O2):
%struct.ascii85 = type { i32 }
define void @_ascii85_write_toneline(%struct.ascii85* %0, i8* nocapture %1, i64 %2, i64 %3) {
%5 = icmp eq i64 %2, 0
%6 = icmp eq i64 %3, 0
%7 = or i1 %5, %6
br i1 %7, label %20, label %8
8: ; preds = %4
%9 = mul i64 %3, %2
%10 = icmp eq i64 %9, 0
br i1 %10, label %20, label %11
11: ; preds = %8, %11
%12 = phi i64 [ %18, %11 ], [ 0, %8 ]
%13 = getelementptr inbounds i8, i8* %1, i64 %12
%14 = load i8, i8* %13
%15 = tail call i32 @ascii85_encode(%struct.ascii85* %0, i8 signext %14)
%16 = add i64 %12, %2
%17 = shl i64 %16, 32
%18 = ashr exact i64 %17, 32
%19 = icmp ult i64 %18, %9
br i1 %19, label %11, label %20
20: ; preds = %11, %8, %4
ret void
}