#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*/ LCDputc(char);
void LCDprint(char *buf) {
  int i;
  for (i = 0; i < 8; i++) {
    if (buf[i] == 0)
      break;
    LCDputc(buf[i]);
  }
}


x86 assembly (clang, -O0):
<LCDprint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x8,-0xc(%rbp)
jge    1166 <LCDprint+0x56>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
jne    1147 <LCDprint+0x37>
jmp    1166 <LCDprint+0x56>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1030 <LCDputc@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1123 <LCDprint+0x13>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LCDprint>:
push   %rbx
mov    (%rdi),%al
test   %al,%al
je     118c <LCDprint+0x7c>
mov    %rdi,%rbx
movsbl %al,%edi
call   1030 <LCDputc@plt>
mov    0x1(%rbx),%al
test   %al,%al
je     118c <LCDprint+0x7c>
movsbl %al,%edi
call   1030 <LCDputc@plt>
mov    0x2(%rbx),%al
test   %al,%al
je     118c <LCDprint+0x7c>
movsbl %al,%edi
call   1030 <LCDputc@plt>
mov    0x3(%rbx),%al
test   %al,%al
je     118c <LCDprint+0x7c>
movsbl %al,%edi
call   1030 <LCDputc@plt>
mov    0x4(%rbx),%al
test   %al,%al
je     118c <LCDprint+0x7c>
movsbl %al,%edi
call   1030 <LCDputc@plt>
mov    0x5(%rbx),%al
test   %al,%al
je     118c <LCDprint+0x7c>
movsbl %al,%edi
call   1030 <LCDputc@plt>
mov    0x6(%rbx),%al
test   %al,%al
je     118c <LCDprint+0x7c>
movsbl %al,%edi
call   1030 <LCDputc@plt>
mov    0x7(%rbx),%al
test   %al,%al
je     118c <LCDprint+0x7c>
movsbl %al,%edi
pop    %rbx
jmp    1030 <LCDputc@plt>
pop    %rbx
ret

LLVM IR (-O0):
define void @LCDprint(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
br label %4
4: ; preds = %23, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 8
br i1 %6, label %7, label %26
7: ; preds = %4
%8 = load i8*, i8** %2
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds i8, i8* %8, i64 %10
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp eq i32 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %7
br label %26
16: ; preds = %7
%17 = load i8*, i8** %2
%18 = load i32, i32* %3
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i8, i8* %17, i64 %19
%21 = load i8, i8* %20
%22 = call i32 @LCDputc(i8 signext %21)
br label %23
23: ; preds = %16
%24 = load i32, i32* %3
%25 = add nsw i32 %24, 1
store i32 %25, i32* %3
br label %4
26: ; preds = %15, %4
ret void
}

LLVM IR (-O2):
define void @LCDprint(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 0
br i1 %3, label %41, label %4
4: ; preds = %1
%5 = tail call i32 @LCDputc(i8 signext %2)
%6 = getelementptr inbounds i8, i8* %0, i64 1
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 0
br i1 %8, label %41, label %9
9: ; preds = %4
%10 = tail call i32 @LCDputc(i8 signext %7)
%11 = getelementptr inbounds i8, i8* %0, i64 2
%12 = load i8, i8* %11
%13 = icmp eq i8 %12, 0
br i1 %13, label %41, label %14
14: ; preds = %9
%15 = tail call i32 @LCDputc(i8 signext %12)
%16 = getelementptr inbounds i8, i8* %0, i64 3
%17 = load i8, i8* %16
%18 = icmp eq i8 %17, 0
br i1 %18, label %41, label %19
19: ; preds = %14
%20 = tail call i32 @LCDputc(i8 signext %17)
%21 = getelementptr inbounds i8, i8* %0, i64 4
%22 = load i8, i8* %21
%23 = icmp eq i8 %22, 0
br i1 %23, label %41, label %24
24: ; preds = %19
%25 = tail call i32 @LCDputc(i8 signext %22)
%26 = getelementptr inbounds i8, i8* %0, i64 5
%27 = load i8, i8* %26
%28 = icmp eq i8 %27, 0
br i1 %28, label %41, label %29
29: ; preds = %24
%30 = tail call i32 @LCDputc(i8 signext %27)
%31 = getelementptr inbounds i8, i8* %0, i64 6
%32 = load i8, i8* %31
%33 = icmp eq i8 %32, 0
br i1 %33, label %41, label %34
34: ; preds = %29
%35 = tail call i32 @LCDputc(i8 signext %32)
%36 = getelementptr inbounds i8, i8* %0, i64 7
%37 = load i8, i8* %36
%38 = icmp eq i8 %37, 0
br i1 %38, label %41, label %39
39: ; preds = %34
%40 = tail call i32 @LCDputc(i8 signext %37)
br label %41
41: ; preds = %39, %34, %29, %24, %19, %14, %9, %4, %1
ret void
}