#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*/ render_char(char, int, int, char *, int);
int strlen(char *);
void render_string(char *str, int x, int y, char *color, int thick) {
  int i;
  for (i = 0; i < strlen(str); i++)
    render_char(str[i], x + i * (14 + 14 * thick), y, color, thick);
}


x86 assembly (clang, -O0):
<render_string>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8d,-0x1c(%rbp)
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
cmp    %ecx,%eax
jge    119b <render_string+0x7b>
mov    -0x8(%rbp),%rax
movslq -0x20(%rbp),%rcx
mov    (%rax,%rcx,1),%al
mov    -0xc(%rbp),%esi
mov    -0x20(%rbp),%ecx
imul   $0xe,-0x1c(%rbp),%edx
add    $0xe,%edx
imul   %edx,%ecx
add    %ecx,%esi
mov    -0x10(%rbp),%edx
mov    -0x18(%rbp),%rcx
mov    -0x1c(%rbp),%r8d
movsbl %al,%edi
call   1040 <render_char@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    1141 <render_string+0x21>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<render_string>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r8d,%r12d
mov    %rcx,(%rsp)
mov    %edx,%r15d
mov    %esi,%ebp
mov    %rdi,%rbx
call   1030 <strlen@plt>
test   %eax,%eax
jle    118c <render_string+0x6c>
mov    %r12d,%r13d
shl    $0x4,%r13d
sub    %r12d,%r13d
sub    %r12d,%r13d
add    $0xe,%r13d
xor    %r14d,%r14d
nopw   0x0(%rax,%rax,1)
movsbl (%rbx,%r14,1),%edi
mov    %ebp,%esi
mov    %r15d,%edx
mov    (%rsp),%rcx
mov    %r12d,%r8d
call   1040 <render_char@plt>
add    $0x1,%r14
mov    %rbx,%rdi
call   1030 <strlen@plt>
cltq
add    %r13d,%ebp
cmp    %rax,%r14
jl     1160 <render_string+0x40>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

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

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