#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 */
struct ip_usbph {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ ip_usbph_flush(struct ip_usbph *);
int /*<<< orphan*/ ip_usbph_font_char(int);
int /*<<< orphan*/ ip_usbph_top_char(struct ip_usbph *, int,
                                     int /*<<< orphan*/);
int /*<<< orphan*/ sleep(int);
void top_char_test(struct ip_usbph *ph) {
  int i;
  for (i = 0; i < 8; i++) {
    ip_usbph_top_char(ph, i, ip_usbph_font_char(255));
  }
  ip_usbph_flush(ph);
  sleep(1);
  for (i = 0; i < 8; i++) {
    ip_usbph_top_char(ph, i, ip_usbph_font_char(i + 'A'));
  }
  ip_usbph_flush(ph);
}


x86 assembly (clang, -O0):
<top_char_test>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x8,-0xc(%rbp)
jge    1191 <top_char_test+0x51>
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    $0xff,%edi
call   1040 <ip_usbph_font_char@plt>
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    %eax,%edx
call   1050 <ip_usbph_top_char@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1153 <top_char_test+0x13>
mov    -0x8(%rbp),%rdi
call   1030 <ip_usbph_flush@plt>
mov    $0x1,%edi
call   1060 <sleep@plt>
movl   $0x0,-0xc(%rbp)
cmpl   $0x8,-0xc(%rbp)
jge    11ea <top_char_test+0xaa>
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%edi
add    $0x41,%edi
call   1040 <ip_usbph_font_char@plt>
mov    -0x28(%rbp),%rdi
mov    -0x1c(%rbp),%esi
mov    %eax,%edx
call   1050 <ip_usbph_top_char@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    11ab <top_char_test+0x6b>
mov    -0x8(%rbp),%rdi
call   1030 <ip_usbph_flush@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<top_char_test>:
push   %rbx
mov    %rdi,%rbx
mov    $0xff,%edi
call   1040 <ip_usbph_font_char@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %eax,%edx
call   1050 <ip_usbph_top_char@plt>
mov    $0xff,%edi
call   1040 <ip_usbph_font_char@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %eax,%edx
call   1050 <ip_usbph_top_char@plt>
mov    $0xff,%edi
call   1040 <ip_usbph_font_char@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    %eax,%edx
call   1050 <ip_usbph_top_char@plt>
mov    $0xff,%edi
call   1040 <ip_usbph_font_char@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    %eax,%edx
call   1050 <ip_usbph_top_char@plt>
mov    $0xff,%edi
call   1040 <ip_usbph_font_char@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
mov    %eax,%edx
call   1050 <ip_usbph_top_char@plt>
mov    $0xff,%edi
call   1040 <ip_usbph_font_char@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
mov    %eax,%edx
call   1050 <ip_usbph_top_char@plt>
mov    $0xff,%edi
call   1040 <ip_usbph_font_char@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
mov    %eax,%edx
call   1050 <ip_usbph_top_char@plt>
mov    $0xff,%edi
call   1040 <ip_usbph_font_char@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
mov    %eax,%edx
call   1050 <ip_usbph_top_char@plt>
mov    %rbx,%rdi
call   1030 <ip_usbph_flush@plt>
mov    $0x1,%edi
call   1060 <sleep@plt>
mov    $0x41,%edi
call   1040 <ip_usbph_font_char@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    %eax,%edx
call   1050 <ip_usbph_top_char@plt>
mov    $0x42,%edi
call   1040 <ip_usbph_font_char@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    %eax,%edx
call   1050 <ip_usbph_top_char@plt>
mov    $0x43,%edi
call   1040 <ip_usbph_font_char@plt>
mov    %rbx,%rdi
mov    $0x2,%esi
mov    %eax,%edx
call   1050 <ip_usbph_top_char@plt>
mov    $0x44,%edi
call   1040 <ip_usbph_font_char@plt>
mov    %rbx,%rdi
mov    $0x3,%esi
mov    %eax,%edx
call   1050 <ip_usbph_top_char@plt>
mov    $0x45,%edi
call   1040 <ip_usbph_font_char@plt>
mov    %rbx,%rdi
mov    $0x4,%esi
mov    %eax,%edx
call   1050 <ip_usbph_top_char@plt>
mov    $0x46,%edi
call   1040 <ip_usbph_font_char@plt>
mov    %rbx,%rdi
mov    $0x5,%esi
mov    %eax,%edx
call   1050 <ip_usbph_top_char@plt>
mov    $0x47,%edi
call   1040 <ip_usbph_font_char@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
mov    %eax,%edx
call   1050 <ip_usbph_top_char@plt>
mov    $0x48,%edi
call   1040 <ip_usbph_font_char@plt>
mov    %rbx,%rdi
mov    $0x7,%esi
mov    %eax,%edx
call   1050 <ip_usbph_top_char@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <ip_usbph_flush@plt>

LLVM IR (-O0):
%struct.ip_usbph = type { i32 }
define void @top_char_test(%struct.ip_usbph* %0) {
%2 = alloca %struct.ip_usbph*
%3 = alloca i32
store %struct.ip_usbph* %0, %struct.ip_usbph** %2
store i32 0, i32* %3
br label %4
4: ; preds = %12, %1
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 8
br i1 %6, label %7, label %15
7: ; preds = %4
%8 = load %struct.ip_usbph*, %struct.ip_usbph** %2
%9 = load i32, i32* %3
%10 = call i32 @ip_usbph_font_char(i32 255)
%11 = call i32 @ip_usbph_top_char(%struct.ip_usbph* %8, i32 %9, i32 %10)
br label %12
12: ; preds = %7
%13 = load i32, i32* %3
%14 = add nsw i32 %13, 1
store i32 %14, i32* %3
br label %4
15: ; preds = %4
%16 = load %struct.ip_usbph*, %struct.ip_usbph** %2
%17 = call i32 @ip_usbph_flush(%struct.ip_usbph* %16)
%18 = call i32 @sleep(i32 1)
store i32 0, i32* %3
br label %19
19: ; preds = %29, %15
%20 = load i32, i32* %3
%21 = icmp slt i32 %20, 8
br i1 %21, label %22, label %32
22: ; preds = %19
%23 = load %struct.ip_usbph*, %struct.ip_usbph** %2
%24 = load i32, i32* %3
%25 = load i32, i32* %3
%26 = add nsw i32 %25, 65
%27 = call i32 @ip_usbph_font_char(i32 %26)
%28 = call i32 @ip_usbph_top_char(%struct.ip_usbph* %23, i32 %24, i32 %27)
br label %29
29: ; preds = %22
%30 = load i32, i32* %3
%31 = add nsw i32 %30, 1
store i32 %31, i32* %3
br label %19
32: ; preds = %19
%33 = load %struct.ip_usbph*, %struct.ip_usbph** %2
%34 = call i32 @ip_usbph_flush(%struct.ip_usbph* %33)
ret void
}

LLVM IR (-O2):
%struct.ip_usbph = type { i32 }
define void @top_char_test(%struct.ip_usbph* %0) {
%2 = tail call i32 @ip_usbph_font_char(i32 255)
%3 = tail call i32 @ip_usbph_top_char(%struct.ip_usbph* %0, i32 0, i32 %2)
%4 = tail call i32 @ip_usbph_font_char(i32 255)
%5 = tail call i32 @ip_usbph_top_char(%struct.ip_usbph* %0, i32 1, i32 %4)
%6 = tail call i32 @ip_usbph_font_char(i32 255)
%7 = tail call i32 @ip_usbph_top_char(%struct.ip_usbph* %0, i32 2, i32 %6)
%8 = tail call i32 @ip_usbph_font_char(i32 255)
%9 = tail call i32 @ip_usbph_top_char(%struct.ip_usbph* %0, i32 3, i32 %8)
%10 = tail call i32 @ip_usbph_font_char(i32 255)
%11 = tail call i32 @ip_usbph_top_char(%struct.ip_usbph* %0, i32 4, i32 %10)
%12 = tail call i32 @ip_usbph_font_char(i32 255)
%13 = tail call i32 @ip_usbph_top_char(%struct.ip_usbph* %0, i32 5, i32 %12)
%14 = tail call i32 @ip_usbph_font_char(i32 255)
%15 = tail call i32 @ip_usbph_top_char(%struct.ip_usbph* %0, i32 6, i32 %14)
%16 = tail call i32 @ip_usbph_font_char(i32 255)
%17 = tail call i32 @ip_usbph_top_char(%struct.ip_usbph* %0, i32 7, i32 %16)
%18 = tail call i32 @ip_usbph_flush(%struct.ip_usbph* %0)
%19 = tail call i32 @sleep(i32 1)
%20 = tail call i32 @ip_usbph_font_char(i32 65)
%21 = tail call i32 @ip_usbph_top_char(%struct.ip_usbph* %0, i32 0, i32 %20)
%22 = tail call i32 @ip_usbph_font_char(i32 66)
%23 = tail call i32 @ip_usbph_top_char(%struct.ip_usbph* %0, i32 1, i32 %22)
%24 = tail call i32 @ip_usbph_font_char(i32 67)
%25 = tail call i32 @ip_usbph_top_char(%struct.ip_usbph* %0, i32 2, i32 %24)
%26 = tail call i32 @ip_usbph_font_char(i32 68)
%27 = tail call i32 @ip_usbph_top_char(%struct.ip_usbph* %0, i32 3, i32 %26)
%28 = tail call i32 @ip_usbph_font_char(i32 69)
%29 = tail call i32 @ip_usbph_top_char(%struct.ip_usbph* %0, i32 4, i32 %28)
%30 = tail call i32 @ip_usbph_font_char(i32 70)
%31 = tail call i32 @ip_usbph_top_char(%struct.ip_usbph* %0, i32 5, i32 %30)
%32 = tail call i32 @ip_usbph_font_char(i32 71)
%33 = tail call i32 @ip_usbph_top_char(%struct.ip_usbph* %0, i32 6, i32 %32)
%34 = tail call i32 @ip_usbph_font_char(i32 72)
%35 = tail call i32 @ip_usbph_top_char(%struct.ip_usbph* %0, i32 7, i32 %34)
%36 = tail call i32 @ip_usbph_flush(%struct.ip_usbph* %0)
ret void
}