#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*/ gpio_write_value(int, int /*<<< orphan*/);
int /*<<< orphan*/ initialize_all_gpios();
int /*<<< orphan*/ lcd_init();
int /*<<< orphan*/ lcd_printf(char *);
int /*<<< orphan*/ lcd_send_command(int);
int /*<<< orphan*/ lcd_set_cursor(int, int);
int /*<<< orphan*/ print_ip_address();
int /*<<< orphan*/ print_time_and_date();
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ strncpy(char *, char *, int);
int /*<<< orphan*/ tansition_graphics();
int main(int argc, char *argv[]) {
  char msg_buf[16 * 2];
  printf("This Application prints your message on the 16x2 LCD\n");
  if (argc != 2) {
    printf("usage: %s <message>\n", argv[0]);
  } else {
    initialize_all_gpios();
    gpio_write_value(66, 0);
    gpio_write_value(67, 0);
    gpio_write_value(69, 0);
    gpio_write_value(68, 0);
    gpio_write_value(45, 0);
    gpio_write_value(44, 0);
    gpio_write_value(26, 0);
    lcd_init();
    lcd_send_command(0x01);
    lcd_set_cursor(1, 1);
    strncpy(msg_buf, argv[1], 32);
    while (1) {
      lcd_printf("BBB LCD Demo\n");
      tansition_graphics();
      print_ip_address();
      tansition_graphics();
      lcd_printf(msg_buf);
      tansition_graphics();
      print_time_and_date();
      tansition_graphics();
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe33(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
cmpl   $0x2,-0x8(%rbp)
je     11f8 <main+0x48>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1070 <printf@plt>
jmp    12ca <main+0x11a>
mov    $0x0,%al
call   10a0 <initialize_all_gpios@plt>
mov    $0x42,%edi
xor    %esi,%esi
call   10b0 <gpio_write_value@plt>
mov    $0x43,%edi
xor    %esi,%esi
call   10b0 <gpio_write_value@plt>
mov    $0x45,%edi
xor    %esi,%esi
call   10b0 <gpio_write_value@plt>
mov    $0x44,%edi
xor    %esi,%esi
call   10b0 <gpio_write_value@plt>
mov    $0x2d,%edi
xor    %esi,%esi
call   10b0 <gpio_write_value@plt>
mov    $0x2c,%edi
xor    %esi,%esi
call   10b0 <gpio_write_value@plt>
mov    $0x1a,%edi
xor    %esi,%esi
call   10b0 <gpio_write_value@plt>
mov    $0x0,%al
call   1080 <lcd_init@plt>
mov    $0x1,%edi
call   1060 <lcd_send_command@plt>
mov    $0x1,%esi
mov    %esi,%edi
call   10c0 <lcd_set_cursor@plt>
lea    -0x30(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
mov    $0x20,%edx
call   1040 <strncpy@plt>
lea    0xdbe(%rip),%rdi
call   1050 <lcd_printf@plt>
mov    $0x0,%al
call   1030 <tansition_graphics@plt>
mov    $0x0,%al
call   1090 <print_ip_address@plt>
mov    $0x0,%al
call   1030 <tansition_graphics@plt>
lea    -0x30(%rbp),%rdi
call   1050 <lcd_printf@plt>
mov    $0x0,%al
call   1030 <tansition_graphics@plt>
mov    $0x0,%al
call   10d0 <print_time_and_date@plt>
mov    $0x0,%al
call   1030 <tansition_graphics@plt>
jmp    1286 <main+0xd6>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x20,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
lea    0xe4f(%rip),%rdi
call   1060 <puts@plt>
cmp    $0x2,%ebp
jne    12bc <main+0xfc>
xor    %eax,%eax
call   10b0 <initialize_all_gpios@plt>
mov    $0x42,%edi
xor    %esi,%esi
call   10c0 <gpio_write_value@plt>
mov    $0x43,%edi
xor    %esi,%esi
call   10c0 <gpio_write_value@plt>
mov    $0x45,%edi
xor    %esi,%esi
call   10c0 <gpio_write_value@plt>
mov    $0x44,%edi
xor    %esi,%esi
call   10c0 <gpio_write_value@plt>
mov    $0x2d,%edi
xor    %esi,%esi
call   10c0 <gpio_write_value@plt>
mov    $0x2c,%edi
xor    %esi,%esi
call   10c0 <gpio_write_value@plt>
mov    $0x1a,%edi
xor    %esi,%esi
call   10c0 <gpio_write_value@plt>
xor    %eax,%eax
call   1090 <lcd_init@plt>
mov    $0x1,%edi
call   1070 <lcd_send_command@plt>
mov    $0x1,%edi
mov    $0x1,%esi
call   10d0 <lcd_set_cursor@plt>
mov    0x8(%rbx),%rsi
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x20,%edx
call   1040 <strncpy@plt>
lea    0xd9d(%rip),%rbx
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1050 <lcd_printf@plt>
xor    %eax,%eax
call   1030 <tansition_graphics@plt>
xor    %eax,%eax
call   10a0 <print_ip_address@plt>
xor    %eax,%eax
call   1030 <tansition_graphics@plt>
mov    %r14,%rdi
call   1050 <lcd_printf@plt>
xor    %eax,%eax
call   1030 <tansition_graphics@plt>
xor    %eax,%eax
call   10e0 <print_time_and_date@plt>
xor    %eax,%eax
call   1030 <tansition_graphics@plt>
jmp    1280 <main+0xc0>
mov    (%rbx),%rsi
lea    0xd3a(%rip),%rdi
xor    %eax,%eax
call   1080 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [54 x i8] c"This Application prints your message on the 16x2 LCD\0A\00"
@.str.1 = [21 x i8] c"usage: %s <message>\0A\00"
@.str.2 = [14 x i8] c"BBB LCD Demo\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [32 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 2
br i1 %9, label %10, label %15
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 0
%13 = load i8*, i8** %12
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %13)
br label %42
15: ; preds = %2
%16 = call i32 (...) @initialize_all_gpios()
%17 = call i32 @gpio_write_value(i32 66, i32 0)
%18 = call i32 @gpio_write_value(i32 67, i32 0)
%19 = call i32 @gpio_write_value(i32 69, i32 0)
%20 = call i32 @gpio_write_value(i32 68, i32 0)
%21 = call i32 @gpio_write_value(i32 45, i32 0)
%22 = call i32 @gpio_write_value(i32 44, i32 0)
%23 = call i32 @gpio_write_value(i32 26, i32 0)
%24 = call i32 (...) @lcd_init()
%25 = call i32 @lcd_send_command(i32 1)
%26 = call i32 @lcd_set_cursor(i32 1, i32 1)
%27 = getelementptr inbounds [32 x i8], [32 x i8]* %6, i64 0, i64 0
%28 = load i8**, i8*** %5
%29 = getelementptr inbounds i8*, i8** %28, i64 1
%30 = load i8*, i8** %29
%31 = call i32 @strncpy(i8* %27, i8* %30, i32 32)
br label %32
32: ; preds = %15, %32
%33 = call i32 @lcd_printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%34 = call i32 (...) @tansition_graphics()
%35 = call i32 (...) @print_ip_address()
%36 = call i32 (...) @tansition_graphics()
%37 = getelementptr inbounds [32 x i8], [32 x i8]* %6, i64 0, i64 0
%38 = call i32 @lcd_printf(i8* %37)
%39 = call i32 (...) @tansition_graphics()
%40 = call i32 (...) @print_time_and_date()
%41 = call i32 (...) @tansition_graphics()
br label %32
42: ; preds = %10
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [21 x i8] c"usage: %s <message>\0A\00"
@.str.2 = [14 x i8] c"BBB LCD Demo\0A\00"
@str = [53 x i8] c"This Application prints your message on the 16x2 LCD\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [32 x i8]
%4 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([53 x i8], [53 x i8]* @str, i64 0, i64 0))
%6 = icmp eq i32 %0, 2
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = load i8*, i8** %1
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0), i8* %8)
ret i32 0
10: ; preds = %2
%11 = tail call i32 (...) @initialize_all_gpios()
%12 = tail call i32 @gpio_write_value(i32 66, i32 0)
%13 = tail call i32 @gpio_write_value(i32 67, i32 0)
%14 = tail call i32 @gpio_write_value(i32 69, i32 0)
%15 = tail call i32 @gpio_write_value(i32 68, i32 0)
%16 = tail call i32 @gpio_write_value(i32 45, i32 0)
%17 = tail call i32 @gpio_write_value(i32 44, i32 0)
%18 = tail call i32 @gpio_write_value(i32 26, i32 0)
%19 = tail call i32 (...) @lcd_init()
%20 = tail call i32 @lcd_send_command(i32 1)
%21 = tail call i32 @lcd_set_cursor(i32 1, i32 1)
%22 = getelementptr inbounds i8*, i8** %1, i64 1
%23 = load i8*, i8** %22
%24 = call i32 @strncpy(i8* %4, i8* %23, i32 32)
br label %25
25: ; preds = %25, %10
%26 = call i32 @lcd_printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
%27 = call i32 (...) @tansition_graphics()
%28 = call i32 (...) @print_ip_address()
%29 = call i32 (...) @tansition_graphics()
%30 = call i32 @lcd_printf(i8* %4)
%31 = call i32 (...) @tansition_graphics()
%32 = call i32 (...) @print_time_and_date()
%33 = call i32 (...) @tansition_graphics()
br label %25
}