#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_Goto(int, int);
int /*<<< orphan*/ LCD_WriteString(char *);
int /*<<< orphan*/ sprintf(char *, char *, int, int, int);
void ShowGrid(int grid[]) {
  char buff[80];
  LCD_Goto(6, 2);
  sprintf(buff, "%c|%c|%c", grid[0], grid[1], grid[2]);
  LCD_WriteString(buff);
  LCD_Goto(6, 3);
  sprintf(buff, "%c|%c|%c", grid[3], grid[4], grid[5]);
  LCD_WriteString(buff);
  LCD_Goto(6, 4);
  sprintf(buff, "%c|%c|%c", grid[6], grid[7], grid[8]);
  LCD_WriteString(buff);
}


x86 assembly (clang, -O0):
<ShowGrid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x6,%edi
mov    $0x2,%esi
call   1040 <LCD_Goto@plt>
lea    -0x60(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    (%rax),%edx
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%r8d
lea    0xe95(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x60(%rbp),%rdi
call   1030 <LCD_WriteString@plt>
mov    $0x6,%edi
mov    $0x3,%esi
call   1040 <LCD_Goto@plt>
lea    -0x60(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    0xc(%rax),%edx
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    0x14(%rax),%r8d
lea    0xe57(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x60(%rbp),%rdi
call   1030 <LCD_WriteString@plt>
mov    $0x6,%edi
mov    $0x4,%esi
call   1040 <LCD_Goto@plt>
lea    -0x60(%rbp),%rdi
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%edx
mov    -0x8(%rbp),%rax
mov    0x1c(%rax),%ecx
mov    -0x8(%rbp),%rax
mov    0x20(%rax),%r8d
lea    0xe19(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0x60(%rbp),%rdi
call   1030 <LCD_WriteString@plt>
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ShowGrid>:
push   %r15
push   %r14
push   %rbx
sub    $0x50,%rsp
mov    %rdi,%rbx
mov    $0x6,%edi
mov    $0x2,%esi
call   1040 <LCD_Goto@plt>
mov    (%rbx),%edx
mov    0x4(%rbx),%ecx
mov    0x8(%rbx),%r8d
lea    0xea5(%rip),%r15
mov    %rsp,%r14
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <sprintf@plt>
mov    %r14,%rdi
call   1030 <LCD_WriteString@plt>
mov    $0x6,%edi
mov    $0x3,%esi
call   1040 <LCD_Goto@plt>
mov    0xc(%rbx),%edx
mov    0x10(%rbx),%ecx
mov    0x14(%rbx),%r8d
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <sprintf@plt>
mov    %r14,%rdi
call   1030 <LCD_WriteString@plt>
mov    $0x6,%edi
mov    $0x4,%esi
call   1040 <LCD_Goto@plt>
mov    0x18(%rbx),%edx
mov    0x1c(%rbx),%ecx
mov    0x20(%rbx),%r8d
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <sprintf@plt>
mov    %r14,%rdi
call   1030 <LCD_WriteString@plt>
add    $0x50,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [9 x i8] c"%c|%c|%c\00"
define void @ShowGrid(i32* %0) {
%2 = alloca i32*
%3 = alloca [80 x i8]
store i32* %0, i32** %2
%4 = call i32 @LCD_Goto(i32 6, i32 2)
%5 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%6 = load i32*, i32** %2
%7 = getelementptr inbounds i32, i32* %6, i64 0
%8 = load i32, i32* %7
%9 = load i32*, i32** %2
%10 = getelementptr inbounds i32, i32* %9, i64 1
%11 = load i32, i32* %10
%12 = load i32*, i32** %2
%13 = getelementptr inbounds i32, i32* %12, i64 2
%14 = load i32, i32* %13
%15 = call i32 @sprintf(i8* %5, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %11, i32 %14)
%16 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%17 = call i32 @LCD_WriteString(i8* %16)
%18 = call i32 @LCD_Goto(i32 6, i32 3)
%19 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%20 = load i32*, i32** %2
%21 = getelementptr inbounds i32, i32* %20, i64 3
%22 = load i32, i32* %21
%23 = load i32*, i32** %2
%24 = getelementptr inbounds i32, i32* %23, i64 4
%25 = load i32, i32* %24
%26 = load i32*, i32** %2
%27 = getelementptr inbounds i32, i32* %26, i64 5
%28 = load i32, i32* %27
%29 = call i32 @sprintf(i8* %19, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %22, i32 %25, i32 %28)
%30 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%31 = call i32 @LCD_WriteString(i8* %30)
%32 = call i32 @LCD_Goto(i32 6, i32 4)
%33 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%34 = load i32*, i32** %2
%35 = getelementptr inbounds i32, i32* %34, i64 6
%36 = load i32, i32* %35
%37 = load i32*, i32** %2
%38 = getelementptr inbounds i32, i32* %37, i64 7
%39 = load i32, i32* %38
%40 = load i32*, i32** %2
%41 = getelementptr inbounds i32, i32* %40, i64 8
%42 = load i32, i32* %41
%43 = call i32 @sprintf(i8* %33, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %36, i32 %39, i32 %42)
%44 = getelementptr inbounds [80 x i8], [80 x i8]* %3, i64 0, i64 0
%45 = call i32 @LCD_WriteString(i8* %44)
ret void
}

LLVM IR (-O2):
@.str = [9 x i8] c"%c|%c|%c\00"
define void @ShowGrid(i32* nocapture %0) {
%2 = alloca [80 x i8]
%3 = getelementptr inbounds [80 x i8], [80 x i8]* %2, i64 0, i64 0
%4 = tail call i32 @LCD_Goto(i32 6, i32 2)
%5 = load i32, i32* %0
%6 = getelementptr inbounds i32, i32* %0, i64 1
%7 = load i32, i32* %6
%8 = getelementptr inbounds i32, i32* %0, i64 2
%9 = load i32, i32* %8
%10 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %5, i32 %7, i32 %9)
%11 = call i32 @LCD_WriteString(i8* %3)
%12 = call i32 @LCD_Goto(i32 6, i32 3)
%13 = getelementptr inbounds i32, i32* %0, i64 3
%14 = load i32, i32* %13
%15 = getelementptr inbounds i32, i32* %0, i64 4
%16 = load i32, i32* %15
%17 = getelementptr inbounds i32, i32* %0, i64 5
%18 = load i32, i32* %17
%19 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %14, i32 %16, i32 %18)
%20 = call i32 @LCD_WriteString(i8* %3)
%21 = call i32 @LCD_Goto(i32 6, i32 4)
%22 = getelementptr inbounds i32, i32* %0, i64 6
%23 = load i32, i32* %22
%24 = getelementptr inbounds i32, i32* %0, i64 7
%25 = load i32, i32* %24
%26 = getelementptr inbounds i32, i32* %0, i64 8
%27 = load i32, i32* %26
%28 = call i32 @sprintf(i8* %3, i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i32 %23, i32 %25, i32 %27)
%29 = call i32 @LCD_WriteString(i8* %3)
ret void
}