#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*/ acpi_add_byte(char **, int);
int acpi_add_Interrupt(char **data, int dlen, int irq, int consumer, int mode,
                       int polarity, int sharing) {
  if (dlen >= 9) {
    acpi_add_byte(data, 0x89);
    acpi_add_byte(data, 6);
    acpi_add_byte(data, 0);
    acpi_add_byte(data,
                  (consumer | (mode << 1) | (polarity << 2) | (sharing << 3)));
    acpi_add_byte(data, 1);
    acpi_add_byte(data, irq);
    acpi_add_byte(data, 0);
    acpi_add_byte(data, 0);
    acpi_add_byte(data, 0);
  }
  return 9;
}


x86 assembly (clang, -O0):
<acpi_add_Interrupt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0x10(%rbp),%eax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    %ecx,-0x14(%rbp)
mov    %r8d,-0x18(%rbp)
mov    %r9d,-0x1c(%rbp)
cmpl   $0x9,-0xc(%rbp)
jl     11c0 <acpi_add_Interrupt+0xb0>
mov    -0x8(%rbp),%rdi
mov    $0x89,%esi
call   1030 <acpi_add_byte@plt>
mov    -0x8(%rbp),%rdi
mov    $0x6,%esi
call   1030 <acpi_add_byte@plt>
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1030 <acpi_add_byte@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%eax
shl    $0x1,%eax
or     %eax,%esi
mov    -0x1c(%rbp),%eax
shl    $0x2,%eax
or     %eax,%esi
mov    0x10(%rbp),%eax
shl    $0x3,%eax
or     %eax,%esi
call   1030 <acpi_add_byte@plt>
mov    -0x8(%rbp),%rdi
mov    $0x1,%esi
call   1030 <acpi_add_byte@plt>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
call   1030 <acpi_add_byte@plt>
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1030 <acpi_add_byte@plt>
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1030 <acpi_add_byte@plt>
mov    -0x8(%rbp),%rdi
xor    %esi,%esi
call   1030 <acpi_add_byte@plt>
mov    $0x9,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<acpi_add_Interrupt>:
cmp    $0x9,%esi
jl     11bb <acpi_add_Interrupt+0xab>
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %r9d,%r15d
mov    %r8d,%ebp
mov    %ecx,%r13d
mov    %edx,%r14d
mov    %rdi,%rbx
mov    0x40(%rsp),%r12d
mov    $0x89,%esi
call   1030 <acpi_add_byte@plt>
mov    %rbx,%rdi
mov    $0x6,%esi
call   1030 <acpi_add_byte@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <acpi_add_byte@plt>
add    %ebp,%ebp
or     %r13d,%ebp
shl    $0x2,%r15d
or     %ebp,%r15d
shl    $0x3,%r12d
or     %r15d,%r12d
mov    %rbx,%rdi
mov    %r12d,%esi
call   1030 <acpi_add_byte@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
call   1030 <acpi_add_byte@plt>
mov    %rbx,%rdi
mov    %r14d,%esi
call   1030 <acpi_add_byte@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <acpi_add_byte@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <acpi_add_byte@plt>
mov    %rbx,%rdi
xor    %esi,%esi
call   1030 <acpi_add_byte@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
mov    $0x9,%eax
ret

LLVM IR (-O0):
define i32 @acpi_add_Interrupt(i8** %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = alloca i8**
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32
store i8** %0, i8*** %8
store i32 %1, i32* %9
store i32 %2, i32* %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i32 %5, i32* %13
store i32 %6, i32* %14
%15 = load i32, i32* %9
%16 = icmp sge i32 %15, 9
br i1 %16, label %17, label %47
17: ; preds = %7
%18 = load i8**, i8*** %8
%19 = call i32 @acpi_add_byte(i8** %18, i32 137)
%20 = load i8**, i8*** %8
%21 = call i32 @acpi_add_byte(i8** %20, i32 6)
%22 = load i8**, i8*** %8
%23 = call i32 @acpi_add_byte(i8** %22, i32 0)
%24 = load i8**, i8*** %8
%25 = load i32, i32* %11
%26 = load i32, i32* %12
%27 = shl i32 %26, 1
%28 = or i32 %25, %27
%29 = load i32, i32* %13
%30 = shl i32 %29, 2
%31 = or i32 %28, %30
%32 = load i32, i32* %14
%33 = shl i32 %32, 3
%34 = or i32 %31, %33
%35 = call i32 @acpi_add_byte(i8** %24, i32 %34)
%36 = load i8**, i8*** %8
%37 = call i32 @acpi_add_byte(i8** %36, i32 1)
%38 = load i8**, i8*** %8
%39 = load i32, i32* %10
%40 = call i32 @acpi_add_byte(i8** %38, i32 %39)
%41 = load i8**, i8*** %8
%42 = call i32 @acpi_add_byte(i8** %41, i32 0)
%43 = load i8**, i8*** %8
%44 = call i32 @acpi_add_byte(i8** %43, i32 0)
%45 = load i8**, i8*** %8
%46 = call i32 @acpi_add_byte(i8** %45, i32 0)
br label %47
47: ; preds = %17, %7
ret i32 9
}

LLVM IR (-O2):
define i32 @acpi_add_Interrupt(i8** %0, i32 %1, i32 %2, i32 %3, i32 %4, i32 %5, i32 %6) {
%8 = icmp sgt i32 %1, 8
br i1 %8, label %9, label %25
9: ; preds = %7
%10 = tail call i32 @acpi_add_byte(i8** %0, i32 137)
%11 = tail call i32 @acpi_add_byte(i8** %0, i32 6)
%12 = tail call i32 @acpi_add_byte(i8** %0, i32 0)
%13 = shl i32 %4, 1
%14 = or i32 %13, %3
%15 = shl i32 %5, 2
%16 = or i32 %14, %15
%17 = shl i32 %6, 3
%18 = or i32 %16, %17
%19 = tail call i32 @acpi_add_byte(i8** %0, i32 %18)
%20 = tail call i32 @acpi_add_byte(i8** %0, i32 1)
%21 = tail call i32 @acpi_add_byte(i8** %0, i32 %2)
%22 = tail call i32 @acpi_add_byte(i8** %0, i32 0)
%23 = tail call i32 @acpi_add_byte(i8** %0, i32 0)
%24 = tail call i32 @acpi_add_byte(i8** %0, i32 0)
br label %25
25: ; preds = %9, %7
ret i32 9
}