#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*/ lcd_display_char(unsigned int, unsigned int, unsigned int,
                                    unsigned int, char);
void lcd_display_str(unsigned int x, unsigned int y, unsigned int font_color,
                     unsigned int bg_color, char *str) {
  for (int i = 0; str[i] != '\0'; ++i) {
    lcd_display_char(x, y, font_color, bg_color, str[i]);
    x += 8;
  }
  return;
}


x86 assembly (clang, -O0):
<lcd_display_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
je     1179 <lcd_display_str+0x69>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%r8
movsbl (%rax,%r8,1),%r8d
call   1030 <lcd_display_char@plt>
mov    -0x4(%rbp),%eax
add    $0x8,%eax
mov    %eax,-0x4(%rbp)
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    112f <lcd_display_str+0x1f>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcd_display_str>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    (%r8),%al
test   %al,%al
je     1162 <lcd_display_str+0x52>
mov    %r8,%rbx
mov    %ecx,%r14d
mov    %edx,%r15d
mov    %esi,%r12d
mov    %edi,%ebp
add    $0x1,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
movsbl %al,%r8d
mov    %ebp,%edi
mov    %r12d,%esi
mov    %r15d,%edx
mov    %r14d,%ecx
call   1030 <lcd_display_char@plt>
add    $0x8,%ebp
movzbl (%rbx),%eax
add    $0x1,%rbx
test   %al,%al
jne    1140 <lcd_display_str+0x30>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

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