#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_Write_Char(unsigned char);
int /*<<< orphan*/ LCD_Write_String(char *);
void LCD_Write_Int1Dec(char v, long num, char pm) {
  if (num < 0) {
    LCD_Write_String("-");
    num *= -1;
  } else {
    if (pm == 1) {
      LCD_Write_String(" ");
    }
  }
  unsigned char number[10];
  unsigned char num_count = 0;
  do {
    number[num_count] = num % 10;
    num_count++;
    num /= 10;
  } while (num > 0);
  for (int i = v - 1; i >= 0; i--) {
    if (i == 0) {
      LCD_Write_Char('.');
    }
    if (num_count <= i) {
      LCD_Write_Char('0');
    } else {
      LCD_Write_Char(number[i] + 0b00110000);
    }
  }
}


x86 assembly (clang, -O0):
<LCD_Write_Int1Dec>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dl,%al
mov    %dil,%cl
mov    %cl,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %al,-0x11(%rbp)
cmpq   $0x0,-0x10(%rbp)
jge    115c <LCD_Write_Int1Dec+0x3c>
lea    0xeb7(%rip),%rdi
call   1040 <LCD_Write_String@plt>
imul   $0xffffffffffffffff,-0x10(%rbp),%rax
mov    %rax,-0x10(%rbp)
jmp    117a <LCD_Write_Int1Dec+0x5a>
movsbl -0x11(%rbp),%eax
cmp    $0x1,%eax
jne    1175 <LCD_Write_Int1Dec+0x55>
lea    0xe92(%rip),%rdi
call   1040 <LCD_Write_String@plt>
jmp    117a <LCD_Write_Int1Dec+0x5a>
movb   $0x0,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %dl,%cl
movzbl -0x1c(%rbp),%eax
mov    %cl,-0x1b(%rbp,%rax,1)
mov    -0x1c(%rbp),%al
add    $0x1,%al
mov    %al,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jg     117e <LCD_Write_Int1Dec+0x5e>
movsbl -0x1(%rbp),%eax
sub    $0x1,%eax
mov    %eax,-0x20(%rbp)
cmpl   $0x0,-0x20(%rbp)
jl     1226 <LCD_Write_Int1Dec+0x106>
cmpl   $0x0,-0x20(%rbp)
jne    11e3 <LCD_Write_Int1Dec+0xc3>
mov    $0x2e,%edi
call   1030 <LCD_Write_Char@plt>
movzbl -0x1c(%rbp),%eax
cmp    -0x20(%rbp),%eax
jg     11ff <LCD_Write_Int1Dec+0xdf>
mov    $0x30,%edi
call   1030 <LCD_Write_Char@plt>
jmp    1213 <LCD_Write_Int1Dec+0xf3>
movslq -0x20(%rbp),%rax
movzbl -0x1b(%rbp,%rax,1),%eax
add    $0x30,%eax
movzbl %al,%edi
call   1030 <LCD_Write_Char@plt>
jmp    1218 <LCD_Write_Int1Dec+0xf8>
mov    -0x20(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x20(%rbp)
jmp    11c5 <LCD_Write_Int1Dec+0xa5>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LCD_Write_Int1Dec>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
mov    %edi,%ebp
test   %rsi,%rsi
js     1145 <LCD_Write_Int1Dec+0x25>
cmp    $0x1,%dl
jne    1154 <LCD_Write_Int1Dec+0x34>
lea    0xec4(%rip),%rdi
call   1040 <LCD_Write_String@plt>
jmp    1154 <LCD_Write_Int1Dec+0x34>
lea    0xeb4(%rip),%rdi
call   1040 <LCD_Write_String@plt>
neg    %rbx
xor    %ecx,%ecx
movabs $0x6666666666666667,%rsi
66 66 66
mov    %rbx,%rax
imul   %rsi
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x2,%rdx
add    %rax,%rdx
lea    (%rdx,%rdx,1),%eax
lea    (%rax,%rax,4),%eax
mov    %ebx,%edi
sub    %eax,%edi
movzbl %cl,%ecx
mov    %dil,0x6(%rsp,%rcx,1)
add    $0x1,%cl
cmp    $0x9,%rbx
mov    %rdx,%rbx
jg     1160 <LCD_Write_Int1Dec+0x40>
test   %bpl,%bpl
jle    11e6 <LCD_Write_Int1Dec+0xc6>
movzbl %bpl,%ebx
movzbl %cl,%r14d
add    $0xffffffffffffffff,%rbx
jmp    11c2 <LCD_Write_Int1Dec+0xa2>
cs nopw 0x0(%rax,%rax,1)
nop
movzbl %al,%edi
call   1030 <LCD_Write_Char@plt>
add    $0xffffffffffffffff,%rbx
cmp    $0x1,%rbp
jbe    11e6 <LCD_Write_Int1Dec+0xc6>
lea    0x1(%rbx),%rbp
test   %ebx,%ebx
jne    11d4 <LCD_Write_Int1Dec+0xb4>
mov    $0x2e,%edi
call   1030 <LCD_Write_Char@plt>
mov    $0x30,%al
cmp    %r14,%rbp
ja     11b0 <LCD_Write_Int1Dec+0x90>
mov    %ebx,%eax
movzbl 0x6(%rsp,%rax,1),%eax
add    $0x30,%al
jmp    11b0 <LCD_Write_Int1Dec+0x90>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"-\00"
@.str.1 = [2 x i8] c" \00"
define void @LCD_Write_Int1Dec(i8 signext %0, i64 %1, i8 signext %2) {
%4 = alloca i8
%5 = alloca i64
%6 = alloca i8
%7 = alloca [10 x i8]
%8 = alloca i8
%9 = alloca i32
store i8 %0, i8* %4
store i64 %1, i64* %5
store i8 %2, i8* %6
%10 = load i64, i64* %5
%11 = icmp slt i64 %10, 0
br i1 %11, label %12, label %16
12: ; preds = %3
%13 = call i32 @LCD_Write_String(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%14 = load i64, i64* %5
%15 = mul nsw i64 %14, -1
store i64 %15, i64* %5
br label %23
16: ; preds = %3
%17 = load i8, i8* %6
%18 = sext i8 %17 to i32
%19 = icmp eq i32 %18, 1
br i1 %19, label %20, label %22
20: ; preds = %16
%21 = call i32 @LCD_Write_String(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %22
22: ; preds = %20, %16
br label %23
23: ; preds = %22, %12
store i8 0, i8* %8
br label %24
24: ; preds = %35, %23
%25 = load i64, i64* %5
%26 = srem i64 %25, 10
%27 = trunc i64 %26 to i8
%28 = load i8, i8* %8
%29 = zext i8 %28 to i64
%30 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 %29
store i8 %27, i8* %30
%31 = load i8, i8* %8
%32 = add i8 %31, 1
store i8 %32, i8* %8
%33 = load i64, i64* %5
%34 = sdiv i64 %33, 10
store i64 %34, i64* %5
br label %35
35: ; preds = %24
%36 = load i64, i64* %5
%37 = icmp sgt i64 %36, 0
br i1 %37, label %24, label %38
38: ; preds = %35
%39 = load i8, i8* %4
%40 = sext i8 %39 to i32
%41 = sub nsw i32 %40, 1
store i32 %41, i32* %9
br label %42
42: ; preds = %67, %38
%43 = load i32, i32* %9
%44 = icmp sge i32 %43, 0
br i1 %44, label %45, label %70
45: ; preds = %42
%46 = load i32, i32* %9
%47 = icmp eq i32 %46, 0
br i1 %47, label %48, label %50
48: ; preds = %45
%49 = call i32 @LCD_Write_Char(i8 zeroext 46)
br label %50
50: ; preds = %48, %45
%51 = load i8, i8* %8
%52 = zext i8 %51 to i32
%53 = load i32, i32* %9
%54 = icmp sle i32 %52, %53
br i1 %54, label %55, label %57
55: ; preds = %50
%56 = call i32 @LCD_Write_Char(i8 zeroext 48)
br label %66
57: ; preds = %50
%58 = load i32, i32* %9
%59 = sext i32 %58 to i64
%60 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 %59
%61 = load i8, i8* %60
%62 = zext i8 %61 to i32
%63 = add nsw i32 %62, 48
%64 = trunc i32 %63 to i8
%65 = call i32 @LCD_Write_Char(i8 zeroext %64)
br label %66
66: ; preds = %57, %55
br label %67
67: ; preds = %66
%68 = load i32, i32* %9
%69 = add nsw i32 %68, -1
store i32 %69, i32* %9
br label %42
70: ; preds = %42
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"-\00"
@.str.1 = [2 x i8] c" \00"
define void @LCD_Write_Int1Dec(i8 signext %0, i64 %1, i8 signext %2) {
%4 = alloca [10 x i8]
%5 = icmp slt i64 %1, 0
br i1 %5, label %6, label %9
6: ; preds = %3
%7 = tail call i32 @LCD_Write_String(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = sub nsw i64 0, %1
br label %13
9: ; preds = %3
%10 = icmp eq i8 %2, 1
br i1 %10, label %11, label %13
11: ; preds = %9
%12 = tail call i32 @LCD_Write_String(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
br label %13
13: ; preds = %9, %11, %6
%14 = phi i64 [ %8, %6 ], [ %1, %11 ], [ %1, %9 ]
%15 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
br label %16
16: ; preds = %16, %13
%17 = phi i64 [ %14, %13 ], [ %24, %16 ]
%18 = phi i8 [ 0, %13 ], [ %23, %16 ]
%19 = srem i64 %17, 10
%20 = trunc i64 %19 to i8
%21 = zext i8 %18 to i64
%22 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 %21
store i8 %20, i8* %22
%23 = add i8 %18, 1
%24 = sdiv i64 %17, 10
%25 = icmp sgt i64 %17, 9
br i1 %25, label %16, label %26
26: ; preds = %16
%27 = icmp sgt i8 %0, 0
br i1 %27, label %28, label %31
28: ; preds = %26
%29 = zext i8 %0 to i64
%30 = zext i8 %23 to i64
br label %32
31: ; preds = %46, %26
ret void
32: ; preds = %28, %46
%33 = phi i64 [ %29, %28 ], [ %34, %46 ]
%34 = add nsw i64 %33, -1
%35 = trunc i64 %34 to i32
%36 = icmp eq i32 %35, 0
br i1 %36, label %37, label %39
37: ; preds = %32
%38 = tail call i32 @LCD_Write_Char(i8 zeroext 46)
br label %39
39: ; preds = %37, %32
%40 = icmp ugt i64 %33, %30
br i1 %40, label %46, label %41
41: ; preds = %39
%42 = and i64 %34, 4294967295
%43 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 %42
%44 = load i8, i8* %43
%45 = add i8 %44, 48
br label %46
46: ; preds = %39, %41
%47 = phi i8 [ %45, %41 ], [ 48, %39 ]
%48 = tail call i32 @LCD_Write_Char(i8 zeroext %47)
%49 = icmp ugt i64 %33, 1
br i1 %49, label %32, label %31
}