#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*/ outl_p(unsigned int, int);
void extended_pci_write(int bus, int device, int func, int offset,
                        unsigned int value) {
  unsigned int tmp;
  tmp = 0x80000000 | ((offset & 0xf00) << 16) | ((bus & 0xff) << 16) |
        ((device & 0x1f) << 11) | ((func & 0x7) << 0x8) | (offset & 0xfc);
  outl_p(tmp, 0xcf8);
  outl_p(value, 0xcfc);
}


x86 assembly (clang, -O0):
<extended_pci_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8d,-0x14(%rbp)
mov    -0x10(%rbp),%eax
and    $0xf00,%eax
shl    $0x10,%eax
or     $0x80000000,%eax
mov    -0x4(%rbp),%ecx
and    $0xff,%ecx
shl    $0x10,%ecx
or     %ecx,%eax
mov    -0x8(%rbp),%ecx
and    $0x1f,%ecx
shl    $0xb,%ecx
or     %ecx,%eax
mov    -0xc(%rbp),%ecx
and    $0x7,%ecx
shl    $0x8,%ecx
or     %ecx,%eax
mov    -0x10(%rbp),%ecx
and    $0xfc,%ecx
or     %ecx,%eax
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%edi
mov    $0xcf8,%esi
call   1030 <outl_p@plt>
mov    -0x14(%rbp),%edi
mov    $0xcfc,%esi
call   1030 <outl_p@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<extended_pci_write>:
push   %rbx
mov    %r8d,%ebx
mov    %ecx,%eax
shl    $0x10,%eax
and    $0xf000000,%eax
movzbl %dil,%edi
shl    $0x10,%edi
shl    $0xb,%esi
movzwl %si,%esi
or     %edi,%esi
and    $0x7,%edx
shl    $0x8,%edx
or     %esi,%edx
and    $0xfc,%ecx
or     %edx,%ecx
lea    (%rax,%rcx,1),%edi
add    $0x80000000,%edi
mov    $0xcf8,%esi
call   1030 <outl_p@plt>
mov    %ebx,%edi
mov    $0xcfc,%esi
pop    %rbx
jmp    1030 <outl_p@plt>

LLVM IR (-O0):
define void @extended_pci_write(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
%11 = alloca i32
store i32 %0, i32* %6
store i32 %1, i32* %7
store i32 %2, i32* %8
store i32 %3, i32* %9
store i32 %4, i32* %10
%12 = load i32, i32* %9
%13 = and i32 %12, 3840
%14 = shl i32 %13, 16
%15 = or i32 -2147483648, %14
%16 = load i32, i32* %6
%17 = and i32 %16, 255
%18 = shl i32 %17, 16
%19 = or i32 %15, %18
%20 = load i32, i32* %7
%21 = and i32 %20, 31
%22 = shl i32 %21, 11
%23 = or i32 %19, %22
%24 = load i32, i32* %8
%25 = and i32 %24, 7
%26 = shl i32 %25, 8
%27 = or i32 %23, %26
%28 = load i32, i32* %9
%29 = and i32 %28, 252
%30 = or i32 %27, %29
store i32 %30, i32* %11
%31 = load i32, i32* %11
%32 = call i32 @outl_p(i32 %31, i32 3320)
%33 = load i32, i32* %10
%34 = call i32 @outl_p(i32 %33, i32 3324)
ret void
}

LLVM IR (-O2):
define void @extended_pci_write(i32 %0, i32 %1, i32 %2, i32 %3, i32 %4) {
%6 = shl i32 %3, 16
%7 = and i32 %6, 251658240
%8 = shl i32 %0, 16
%9 = and i32 %8, 16711680
%10 = shl i32 %1, 11
%11 = and i32 %10, 63488
%12 = shl i32 %2, 8
%13 = and i32 %12, 1792
%14 = and i32 %3, 252
%15 = or i32 %9, %11
%16 = or i32 %15, %13
%17 = or i32 %16, %14
%18 = or i32 %17, %7
%19 = or i32 %18, -2147483648
%20 = tail call i32 @outl_p(i32 %19, i32 3320)
%21 = tail call i32 @outl_p(i32 %4, i32 3324)
ret void
}