#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_clear();
int /*<<< orphan*/ lcd_gotoxy(int /*<<< orphan*/, int);
int /*<<< orphan*/ lcd_puts(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char *);
void lcd_print_lines(char **line_v, int lines) {
  int i;
  lcd_clear();
  for (i = 0; i < lines; i++) {
    char line[21];
    snprintf(line, 21, "%s", line_v[i]);
    lcd_gotoxy(0, i);
    lcd_puts(line);
  }
}


x86 assembly (clang, -O0):
<lcd_print_lines>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    $0x0,%al
call   1050 <lcd_clear@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11ab <lcd_print_lines+0x6b>
lea    -0x30(%rbp),%rdi
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
mov    $0x15,%esi
lea    0xe7b(%rip),%rdx
call   1040 <snprintf@plt>
mov    -0x10(%rbp),%esi
xor    %edi,%edi
call   1030 <lcd_gotoxy@plt>
lea    -0x30(%rbp),%rdi
call   1060 <lcd_puts@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    115d <lcd_print_lines+0x1d>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcd_print_lines>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x20,%rsp
mov    %esi,%ebx
mov    %rdi,%r14
xor    %eax,%eax
call   1050 <lcd_clear@plt>
test   %ebx,%ebx
jle    119e <lcd_print_lines+0x5e>
mov    %ebx,%r13d
xor    %ebx,%ebx
lea    0xe97(%rip),%r15
mov    %rsp,%r12
nopl   0x0(%rax)
mov    (%r14,%rbx,8),%rcx
mov    %r12,%rdi
mov    $0x15,%esi
mov    %r15,%rdx
call   1040 <snprintf@plt>
xor    %edi,%edi
mov    %ebx,%esi
call   1030 <lcd_gotoxy@plt>
mov    %r12,%rdi
call   1060 <lcd_puts@plt>
add    $0x1,%rbx
cmp    %rbx,%r13
jne    1170 <lcd_print_lines+0x30>
add    $0x20,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%s\00"
define void @lcd_print_lines(i8** %0, i32 %1) {
%3 = alloca i8**
%4 = alloca i32
%5 = alloca i32
%6 = alloca [21 x i8]
store i8** %0, i8*** %3
store i32 %1, i32* %4
%7 = call i32 (...) @lcd_clear()
store i32 0, i32* %5
br label %8
8: ; preds = %24, %2
%9 = load i32, i32* %5
%10 = load i32, i32* %4
%11 = icmp slt i32 %9, %10
br i1 %11, label %12, label %27
12: ; preds = %8
%13 = getelementptr inbounds [21 x i8], [21 x i8]* %6, i64 0, i64 0
%14 = load i8**, i8*** %3
%15 = load i32, i32* %5
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds i8*, i8** %14, i64 %16
%18 = load i8*, i8** %17
%19 = call i32 @snprintf(i8* %13, i32 21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %18)
%20 = load i32, i32* %5
%21 = call i32 @lcd_gotoxy(i32 0, i32 %20)
%22 = getelementptr inbounds [21 x i8], [21 x i8]* %6, i64 0, i64 0
%23 = call i32 @lcd_puts(i8* %22)
br label %24
24: ; preds = %12
%25 = load i32, i32* %5
%26 = add nsw i32 %25, 1
store i32 %26, i32* %5
br label %8
27: ; preds = %8
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%s\00"
define void @lcd_print_lines(i8** nocapture %0, i32 %1) {
%3 = alloca [21 x i8]
%4 = tail call i32 (...) @lcd_clear()
%5 = icmp sgt i32 %1, 0
br i1 %5, label %6, label %19
6: ; preds = %2
%7 = getelementptr inbounds [21 x i8], [21 x i8]* %3, i64 0, i64 0
%8 = zext i32 %1 to i64
br label %9
9: ; preds = %6, %9
%10 = phi i64 [ 0, %6 ], [ %17, %9 ]
%11 = getelementptr inbounds i8*, i8** %0, i64 %10
%12 = load i8*, i8** %11
%13 = call i32 @snprintf(i8* %7, i32 21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* %12)
%14 = trunc i64 %10 to i32
%15 = call i32 @lcd_gotoxy(i32 0, i32 %14)
%16 = call i32 @lcd_puts(i8* %7)
%17 = add nuw nsw i64 %10, 1
%18 = icmp eq i64 %17, %8
br i1 %18, label %19, label %9
19: ; preds = %9, %2
ret void
}