#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*/ Display();
int /*<<< orphan*/ oled_write(unsigned char);
int /*<<< orphan*/ println();
int /*<<< orphan*/ setCursor(int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ setTextColor(int);
int /*<<< orphan*/ setTextSize(int);
int /*<<< orphan*/ usleep(int);
void testdrawchar() {
  unsigned char i = 0;
  setTextSize(1);
  setTextColor(1);
  setCursor(0, 0);
  for (i = 0; i < 168; i++) {
    if (i == '\n')
      continue;
    oled_write(i);
    if ((i > 0) && (i % 21 == 0))
      println();
  }
  Display();
  usleep(1000);
}


x86 assembly (clang, -O0):
<testdrawchar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movb   $0x0,-0x1(%rbp)
mov    $0x1,%edi
call   1070 <setTextSize@plt>
mov    $0x1,%edi
call   1030 <setTextColor@plt>
xor    %esi,%esi
mov    %esi,%edi
call   1050 <setCursor@plt>
movb   $0x0,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
cmp    $0xa8,%eax
jge    1202 <testdrawchar+0x92>
movzbl -0x1(%rbp),%eax
cmp    $0xa,%eax
jne    11be <testdrawchar+0x4e>
jmp    11f5 <testdrawchar+0x85>
movzbl -0x1(%rbp),%edi
call   1040 <oled_write@plt>
movzbl -0x1(%rbp),%eax
cmp    $0x0,%eax
jle    11f0 <testdrawchar+0x80>
movzbl -0x1(%rbp),%eax
mov    $0x15,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    11f0 <testdrawchar+0x80>
mov    $0x0,%al
call   1060 <println@plt>
jmp    11f5 <testdrawchar+0x85>
mov    -0x1(%rbp),%al
add    $0x1,%al
mov    %al,-0x1(%rbp)
jmp    119d <testdrawchar+0x2d>
mov    $0x0,%al
call   1080 <Display@plt>
mov    $0x3e8,%edi
call   1090 <usleep@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<testdrawchar>:
push   %rbp
push   %rbx
push   %rax
mov    $0x1,%edi
call   1070 <setTextSize@plt>
mov    $0x1,%edi
call   1030 <setTextColor@plt>
xor    %edi,%edi
xor    %esi,%esi
call   1050 <setCursor@plt>
xor    %ebp,%ebp
jmp    11aa <testdrawchar+0x3a>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
add    $0x1,%bpl
cmp    $0xa8,%bpl
je     11e9 <testdrawchar+0x79>
cmp    $0xa,%bpl
je     11a0 <testdrawchar+0x30>
movzbl %bpl,%ebx
mov    %ebx,%edi
call   1040 <oled_write@plt>
test   %bpl,%bpl
je     11a0 <testdrawchar+0x30>
imul   $0x87,%ebx,%eax
shr    $0x8,%eax
sub    %al,%bl
shr    %bl
add    %al,%bl
shr    $0x4,%bl
movzbl %bl,%eax
lea    (%rax,%rax,4),%ecx
lea    (%rax,%rcx,4),%eax
cmp    %bpl,%al
jne    11a0 <testdrawchar+0x30>
xor    %eax,%eax
call   1060 <println@plt>
jmp    11a0 <testdrawchar+0x30>
xor    %eax,%eax
call   1080 <Display@plt>
mov    $0x3e8,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1090 <usleep@plt>

LLVM IR (-O0):
define void @testdrawchar() {
%1 = alloca i8
store i8 0, i8* %1
%2 = call i32 @setTextSize(i32 1)
%3 = call i32 @setTextColor(i32 1)
%4 = call i32 @setCursor(i32 0, i32 0)
store i8 0, i8* %1
br label %5
5: ; preds = %28, %0
%6 = load i8, i8* %1
%7 = zext i8 %6 to i32
%8 = icmp slt i32 %7, 168
br i1 %8, label %9, label %31
9: ; preds = %5
%10 = load i8, i8* %1
%11 = zext i8 %10 to i32
%12 = icmp eq i32 %11, 10
br i1 %12, label %13, label %14
13: ; preds = %9
br label %28
14: ; preds = %9
%15 = load i8, i8* %1
%16 = call i32 @oled_write(i8 zeroext %15)
%17 = load i8, i8* %1
%18 = zext i8 %17 to i32
%19 = icmp sgt i32 %18, 0
br i1 %19, label %20, label %27
20: ; preds = %14
%21 = load i8, i8* %1
%22 = zext i8 %21 to i32
%23 = srem i32 %22, 21
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %20
%26 = call i32 (...) @println()
br label %27
27: ; preds = %25, %20, %14
br label %28
28: ; preds = %27, %13
%29 = load i8, i8* %1
%30 = add i8 %29, 1
store i8 %30, i8* %1
br label %5
31: ; preds = %5
%32 = call i32 (...) @Display()
%33 = call i32 @usleep(i32 1000)
ret void
}

LLVM IR (-O2):
define void @testdrawchar() {
%1 = tail call i32 @setTextSize(i32 1)
%2 = tail call i32 @setTextColor(i32 1)
%3 = tail call i32 @setCursor(i32 0, i32 0)
br label %4
4: ; preds = %0, %15
%5 = phi i8 [ 0, %0 ], [ %16, %15 ]
%6 = icmp eq i8 %5, 10
br i1 %6, label %15, label %7
7: ; preds = %4
%8 = tail call i32 @oled_write(i8 zeroext %5)
%9 = icmp ne i8 %5, 0
%10 = urem i8 %5, 21
%11 = icmp eq i8 %10, 0
%12 = and i1 %9, %11
br i1 %12, label %13, label %15
13: ; preds = %7
%14 = tail call i32 (...) @println()
br label %15
15: ; preds = %7, %13, %4
%16 = add nuw i8 %5, 1
%17 = icmp eq i8 %16, -88
br i1 %17, label %18, label %4
18: ; preds = %15
%19 = tail call i32 (...) @Display()
%20 = tail call i32 @usleep(i32 1000)
ret void
}