#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_display(char *, int);
int /*<<< orphan*/ lcd_init();
int /*<<< orphan*/ printf(char *);
int lcd1602_main(int argc, const char *argv[]) {
  printf("lcd1602_main()\n");
  lcd_init();
  lcd_clear();
  lcd_display("hello 1", 1);
  lcd_display("hello 2", 2);
  lcd_display("hello 2", 3);
  lcd_display("hello 2", 4);
  return 0;
}


x86 assembly (clang, -O0):
<lcd1602_main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <lcd_init@plt>
mov    $0x0,%al
call   1060 <lcd_clear@plt>
lea    0xea0(%rip),%rdi
mov    $0x1,%esi
call   1040 <lcd_display@plt>
lea    0xe97(%rip),%rdi
mov    $0x2,%esi
call   1040 <lcd_display@plt>
lea    0xe86(%rip),%rdi
mov    $0x3,%esi
call   1040 <lcd_display@plt>
lea    0xe75(%rip),%rdi
mov    $0x4,%esi
call   1040 <lcd_display@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<lcd1602_main>:
push   %rbx
lea    0xec8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
call   1050 <lcd_init@plt>
xor    %eax,%eax
call   1060 <lcd_clear@plt>
lea    0xe9e(%rip),%rdi
mov    $0x1,%esi
call   1040 <lcd_display@plt>
lea    0xe95(%rip),%rbx
mov    %rbx,%rdi
mov    $0x2,%esi
call   1040 <lcd_display@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
call   1040 <lcd_display@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
call   1040 <lcd_display@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [16 x i8] c"lcd1602_main()\0A\00"
@.str.1 = [8 x i8] c"hello 1\00"
@.str.2 = [8 x i8] c"hello 2\00"
define i32 @lcd1602_main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
store i32 %0, i32* %3
store i8** %1, i8*** %4
%5 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
%6 = call i32 (...) @lcd_init()
%7 = call i32 (...) @lcd_clear()
%8 = call i32 @lcd_display(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 1)
%9 = call i32 @lcd_display(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 2)
%10 = call i32 @lcd_display(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 3)
%11 = call i32 @lcd_display(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 4)
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [8 x i8] c"hello 1\00"
@.str.2 = [8 x i8] c"hello 2\00"
@str = [15 x i8] c"lcd1602_main()\00"
define i32 @lcd1602_main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (...) @lcd_init()
%5 = tail call i32 (...) @lcd_clear()
%6 = tail call i32 @lcd_display(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i32 1)
%7 = tail call i32 @lcd_display(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 2)
%8 = tail call i32 @lcd_display(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 3)
%9 = tail call i32 @lcd_display(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0), i32 4)
ret i32 0
}