#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_clearColor(int);
int /*<<< orphan*/ LCD_drawString(char const *);
int /*<<< orphan*/ LCD_setBackground(int);
int /*<<< orphan*/ LCD_setForeground(int);
int /*<<< orphan*/ LCD_setTextPosition(int /*<<< orphan*/, int);
int /*<<< orphan*/ LCD_setTextSize(int);
int /*<<< orphan*/ LCD_setTextWrap(int);
CALC_throwError(const char *msg) {
  LCD_clearColor(0xF800);
  LCD_setTextPosition(0, 0);
  LCD_setForeground(0xFFFF);
  LCD_setBackground(0xF800);
  LCD_setTextSize(3);
  LCD_drawString("ERROR");
  LCD_setTextSize(1);
  LCD_setTextWrap(1);
  LCD_setTextPosition(0, 30);
  LCD_drawString(msg);
  while (1)
    ;
}


x86 assembly (clang, -O0):
<CALC_throwError>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0xf800,%edi
call   1080 <LCD_clearColor@plt>
xor    %esi,%esi
mov    %esi,%edi
call   1070 <LCD_setTextPosition@plt>
mov    $0xffff,%edi
call   1050 <LCD_setForeground@plt>
mov    $0xf800,%edi
call   1090 <LCD_setBackground@plt>
mov    $0x3,%edi
call   1030 <LCD_setTextSize@plt>
lea    0xe4c(%rip),%rdi
call   1060 <LCD_drawString@plt>
mov    $0x1,%edi
call   1030 <LCD_setTextSize@plt>
mov    $0x1,%edi
call   1040 <LCD_setTextWrap@plt>
xor    %edi,%edi
mov    $0x1e,%esi
call   1070 <LCD_setTextPosition@plt>
mov    -0x8(%rbp),%rdi
call   1060 <LCD_drawString@plt>
jmp    11e2 <CALC_throwError+0x72>

x86 assembly (clang, -O2):
<CALC_throwError>:
push   %rbx
mov    %rdi,%rbx
mov    $0xf800,%edi
call   1080 <LCD_clearColor@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1070 <LCD_setTextPosition@plt>
mov    $0xffff,%edi
call   1050 <LCD_setForeground@plt>
mov    $0xf800,%edi
call   1090 <LCD_setBackground@plt>
mov    $0x3,%edi
call   1030 <LCD_setTextSize@plt>
lea    0xe54(%rip),%rdi
call   1060 <LCD_drawString@plt>
mov    $0x1,%edi
call   1030 <LCD_setTextSize@plt>
mov    $0x1,%edi
call   1040 <LCD_setTextWrap@plt>
xor    %edi,%edi
mov    $0x1e,%esi
call   1070 <LCD_setTextPosition@plt>
mov    %rbx,%rdi
call   1060 <LCD_drawString@plt>
nopl   0x0(%rax)
jmp    11e0 <CALC_throwError+0x70>

LLVM IR (-O0):
@.str = [6 x i8] c"ERROR\00"
define i32 @CALC_throwError(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 @LCD_clearColor(i32 63488)
%4 = call i32 @LCD_setTextPosition(i32 0, i32 0)
%5 = call i32 @LCD_setForeground(i32 65535)
%6 = call i32 @LCD_setBackground(i32 63488)
%7 = call i32 @LCD_setTextSize(i32 3)
%8 = call i32 @LCD_drawString(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%9 = call i32 @LCD_setTextSize(i32 1)
%10 = call i32 @LCD_setTextWrap(i32 1)
%11 = call i32 @LCD_setTextPosition(i32 0, i32 30)
%12 = load i8*, i8** %2
%13 = call i32 @LCD_drawString(i8* %12)
br label %14
14: ; preds = %1, %14
br label %14
}

LLVM IR (-O2):
@.str = [6 x i8] c"ERROR\00"
define i32 @CALC_throwError(i8* %0) {
%2 = tail call i32 @LCD_clearColor(i32 63488)
%3 = tail call i32 @LCD_setTextPosition(i32 0, i32 0)
%4 = tail call i32 @LCD_setForeground(i32 65535)
%5 = tail call i32 @LCD_setBackground(i32 63488)
%6 = tail call i32 @LCD_setTextSize(i32 3)
%7 = tail call i32 @LCD_drawString(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%8 = tail call i32 @LCD_setTextSize(i32 1)
%9 = tail call i32 @LCD_setTextWrap(i32 1)
%10 = tail call i32 @LCD_setTextPosition(i32 0, i32 30)
%11 = tail call i32 @LCD_drawString(i8* %0)
br label %12
12: ; preds = %1, %12
br label %12
}