#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_char_put(unsigned char, int);
int lcd_text_put(const char *s, int pos) {
  int i;
  for (i = 1; i < pos; i++) {
    lcd_char_put(' ', i);
  }
  for (i = pos; i <= 7; ++i) {
    if (*s == 0) {
      lcd_char_put(' ', i);
    } else {
      lcd_char_put((unsigned char)*s++, i);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<lcd_text_put>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    114d <lcd_text_put+0x3d>
mov    -0x10(%rbp),%esi
mov    $0x20,%edi
call   1030 <lcd_char_put@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <lcd_text_put+0x16>
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
cmpl   $0x7,-0x10(%rbp)
jg     11ae <lcd_text_put+0x9e>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    117f <lcd_text_put+0x6f>
mov    -0x10(%rbp),%esi
mov    $0x20,%edi
call   1030 <lcd_char_put@plt>
jmp    119b <lcd_text_put+0x8b>
mov    -0x8(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x8(%rbp)
mov    (%rax),%al
mov    -0x10(%rbp),%esi
movzbl %al,%edi
call   1030 <lcd_char_put@plt>
jmp    11a0 <lcd_text_put+0x90>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1153 <lcd_text_put+0x43>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcd_text_put>:
push   %rbp
push   %r14
push   %rbx
mov    %esi,%ebx
mov    %rdi,%r14
cmp    $0x2,%esi
jl     1150 <lcd_text_put+0x40>
mov    $0x1,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    $0x20,%edi
mov    %ebp,%esi
call   1030 <lcd_char_put@plt>
add    $0x1,%ebp
cmp    %ebp,%ebx
jne    1130 <lcd_text_put+0x20>
cmp    $0x7,%ebx
jg     1178 <lcd_text_put+0x68>
nopl   0x0(%rax,%rax,1)
movzbl (%r14),%eax
xor    %ecx,%ecx
test   %al,%al
setne  %cl
mov    $0x20,%edx
cmovne %eax,%edx
add    %rcx,%r14
movzbl %dl,%edi
mov    %ebx,%esi
call   1030 <lcd_char_put@plt>
add    $0x1,%ebx
cmp    $0x8,%ebx
jne    1150 <lcd_text_put+0x40>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

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

LLVM IR (-O2):
define i32 @lcd_text_put(i8* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 1
br i1 %3, label %7, label %6
4: ; preds = %7
%5 = icmp slt i32 %1, 8
br i1 %5, label %6, label %24
6: ; preds = %2, %4
br label %12
7: ; preds = %2, %7
%8 = phi i32 [ %10, %7 ], [ 1, %2 ]
%9 = tail call i32 @lcd_char_put(i8 zeroext 32, i32 %8)
%10 = add nuw nsw i32 %8, 1
%11 = icmp eq i32 %10, %1
br i1 %11, label %4, label %7
12: ; preds = %6, %12
%13 = phi i32 [ %22, %12 ], [ %1, %6 ]
%14 = phi i8* [ %20, %12 ], [ %0, %6 ]
%15 = load i8, i8* %14
%16 = icmp eq i8 %15, 0
%17 = select i1 %16, i8 32, i8 %15
%18 = xor i1 %16, true
%19 = zext i1 %18 to i64
%20 = getelementptr i8, i8* %14, i64 %19
%21 = tail call i32 @lcd_char_put(i8 zeroext %17, i32 %13)
%22 = add i32 %13, 1
%23 = icmp eq i32 %22, 8
br i1 %23, label %24, label %12
24: ; preds = %12, %4
ret i32 0
}