#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 sgi_get_sysid(int);
int sgi_entire(void) {
  int i = 0;
  for (i = 0; i < 16; i++)
    if (sgi_get_sysid(i) == 0x06)
      return i;
  return -1;
}


x86 assembly (clang, -O0):
<sgi_entire>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0x10,-0x8(%rbp)
jge    115f <sgi_entire+0x4f>
mov    -0x8(%rbp),%edi
call   1030 <sgi_get_sysid@plt>
cmp    $0x6,%eax
jne    114c <sgi_entire+0x3c>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1166 <sgi_entire+0x56>
jmp    1151 <sgi_entire+0x41>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1126 <sgi_entire+0x16>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sgi_entire>:
push   %rbx
xor    %ebx,%ebx
xor    %edi,%edi
call   1030 <sgi_get_sysid@plt>
cmp    $0x6,%eax
je     1273 <sgi_entire+0x163>
mov    $0x1,%ebx
mov    $0x1,%edi
call   1030 <sgi_get_sysid@plt>
cmp    $0x6,%eax
je     1273 <sgi_entire+0x163>
mov    $0x2,%ebx
mov    $0x2,%edi
call   1030 <sgi_get_sysid@plt>
cmp    $0x6,%eax
je     1273 <sgi_entire+0x163>
mov    $0x3,%ebx
mov    $0x3,%edi
call   1030 <sgi_get_sysid@plt>
cmp    $0x6,%eax
je     1273 <sgi_entire+0x163>
mov    $0x4,%ebx
mov    $0x4,%edi
call   1030 <sgi_get_sysid@plt>
cmp    $0x6,%eax
je     1273 <sgi_entire+0x163>
mov    $0x5,%ebx
mov    $0x5,%edi
call   1030 <sgi_get_sysid@plt>
cmp    $0x6,%eax
je     1273 <sgi_entire+0x163>
mov    $0x6,%ebx
mov    $0x6,%edi
call   1030 <sgi_get_sysid@plt>
cmp    $0x6,%eax
je     1273 <sgi_entire+0x163>
mov    $0x7,%ebx
mov    $0x7,%edi
call   1030 <sgi_get_sysid@plt>
cmp    $0x6,%eax
je     1273 <sgi_entire+0x163>
mov    $0x8,%ebx
mov    $0x8,%edi
call   1030 <sgi_get_sysid@plt>
cmp    $0x6,%eax
je     1273 <sgi_entire+0x163>
mov    $0x9,%ebx
mov    $0x9,%edi
call   1030 <sgi_get_sysid@plt>
cmp    $0x6,%eax
je     1273 <sgi_entire+0x163>
mov    $0xa,%ebx
mov    $0xa,%edi
call   1030 <sgi_get_sysid@plt>
cmp    $0x6,%eax
je     1273 <sgi_entire+0x163>
mov    $0xb,%ebx
mov    $0xb,%edi
call   1030 <sgi_get_sysid@plt>
cmp    $0x6,%eax
je     1273 <sgi_entire+0x163>
mov    $0xc,%ebx
mov    $0xc,%edi
call   1030 <sgi_get_sysid@plt>
cmp    $0x6,%eax
je     1273 <sgi_entire+0x163>
mov    $0xd,%ebx
mov    $0xd,%edi
call   1030 <sgi_get_sysid@plt>
cmp    $0x6,%eax
je     1273 <sgi_entire+0x163>
mov    $0xe,%ebx
mov    $0xe,%edi
call   1030 <sgi_get_sysid@plt>
cmp    $0x6,%eax
je     1273 <sgi_entire+0x163>
mov    $0xf,%edi
call   1030 <sgi_get_sysid@plt>
xor    %ebx,%ebx
cmp    $0x6,%eax
sete   %bl
shl    $0x4,%ebx
add    $0xffffffff,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @sgi_entire() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %2
store i32 0, i32* %2
br label %3
3: ; preds = %13, %0
%4 = load i32, i32* %2
%5 = icmp slt i32 %4, 16
br i1 %5, label %6, label %16
6: ; preds = %3
%7 = load i32, i32* %2
%8 = call i32 @sgi_get_sysid(i32 %7)
%9 = icmp eq i32 %8, 6
br i1 %9, label %10, label %12
10: ; preds = %6
%11 = load i32, i32* %2
store i32 %11, i32* %1
br label %17
12: ; preds = %6
br label %13
13: ; preds = %12
%14 = load i32, i32* %2
%15 = add nsw i32 %14, 1
store i32 %15, i32* %2
br label %3
16: ; preds = %3
store i32 -1, i32* %1
br label %17
17: ; preds = %16, %10
%18 = load i32, i32* %1
ret i32 %18
}

