#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*/ _sys_printk(char *);
int /*<<< orphan*/ enable_8259A_IRQ(int);
int /*<<< orphan*/ outb(int, int);
void _sys_init_8259A(void) {
  _sys_printk("PIC Setting...");
  outb(0x20, 0x11);
  outb(0x21, 0x20 + 0);
  outb(0x21, 0x04);
  outb(0x21, 0x01);
  outb(0xA0, 0x11);
  outb(0xA1, 0x20 + 8);
  outb(0xA1, 0x02);
  outb(0xA1, 0x01);
  outb(0x21, 0xFF);
  outb(0xA1, 0xFF);
  enable_8259A_IRQ(1);
  enable_8259A_IRQ(2);
  enable_8259A_IRQ(6);
  enable_8259A_IRQ(14);
  enable_8259A_IRQ(15);
  enable_8259A_IRQ(8);
  _sys_printk("Done\n");
}


x86 assembly (clang, -O0):
<_sys_init_8259A>:
push   %rbp
mov    %rsp,%rbp
lea    0xec5(%rip),%rdi
call   1050 <_sys_printk@plt>
mov    $0x20,%edi
mov    $0x11,%esi
call   1040 <outb@plt>
mov    $0x21,%edi
mov    $0x20,%esi
call   1040 <outb@plt>
mov    $0x21,%edi
mov    $0x4,%esi
call   1040 <outb@plt>
mov    $0x21,%edi
mov    $0x1,%esi
call   1040 <outb@plt>
mov    $0xa0,%edi
mov    $0x11,%esi
call   1040 <outb@plt>
mov    $0xa1,%edi
mov    $0x28,%esi
call   1040 <outb@plt>
mov    $0xa1,%edi
mov    $0x2,%esi
call   1040 <outb@plt>
mov    $0xa1,%edi
mov    $0x1,%esi
call   1040 <outb@plt>
mov    $0x21,%edi
mov    $0xff,%esi
call   1040 <outb@plt>
mov    $0xa1,%edi
mov    $0xff,%esi
call   1040 <outb@plt>
mov    $0x1,%edi
call   1030 <enable_8259A_IRQ@plt>
mov    $0x2,%edi
call   1030 <enable_8259A_IRQ@plt>
mov    $0x6,%edi
call   1030 <enable_8259A_IRQ@plt>
mov    $0xe,%edi
call   1030 <enable_8259A_IRQ@plt>
mov    $0xf,%edi
call   1030 <enable_8259A_IRQ@plt>
mov    $0x8,%edi
call   1030 <enable_8259A_IRQ@plt>
lea    0xdf6(%rip),%rdi
call   1050 <_sys_printk@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<_sys_init_8259A>:
push   %rax
lea    0xec8(%rip),%rdi
call   1050 <_sys_printk@plt>
mov    $0x20,%edi
mov    $0x11,%esi
call   1040 <outb@plt>
mov    $0x21,%edi
mov    $0x20,%esi
call   1040 <outb@plt>
mov    $0x21,%edi
mov    $0x4,%esi
call   1040 <outb@plt>
mov    $0x21,%edi
mov    $0x1,%esi
call   1040 <outb@plt>
mov    $0xa0,%edi
mov    $0x11,%esi
call   1040 <outb@plt>
mov    $0xa1,%edi
mov    $0x28,%esi
call   1040 <outb@plt>
mov    $0xa1,%edi
mov    $0x2,%esi
call   1040 <outb@plt>
mov    $0xa1,%edi
mov    $0x1,%esi
call   1040 <outb@plt>
mov    $0x21,%edi
mov    $0xff,%esi
call   1040 <outb@plt>
mov    $0xa1,%edi
mov    $0xff,%esi
call   1040 <outb@plt>
mov    $0x1,%edi
call   1030 <enable_8259A_IRQ@plt>
mov    $0x2,%edi
call   1030 <enable_8259A_IRQ@plt>
mov    $0x6,%edi
call   1030 <enable_8259A_IRQ@plt>
mov    $0xe,%edi
call   1030 <enable_8259A_IRQ@plt>
mov    $0xf,%edi
call   1030 <enable_8259A_IRQ@plt>
mov    $0x8,%edi
call   1030 <enable_8259A_IRQ@plt>
lea    0xdf9(%rip),%rdi
pop    %rax
jmp    1050 <_sys_printk@plt>

LLVM IR (-O0):
@.str = [15 x i8] c"PIC Setting...\00"
@.str.1 = [6 x i8] c"Done\0A\00"
define void @_sys_init_8259A() {
%1 = call i32 @_sys_printk(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @outb(i32 32, i32 17)
%3 = call i32 @outb(i32 33, i32 32)
%4 = call i32 @outb(i32 33, i32 4)
%5 = call i32 @outb(i32 33, i32 1)
%6 = call i32 @outb(i32 160, i32 17)
%7 = call i32 @outb(i32 161, i32 40)
%8 = call i32 @outb(i32 161, i32 2)
%9 = call i32 @outb(i32 161, i32 1)
%10 = call i32 @outb(i32 33, i32 255)
%11 = call i32 @outb(i32 161, i32 255)
%12 = call i32 @enable_8259A_IRQ(i32 1)
%13 = call i32 @enable_8259A_IRQ(i32 2)
%14 = call i32 @enable_8259A_IRQ(i32 6)
%15 = call i32 @enable_8259A_IRQ(i32 14)
%16 = call i32 @enable_8259A_IRQ(i32 15)
%17 = call i32 @enable_8259A_IRQ(i32 8)
%18 = call i32 @_sys_printk(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [15 x i8] c"PIC Setting...\00"
@.str.1 = [6 x i8] c"Done\0A\00"
define void @_sys_init_8259A() {
%1 = tail call i32 @_sys_printk(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @outb(i32 32, i32 17)
%3 = tail call i32 @outb(i32 33, i32 32)
%4 = tail call i32 @outb(i32 33, i32 4)
%5 = tail call i32 @outb(i32 33, i32 1)
%6 = tail call i32 @outb(i32 160, i32 17)
%7 = tail call i32 @outb(i32 161, i32 40)
%8 = tail call i32 @outb(i32 161, i32 2)
%9 = tail call i32 @outb(i32 161, i32 1)
%10 = tail call i32 @outb(i32 33, i32 255)
%11 = tail call i32 @outb(i32 161, i32 255)
%12 = tail call i32 @enable_8259A_IRQ(i32 1)
%13 = tail call i32 @enable_8259A_IRQ(i32 2)
%14 = tail call i32 @enable_8259A_IRQ(i32 6)
%15 = tail call i32 @enable_8259A_IRQ(i32 14)
%16 = tail call i32 @enable_8259A_IRQ(i32 15)
%17 = tail call i32 @enable_8259A_IRQ(i32 8)
%18 = tail call i32 @_sys_printk(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0))
ret void
}