#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*/ drawChar(char, char, char);
void drawStr(char *buf, char strlen, char x, char y) {
  char i;
  for (i = 0; i < strlen - 1; i++) {
    drawChar(i * (6 + 2) + x, y, buf[i]);
  }
}


x86 assembly (clang, -O0):
<drawStr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %cl,%al
mov    %dl,%cl
mov    %sil,%dl
mov    %rdi,-0x8(%rbp)
mov    %dl,-0x9(%rbp)
mov    %cl,-0xa(%rbp)
mov    %al,-0xb(%rbp)
movb   $0x0,-0xc(%rbp)
movsbl -0xc(%rbp),%eax
movsbl -0x9(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jge    117c <drawStr+0x6c>
movsbl -0xc(%rbp),%eax
shl    $0x3,%eax
movsbl -0xa(%rbp),%ecx
add    %ecx,%eax
mov    %al,%sil
mov    -0xb(%rbp),%dl
mov    -0x8(%rbp),%rax
movsbq -0xc(%rbp),%rcx
movsbl %sil,%edi
movsbl %dl,%esi
movsbl (%rax,%rcx,1),%edx
call   1030 <drawChar@plt>
mov    -0xc(%rbp),%al
add    $0x1,%al
mov    %al,-0xc(%rbp)
jmp    1130 <drawStr+0x20>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<drawStr>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %esi,%r15d
cmp    $0x2,%r15b
jl     1156 <drawStr+0x46>
mov    %edx,%ebx
mov    %rdi,%r14
add    $0xffffffff,%r15d
xor    %ebp,%ebp
movsbl %cl,%r12d
movsbq %bpl,%rbp
movsbl (%r14,%rbp,1),%edx
movsbl %bl,%ebx
mov    %ebx,%edi
mov    %r12d,%esi
call   1030 <drawChar@plt>
add    $0x1,%bpl
movsbl %bpl,%eax
add    $0x8,%bl
cmp    %eax,%r15d
jg     1130 <drawStr+0x20>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
define void @drawStr(i8* nocapture %0, i8 signext %1, i8 signext %2, i8 signext %3) {
%5 = sext i8 %1 to i32
%6 = add nsw i32 %5, -1
%7 = icmp sgt i8 %1, 1
br i1 %7, label %8, label %19
8: ; preds = %4, %8
%9 = phi i8 [ %16, %8 ], [ 0, %4 ]
%10 = shl i8 %9, 3
%11 = add i8 %10, %2
%12 = sext i8 %9 to i64
%13 = getelementptr inbounds i8, i8* %0, i64 %12
%14 = load i8, i8* %13
%15 = tail call i32 @drawChar(i8 signext %11, i8 signext %3, i8 signext %14)
%16 = add i8 %9, 1
%17 = sext i8 %16 to i32
%18 = icmp sgt i32 %6, %17
br i1 %18, label %8, label %19
19: ; preds = %8, %4
ret void
}