#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 */
scalar_t__ malloc(int);
int /*<<< orphan*/ sprintf(char *, char *, int, int);
char *PrinterError(char *string) {
  int length = 0, errorCount = 0;
  while (*string) {
    errorCount += (*string < 'a' || *string > 'm');
    string++;
    length++;
  }
  char *result = (char *)malloc(length * sizeof(char));
  sprintf(result, "%d/%d", errorCount, length);
  return result;
}


x86 assembly (clang, -O0):
<PrinterError>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
cmpb   $0x0,(%rax)
je     1194 <PrinterError+0x74>
mov    -0x8(%rbp),%rax
movsbl (%rax),%ecx
mov    $0x1,%al
cmp    $0x61,%ecx
mov    %al,-0x19(%rbp)
jl     116c <PrinterError+0x4c>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x6d,%eax
setg   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    -0x10(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    113a <PrinterError+0x1a>
movslq -0xc(%rbp),%rax
shl    $0x0,%rax
mov    %eax,%edi
call   1030 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    0xe48(%rip),%rsi
call   1040 <sprintf@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<PrinterError>:
push   %rbp
push   %r14
push   %rbx
mov    (%rdi),%al
xor    %ebx,%ebx
xor    %ebp,%ebp
test   %al,%al
je     1144 <PrinterError+0x24>
xchg   %ax,%ax
add    $0x92,%al
cmp    $0xf3,%al
adc    $0x0,%ebp
movzbl 0x1(%rdi,%rbx,1),%eax
add    $0x1,%rbx
test   %al,%al
jne    1130 <PrinterError+0x10>
mov    %ebx,%edi
call   1030 <malloc@plt>
mov    %rax,%r14
lea    0xeab(%rip),%rsi
mov    %rax,%rdi
mov    %ebp,%edx
mov    %ebx,%ecx
call   1040 <sprintf@plt>
mov    %r14,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%d/%d\00"
define i8* @PrinterError(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %2
store i32 0, i32* %3
store i32 0, i32* %4
br label %6
6: ; preds = %20, %1
%7 = load i8*, i8** %2
%8 = load i8, i8* %7
%9 = icmp ne i8 %8, 0
br i1 %9, label %10, label %29
10: ; preds = %6
%11 = load i8*, i8** %2
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp slt i32 %13, 97
br i1 %14, label %20, label %15
15: ; preds = %10
%16 = load i8*, i8** %2
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp sgt i32 %18, 109
br label %20
20: ; preds = %15, %10
%21 = phi i1 [ true, %10 ], [ %19, %15 ]
%22 = zext i1 %21 to i32
%23 = load i32, i32* %4
%24 = add nsw i32 %23, %22
store i32 %24, i32* %4
%25 = load i8*, i8** %2
%26 = getelementptr inbounds i8, i8* %25, i32 1
store i8* %26, i8** %2
%27 = load i32, i32* %3
%28 = add nsw i32 %27, 1
store i32 %28, i32* %3
br label %6
29: ; preds = %6
%30 = load i32, i32* %3
%31 = sext i32 %30 to i64
%32 = mul i64 %31, 1
%33 = trunc i64 %32 to i32
%34 = call i64 @malloc(i32 %33)
%35 = inttoptr i64 %34 to i8*
store i8* %35, i8** %5
%36 = load i8*, i8** %5
%37 = load i32, i32* %4
%38 = load i32, i32* %3
%39 = call i32 @sprintf(i8* %36, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %37, i32 %38)
%40 = load i8*, i8** %5
ret i8* %40
}

LLVM IR (-O2):
@.str = [6 x i8] c"%d/%d\00"
define i8* @PrinterError(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %17, label %4
4: ; preds = %1, %4
%5 = phi i8 [ %15, %4 ], [ %2, %1 ]
%6 = phi i8* [ %13, %4 ], [ %0, %1 ]
%7 = phi i32 [ %12, %4 ], [ 0, %1 ]
%8 = phi i32 [ %14, %4 ], [ 0, %1 ]
%9 = add i8 %5, -110
%10 = icmp ult i8 %9, -13
%11 = zext i1 %10 to i32
%12 = add nuw nsw i32 %7, %11
%13 = getelementptr inbounds i8, i8* %6, i64 1
%14 = add nuw nsw i32 %8, 1
%15 = load i8, i8* %13
%16 = icmp eq i8 %15, 0
br i1 %16, label %17, label %4
17: ; preds = %4, %1
%18 = phi i32 [ 0, %1 ], [ %14, %4 ]
%19 = phi i32 [ 0, %1 ], [ %12, %4 ]
%20 = tail call i64 @malloc(i32 %18)
%21 = inttoptr i64 %20 to i8*
%22 = tail call i32 @sprintf(i8* dereferenceable(1) %21, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %19, i32 %18)
ret i8* %21
}