#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*/ pci_config_writeb(int, int, int);
void setup_pam(int bdf, int pambase) {
  int i;
  for (i = 0; i < 6; i++) {
    int pam = pambase + 1 + i;
    pci_config_writeb(bdf, pam, 0x33);
  }
  pci_config_writeb(bdf, pambase, 0x30);
}


x86 assembly (clang, -O0):
<setup_pam>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x6,-0xc(%rbp)
jge    1159 <setup_pam+0x49>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
add    -0xc(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%esi
mov    $0x33,%edx
call   1030 <pci_config_writeb@plt>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1125 <setup_pam+0x15>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    $0x30,%edx
call   1030 <pci_config_writeb@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<setup_pam>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
lea    0x1(%rbx),%esi
mov    $0x33,%edx
call   1030 <pci_config_writeb@plt>
lea    0x2(%rbx),%esi
mov    %ebp,%edi
mov    $0x33,%edx
call   1030 <pci_config_writeb@plt>
lea    0x3(%rbx),%esi
mov    %ebp,%edi
mov    $0x33,%edx
call   1030 <pci_config_writeb@plt>
lea    0x4(%rbx),%esi
mov    %ebp,%edi
mov    $0x33,%edx
call   1030 <pci_config_writeb@plt>
lea    0x5(%rbx),%esi
mov    %ebp,%edi
mov    $0x33,%edx
call   1030 <pci_config_writeb@plt>
lea    0x6(%rbx),%esi
mov    %ebp,%edi
mov    $0x33,%edx
call   1030 <pci_config_writeb@plt>
mov    %ebp,%edi
mov    %ebx,%esi
mov    $0x30,%edx
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <pci_config_writeb@plt>

LLVM IR (-O0):
define void @setup_pam(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %7
7: ; preds = %18, %2
%8 = load i32, i32* %5
%9 = icmp slt i32 %8, 6
br i1 %9, label %10, label %21
10: ; preds = %7
%11 = load i32, i32* %4
%12 = add nsw i32 %11, 1
%13 = load i32, i32* %5
%14 = add nsw i32 %12, %13
store i32 %14, i32* %6
%15 = load i32, i32* %3
%16 = load i32, i32* %6
%17 = call i32 @pci_config_writeb(i32 %15, i32 %16, i32 51)
br label %18
18: ; preds = %10
%19 = load i32, i32* %5
%20 = add nsw i32 %19, 1
store i32 %20, i32* %5
br label %7
21: ; preds = %7
%22 = load i32, i32* %3
%23 = load i32, i32* %4
%24 = call i32 @pci_config_writeb(i32 %22, i32 %23, i32 48)
ret void
}

LLVM IR (-O2):
define void @setup_pam(i32 %0, i32 %1) {
%3 = add i32 %1, 1
%4 = tail call i32 @pci_config_writeb(i32 %0, i32 %3, i32 51)
%5 = add i32 %1, 2
%6 = tail call i32 @pci_config_writeb(i32 %0, i32 %5, i32 51)
%7 = add i32 %1, 3
%8 = tail call i32 @pci_config_writeb(i32 %0, i32 %7, i32 51)
%9 = add i32 %1, 4
%10 = tail call i32 @pci_config_writeb(i32 %0, i32 %9, i32 51)
%11 = add i32 %1, 5
%12 = tail call i32 @pci_config_writeb(i32 %0, i32 %11, i32 51)
%13 = add i32 %1, 6
%14 = tail call i32 @pci_config_writeb(i32 %0, i32 %13, i32 51)
%15 = tail call i32 @pci_config_writeb(i32 %0, i32 %1, i32 48)
ret void
}