#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*/ lcdClear();
int /*<<< orphan*/ lcdSetPos(int /*<<< orphan*/, int);
int /*<<< orphan*/ lcdWriteStrC(char *);
double readDistance();
int /*<<< orphan*/ sprintf(char *, char *, double);
void showDistance(void) {
  char buffer[10];
  lcdClear();
  lcdSetPos(0, 0);
  lcdWriteStrC("Distance: [cm/uS]");
  lcdSetPos(0, 1);
  sprintf(buffer, "%3.3f", readDistance());
  lcdWriteStrC(buffer);
}


x86 assembly (clang, -O0):
<showDistance>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x0,%al
call   1070 <lcdClear@plt>
xor    %esi,%esi
mov    %esi,%edi
call   1030 <lcdSetPos@plt>
lea    0xe91(%rip),%rdi
call   1050 <lcdWriteStrC@plt>
xor    %edi,%edi
mov    $0x1,%esi
call   1030 <lcdSetPos@plt>
lea    -0xa(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    $0x0,%al
call   1040 <readDistance@plt>
mov    -0x18(%rbp),%rdi
lea    0xe78(%rip),%rsi
call   1060 <sprintf@plt>
lea    -0xa(%rbp),%rdi
call   1050 <lcdWriteStrC@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<showDistance>:
push   %rbx
sub    $0x10,%rsp
xor    %eax,%eax
call   1070 <lcdClear@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1030 <lcdSetPos@plt>
lea    0xe94(%rip),%rdi
call   1050 <lcdWriteStrC@plt>
xor    %edi,%edi
mov    $0x1,%esi
call   1030 <lcdSetPos@plt>
xor    %eax,%eax
call   1040 <readDistance@plt>
lea    0xe87(%rip),%rsi
lea    0x6(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <sprintf@plt>
mov    %rbx,%rdi
call   1050 <lcdWriteStrC@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"Distance: [cm/uS]\00"
@.str.1 = [6 x i8] c"%3.3f\00"
define void @showDistance() {
%1 = alloca [10 x i8]
%2 = call i32 (...) @lcdClear()
%3 = call i32 @lcdSetPos(i32 0, i32 0)
%4 = call i32 @lcdWriteStrC(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @lcdSetPos(i32 0, i32 1)
%6 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%7 = call double (...) @readDistance()
%8 = call i32 @sprintf(i8* %6, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %7)
%9 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%10 = call i32 @lcdWriteStrC(i8* %9)
ret void
}

LLVM IR (-O2):
@.str = [18 x i8] c"Distance: [cm/uS]\00"
@.str.1 = [6 x i8] c"%3.3f\00"
define void @showDistance() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%3 = tail call i32 (...) @lcdClear()
%4 = tail call i32 @lcdSetPos(i32 0, i32 0)
%5 = tail call i32 @lcdWriteStrC(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @lcdSetPos(i32 0, i32 1)
%7 = tail call double (...) @readDistance()
%8 = call i32 @sprintf(i8* %2, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), double %7)
%9 = call i32 @lcdWriteStrC(i8* %2)
ret void
}