#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 */
typedef int uint8_t;
typedef int /*<<< orphan*/ uint32_t;

/* Variables and functions */
int /*<<< orphan*/ findDevice(int, int, int);
void checkAllBuses() {
  uint8_t bus;
  uint8_t device;
  uint8_t function;
  uint32_t got;
  for (bus = 0; bus < 256; bus++) {
    for (device = 0; device < 32; device++) {
      for (function = 0; function < 8; function++) {
        got = findDevice(bus, device, function);
      }
    }
  }
}


x86 assembly (clang, -O0):
<checkAllBuses>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x100,-0x4(%rbp)
jge    1193 <checkAllBuses+0x83>
movl   $0x0,-0x8(%rbp)
cmpl   $0x20,-0x8(%rbp)
jge    1180 <checkAllBuses+0x70>
movl   $0x0,-0xc(%rbp)
cmpl   $0x8,-0xc(%rbp)
jge    116d <checkAllBuses+0x5d>
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
call   1030 <findDevice@plt>
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1144 <checkAllBuses+0x34>
jmp    1172 <checkAllBuses+0x62>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1133 <checkAllBuses+0x23>
jmp    1185 <checkAllBuses+0x75>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111f <checkAllBuses+0xf>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<checkAllBuses>:
push   %rbp
push   %rbx
push   %rax
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nop
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %ebx,%edi
mov    %ebp,%esi
xor    %edx,%edx
call   1030 <findDevice@plt>
mov    %ebx,%edi
mov    %ebp,%esi
mov    $0x1,%edx
call   1030 <findDevice@plt>
mov    %ebx,%edi
mov    %ebp,%esi
mov    $0x2,%edx
call   1030 <findDevice@plt>
mov    %ebx,%edi
mov    %ebp,%esi
mov    $0x3,%edx
call   1030 <findDevice@plt>
mov    %ebx,%edi
mov    %ebp,%esi
mov    $0x4,%edx
call   1030 <findDevice@plt>
mov    %ebx,%edi
mov    %ebp,%esi
mov    $0x5,%edx
call   1030 <findDevice@plt>
mov    %ebx,%edi
mov    %ebp,%esi
mov    $0x6,%edx
call   1030 <findDevice@plt>
mov    %ebx,%edi
mov    %ebp,%esi
mov    $0x7,%edx
call   1030 <findDevice@plt>
add    $0x1,%ebp
cmp    $0x20,%ebp
jne    1130 <checkAllBuses+0x20>
add    $0x1,%ebx
cmp    $0x100,%ebx
jne    1120 <checkAllBuses+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @checkAllBuses() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
br label %5
5: ; preds = %29, %0
%6 = load i32, i32* %1
%7 = icmp slt i32 %6, 256
br i1 %7, label %8, label %32
8: ; preds = %5
store i32 0, i32* %2
br label %9
9: ; preds = %25, %8
%10 = load i32, i32* %2
%11 = icmp slt i32 %10, 32
br i1 %11, label %12, label %28
12: ; preds = %9
store i32 0, i32* %3
br label %13
13: ; preds = %21, %12
%14 = load i32, i32* %3
%15 = icmp slt i32 %14, 8
br i1 %15, label %16, label %24
16: ; preds = %13
%17 = load i32, i32* %1
%18 = load i32, i32* %2
%19 = load i32, i32* %3
%20 = call i32 @findDevice(i32 %17, i32 %18, i32 %19)
store i32 %20, i32* %4
br label %21
21: ; preds = %16
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 1
store i32 %23, i32* %3
br label %13
24: ; preds = %13
br label %25
25: ; preds = %24
%26 = load i32, i32* %2
%27 = add nsw i32 %26, 1
store i32 %27, i32* %2
br label %9
28: ; preds = %9
br label %29
29: ; preds = %28
%30 = load i32, i32* %1
%31 = add nsw i32 %30, 1
store i32 %31, i32* %1
br label %5
32: ; preds = %5
ret void
}

LLVM IR (-O2):
define void @checkAllBuses() {
br label %1
1: ; preds = %0, %15
%2 = phi i32 [ 0, %0 ], [ %16, %15 ]
br label %3
3: ; preds = %1, %3
%4 = phi i32 [ 0, %1 ], [ %13, %3 ]
%5 = tail call i32 @findDevice(i32 %2, i32 %4, i32 0)
%6 = tail call i32 @findDevice(i32 %2, i32 %4, i32 1)
%7 = tail call i32 @findDevice(i32 %2, i32 %4, i32 2)
%8 = tail call i32 @findDevice(i32 %2, i32 %4, i32 3)
%9 = tail call i32 @findDevice(i32 %2, i32 %4, i32 4)
%10 = tail call i32 @findDevice(i32 %2, i32 %4, i32 5)
%11 = tail call i32 @findDevice(i32 %2, i32 %4, i32 6)
%12 = tail call i32 @findDevice(i32 %2, i32 %4, i32 7)
%13 = add nuw nsw i32 %4, 1
%14 = icmp eq i32 %13, 32
br i1 %14, label %15, label %3
15: ; preds = %3
%16 = add nuw nsw i32 %2, 1
%17 = icmp eq i32 %16, 256
br i1 %17, label %18, label %1
18: ; preds = %15
ret void
}