#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ free(char *);
char *malloc(int);
int /*<<< orphan*/ printf(char *, char const);
int /*<<< orphan*/ stdout;
unsigned long strlen(char const *);
int /*<<< orphan*/ wait(unsigned long);
void slowPrint(const char *slowString, unsigned long milliseconds) {
  unsigned long strSize = strlen(slowString);
  int i = 0;
  for (; i < strSize; ++i) {
    if (i < (strSize - 1)) {
      if (*(slowString + i) == '\\') {
        char *tmp = malloc(sizeof(char));
        if (*(slowString + i + 1) == 'b') {
          *tmp = '\b';
        }
        if (*(slowString + i + 1) == 'n') {
          *tmp = '\n';
        }
        if (*(slowString + i + 1) == 't') {
          *tmp = '\t';
        }
        printf("%c", *tmp);
        i++;
        fflush(stdout);
        free(tmp);
        continue;
      }
    }
    printf("%c", *(slowString + i));
    fflush(stdout);
    wait(milliseconds);
  }
}


x86 assembly (clang, -O0):
<slowPrint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
movslq -0x1c(%rbp),%rax
cmp    -0x18(%rbp),%rax
jae    129b <slowPrint+0x13b>
movslq -0x1c(%rbp),%rax
mov    -0x18(%rbp),%rcx
sub    $0x1,%rcx
cmp    %rcx,%rax
jae    125e <slowPrint+0xfe>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x5c,%eax
jne    1259 <slowPrint+0xf9>
mov    $0x1,%edi
call   1060 <malloc@plt>
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl 0x1(%rax,%rcx,1),%eax
cmp    $0x62,%eax
jne    11e7 <slowPrint+0x87>
mov    -0x28(%rbp),%rax
movb   $0x8,(%rax)
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl 0x1(%rax,%rcx,1),%eax
cmp    $0x6e,%eax
jne    1204 <slowPrint+0xa4>
mov    -0x28(%rbp),%rax
movb   $0xa,(%rax)
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl 0x1(%rax,%rcx,1),%eax
cmp    $0x74,%eax
jne    1221 <slowPrint+0xc1>
mov    -0x28(%rbp),%rax
movb   $0x9,(%rax)
mov    -0x28(%rbp),%rax
lea    0xdd4(%rip),%rdi
movsbl (%rax),%esi
call   1050 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
mov    0x2d9c(%rip),%rax
mov    (%rax),%edi
call   1070 <fflush@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
jmp    128d <slowPrint+0x12d>
jmp    125e <slowPrint+0xfe>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
lea    0xd93(%rip),%rdi
movsbl (%rax,%rcx,1),%esi
call   1050 <printf@plt>
mov    0x2d63(%rip),%rax
mov    (%rax),%edi
call   1070 <fflush@plt>
mov    -0x10(%rbp),%rdi
call   1080 <wait@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1184 <slowPrint+0x24>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<slowPrint>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,(%rsp)
mov    %rdi,%r13
call   1040 <strlen@plt>
test   %rax,%rax
je     1223 <slowPrint+0xc3>
mov    %rax,%r15
lea    -0x1(%rax),%rbp
xor    %r12d,%r12d
xor    %r14d,%r14d
jmp    11c2 <slowPrint+0x62>
nop
movsbl %al,%esi
lea    0xe66(%rip),%rdi
call   1050 <printf@plt>
mov    0x2e3a(%rip),%rax
mov    (%rax),%edi
call   1070 <fflush@plt>
mov    (%rsp),%rdi
call   1080 <wait@plt>
add    $0x1,%r14d
movslq %r14d,%r12
cmp    %r12,%r15
jbe    1223 <slowPrint+0xc3>
movzbl 0x0(%r13,%r12,1),%eax
cmp    %r12,%rbp
jbe    1190 <slowPrint+0x30>
cmp    $0x5c,%al
jne    1190 <slowPrint+0x30>
mov    $0x1,%edi
call   1060 <malloc@plt>
mov    %rax,%rbx
movzbl 0x1(%r13,%r12,1),%eax
cmp    $0x62,%al
je     11f0 <slowPrint+0x90>
cmp    $0x74,%al
jne    11f4 <slowPrint+0x94>
mov    $0x9,%al
jmp    11f6 <slowPrint+0x96>
mov    $0x8,%al
jmp    11f6 <slowPrint+0x96>
mov    $0xa,%al
mov    %al,(%rbx)
movzbl %al,%esi
lea    0xdfe(%rip),%rdi
call   1050 <printf@plt>
add    $0x1,%r14d
mov    0x2dce(%rip),%rax
mov    (%rax),%edi
call   1070 <fflush@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
jmp    11b6 <slowPrint+0x56>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
@stdout = global i32 0
define void @slowPrint(i8* %0, i64 %1) {
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
%6 = alloca i32
%7 = alloca i8*
store i8* %0, i8** %3
store i64 %1, i64* %4
%8 = load i8*, i8** %3
%9 = call i64 @strlen(i8* %8)
store i64 %9, i64* %5
store i32 0, i32* %6
br label %10
10: ; preds = %85, %2
%11 = load i32, i32* %6
%12 = sext i32 %11 to i64
%13 = load i64, i64* %5
%14 = icmp ult i64 %12, %13
br i1 %14, label %15, label %88
15: ; preds = %10
%16 = load i32, i32* %6
%17 = sext i32 %16 to i64
%18 = load i64, i64* %5
%19 = sub i64 %18, 1
%20 = icmp ult i64 %17, %19
br i1 %20, label %21, label %74
21: ; preds = %15
%22 = load i8*, i8** %3
%23 = load i32, i32* %6
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds i8, i8* %22, i64 %24
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 92
br i1 %28, label %29, label %73
29: ; preds = %21
%30 = call i8* @malloc(i32 1)
store i8* %30, i8** %7
%31 = load i8*, i8** %3
%32 = load i32, i32* %6
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds i8, i8* %31, i64 %33
%35 = getelementptr inbounds i8, i8* %34, i64 1
%36 = load i8, i8* %35
%37 = sext i8 %36 to i32
%38 = icmp eq i32 %37, 98
br i1 %38, label %39, label %41
39: ; preds = %29
%40 = load i8*, i8** %7
store i8 8, i8* %40
br label %41
41: ; preds = %39, %29
%42 = load i8*, i8** %3
%43 = load i32, i32* %6
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds i8, i8* %42, i64 %44
%46 = getelementptr inbounds i8, i8* %45, i64 1
%47 = load i8, i8* %46
%48 = sext i8 %47 to i32
%49 = icmp eq i32 %48, 110
br i1 %49, label %50, label %52
50: ; preds = %41
%51 = load i8*, i8** %7
store i8 10, i8* %51
br label %52
52: ; preds = %50, %41
%53 = load i8*, i8** %3
%54 = load i32, i32* %6
%55 = sext i32 %54 to i64
%56 = getelementptr inbounds i8, i8* %53, i64 %55
%57 = getelementptr inbounds i8, i8* %56, i64 1
%58 = load i8, i8* %57
%59 = sext i8 %58 to i32
%60 = icmp eq i32 %59, 116
br i1 %60, label %61, label %63
61: ; preds = %52
%62 = load i8*, i8** %7
store i8 9, i8* %62
br label %63
63: ; preds = %61, %52
%64 = load i8*, i8** %7
%65 = load i8, i8* %64
%66 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %65)
%67 = load i32, i32* %6
%68 = add nsw i32 %67, 1
store i32 %68, i32* %6
%69 = load i32, i32* @stdout
%70 = call i32 @fflush(i32 %69)
%71 = load i8*, i8** %7
%72 = call i32 @free(i8* %71)
br label %85
73: ; preds = %21
br label %74
74: ; preds = %73, %15
%75 = load i8*, i8** %3
%76 = load i32, i32* %6
%77 = sext i32 %76 to i64
%78 = getelementptr inbounds i8, i8* %75, i64 %77
%79 = load i8, i8* %78
%80 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %79)
%81 = load i32, i32* @stdout
%82 = call i32 @fflush(i32 %81)
%83 = load i64, i64* %4
%84 = call i32 @wait(i64 %83)
br label %85
85: ; preds = %74, %63
%86 = load i32, i32* %6
%87 = add nsw i32 %86, 1
store i32 %87, i32* %6
br label %10
88: ; preds = %10
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
@stdout = global i32 0
define void @slowPrint(i8* nocapture %0, i64 %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%4 = icmp eq i64 %3, 0
br i1 %4, label %39, label %5
5: ; preds = %2
%6 = add i64 %3, -1
br label %7
7: ; preds = %5, %34
%8 = phi i64 [ 0, %5 ], [ %37, %34 ]
%9 = phi i32 [ 0, %5 ], [ %36, %34 ]
%10 = icmp ugt i64 %6, %8
%11 = getelementptr inbounds i8, i8* %0, i64 %8
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 92
%14 = select i1 %10, i1 %13, i1 false
br i1 %14, label %15, label %29
15: ; preds = %7
%16 = tail call dereferenceable_or_null(1) i8* @malloc(i32 1)
%17 = getelementptr inbounds i8, i8* %11, i64 1
%18 = load i8, i8* %17
switch i8 %18, label %21 [
i8 98, label %22
i8 110, label %19
i8 116, label %20
]
19: ; preds = %15
br label %22
20: ; preds = %15
br label %22
21: ; preds = %15
unreachable
22: ; preds = %15, %19, %20
%23 = phi i8 [ 10, %19 ], [ 9, %20 ], [ 8, %15 ]
store i8 %23, i8* %16
%24 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %23)
%25 = add nsw i32 %9, 1
%26 = load i32, i32* @stdout
%27 = tail call i32 @fflush(i32 %26)
%28 = tail call i32 @free(i8* %16)
br label %34
29: ; preds = %7
%30 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8 signext %12)
%31 = load i32, i32* @stdout
%32 = tail call i32 @fflush(i32 %31)
%33 = tail call i32 @wait(i64 %1)
br label %34
34: ; preds = %29, %22
%35 = phi i32 [ %25, %22 ], [ %9, %29 ]
%36 = add nsw i32 %35, 1
%37 = sext i32 %36 to i64
%38 = icmp ugt i64 %3, %37
br i1 %38, label %7, label %39
39: ; preds = %34, %2
ret void
}