#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*/ clearbottom();
int /*<<< orphan*/ cls();
int /*<<< orphan*/ port254(unsigned short);
void set_ext(unsigned short id) {
  if (id < 8) {
    port254(id);
  }
  if (id == 8) {
    cls();
    clearbottom();
  }
  if (id == 9) {
    cls();
  }
  if (id == 10) {
    clearbottom();
  }
}


x86 assembly (clang, -O0):
<set_ext>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
movzwl -0x2(%rbp),%eax
cmp    $0x8,%eax
jge    1155 <set_ext+0x25>
movzwl -0x2(%rbp),%edi
call   1030 <port254@plt>
movzwl -0x2(%rbp),%eax
cmp    $0x8,%eax
jne    1170 <set_ext+0x40>
mov    $0x0,%al
call   1050 <cls@plt>
mov    $0x0,%al
call   1040 <clearbottom@plt>
movzwl -0x2(%rbp),%eax
cmp    $0x9,%eax
jne    1184 <set_ext+0x54>
mov    $0x0,%al
call   1050 <cls@plt>
movzwl -0x2(%rbp),%eax
cmp    $0xa,%eax
jne    1198 <set_ext+0x68>
mov    $0x0,%al
call   1040 <clearbottom@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<set_ext>:
push   %rbx
mov    %edi,%ebx
cmp    $0x7,%bx
ja     1141 <set_ext+0x11>
movzwl %bx,%edi
call   1030 <port254@plt>
cmp    $0xa,%bx
je     115a <set_ext+0x2a>
cmp    $0x9,%bx
je     1162 <set_ext+0x32>
cmp    $0x8,%bx
jne    116a <set_ext+0x3a>
xor    %eax,%eax
call   1050 <cls@plt>
xor    %eax,%eax
pop    %rbx
jmp    1040 <clearbottom@plt>
xor    %eax,%eax
pop    %rbx
jmp    1050 <cls@plt>
pop    %rbx
ret

LLVM IR (-O0):
define void @set_ext(i16 zeroext %0) {
%2 = alloca i16
store i16 %0, i16* %2
%3 = load i16, i16* %2
%4 = zext i16 %3 to i32
%5 = icmp slt i32 %4, 8
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load i16, i16* %2
%8 = call i32 @port254(i16 zeroext %7)
br label %9
9: ; preds = %6, %1
%10 = load i16, i16* %2
%11 = zext i16 %10 to i32
%12 = icmp eq i32 %11, 8
br i1 %12, label %13, label %16
13: ; preds = %9
%14 = call i32 (...) @cls()
%15 = call i32 (...) @clearbottom()
br label %16
16: ; preds = %13, %9
%17 = load i16, i16* %2
%18 = zext i16 %17 to i32
%19 = icmp eq i32 %18, 9
br i1 %19, label %20, label %22
20: ; preds = %16
%21 = call i32 (...) @cls()
br label %22
22: ; preds = %20, %16
%23 = load i16, i16* %2
%24 = zext i16 %23 to i32
%25 = icmp eq i32 %24, 10
br i1 %25, label %26, label %28
26: ; preds = %22
%27 = call i32 (...) @clearbottom()
br label %28
28: ; preds = %26, %22
ret void
}

LLVM IR (-O2):
define void @set_ext(i16 zeroext %0) {
%2 = icmp ult i16 %0, 8
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call i32 @port254(i16 zeroext %0)
br label %5
5: ; preds = %3, %1
switch i16 %0, label %13 [
i16 8, label %6
i16 9, label %9
i16 10, label %11
]
6: ; preds = %5
%7 = tail call i32 (...) @cls()
%8 = tail call i32 (...) @clearbottom()
br label %13
9: ; preds = %5
%10 = tail call i32 (...) @cls()
br label %13
11: ; preds = %5
%12 = tail call i32 (...) @clearbottom()
br label %13
13: ; preds = %9, %6, %5, %11
ret void
}