LLVM IR (-O2):
define i32 @sgi_entire() {
%1 = tail call i32 @sgi_get_sysid(i32 0)
%2 = icmp eq i32 %1, 6
br i1 %2, label %49, label %3
3: ; preds = %0
%4 = tail call i32 @sgi_get_sysid(i32 1)
%5 = icmp eq i32 %4, 6
br i1 %5, label %49, label %6
6: ; preds = %3
%7 = tail call i32 @sgi_get_sysid(i32 2)
%8 = icmp eq i32 %7, 6
br i1 %8, label %49, label %9
9: ; preds = %6
%10 = tail call i32 @sgi_get_sysid(i32 3)
%11 = icmp eq i32 %10, 6
br i1 %11, label %49, label %12
12: ; preds = %9
%13 = tail call i32 @sgi_get_sysid(i32 4)
%14 = icmp eq i32 %13, 6
br i1 %14, label %49, label %15
15: ; preds = %12
%16 = tail call i32 @sgi_get_sysid(i32 5)
%17 = icmp eq i32 %16, 6
br i1 %17, label %49, label %18
18: ; preds = %15
%19 = tail call i32 @sgi_get_sysid(i32 6)
%20 = icmp eq i32 %19, 6
br i1 %20, label %49, label %21
21: ; preds = %18
%22 = tail call i32 @sgi_get_sysid(i32 7)
%23 = icmp eq i32 %22, 6
br i1 %23, label %49, label %24
24: ; preds = %21
%25 = tail call i32 @sgi_get_sysid(i32 8)
%26 = icmp eq i32 %25, 6
br i1 %26, label %49, label %27
27: ; preds = %24
%28 = tail call i32 @sgi_get_sysid(i32 9)
%29 = icmp eq i32 %28, 6
br i1 %29, label %49, label %30
30: ; preds = %27
%31 = tail call i32 @sgi_get_sysid(i32 10)
%32 = icmp eq i32 %31, 6
br i1 %32, label %49, label %33
33: ; preds = %30
%34 = tail call i32 @sgi_get_sysid(i32 11)
%35 = icmp eq i32 %34, 6
br i1 %35, label %49, label %36
36: ; preds = %33
%37 = tail call i32 @sgi_get_sysid(i32 12)
%38 = icmp eq i32 %37, 6
br i1 %38, label %49, label %39
39: ; preds = %36
%40 = tail call i32 @sgi_get_sysid(i32 13)
%41 = icmp eq i32 %40, 6
br i1 %41, label %49, label %42
42: ; preds = %39
%43 = tail call i32 @sgi_get_sysid(i32 14)
%44 = icmp eq i32 %43, 6
br i1 %44, label %49, label %45
45: ; preds = %42
%46 = tail call i32 @sgi_get_sysid(i32 15)
%47 = icmp eq i32 %46, 6
%48 = select i1 %47, i32 15, i32 -1
br label %49
49: ; preds = %45, %42, %39, %36, %33, %30, %27, %24, %21, %18, %15, %12, %9, %6, %3, %0
%50 = phi i32 [ 0, %0 ], [ 1, %3 ], [ 2, %6 ], [ 3, %9 ], [ 4, %12 ], [ 5, %15 ], [ 6, %18 ], [ 7, %21 ], [ 8, %24 ], [ 9, %27 ], [ 10, %30 ], [ 11, %33 ], [ 12, %36 ], [ 13, %39 ], [ 14, %42 ], [ %48, %45 ]
ret i32 %50
}