#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*/ printf(char *, int);
int /*<<< orphan*/ scanf(char *, int *);
int main() {
  while (42) {
    int cur;
    int highId;
    int highH;
    highId = 0;
    highH = 0;
    for (int i = 0; i < 8; i++) {
      scanf("%d", &cur);
      if (cur > highH) {
        highH = cur;
        highId = i;
      }
    }
    printf("%d\n", highId);
  }
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpl   $0x8,-0x14(%rbp)
jge    1189 <main+0x69>
lea    0xeab(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jle    1176 <main+0x56>
mov    -0x8(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    117b <main+0x5b>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1144 <main+0x24>
mov    -0xc(%rbp),%esi
lea    0xe70(%rip),%rdi
call   1030 <printf@plt>
jmp    112f <main+0xf>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xece(%rip),%r14
lea    0x4(%rsp),%rbx
mov    $0x7,%r12d
lea    0xebf(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%r13d
test   %r13d,%r13d
mov    $0x0,%eax
cmovs  %eax,%r13d
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
xor    %ebp,%ebp
cmp    %r13d,%eax
setg   %bpl
cmovg  %eax,%r13d
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    %r13d,%eax
mov    $0x2,%ecx
cmovg  %ecx,%ebp
cmovg  %eax,%r13d
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    %r13d,%eax
mov    $0x3,%ecx
cmovg  %ecx,%ebp
cmovg  %eax,%r13d
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    %r13d,%eax
mov    $0x4,%ecx
cmovg  %ecx,%ebp
cmovg  %eax,%r13d
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    %r13d,%eax
mov    $0x5,%ecx
cmovg  %ecx,%ebp
cmovg  %eax,%r13d
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
cmp    %r13d,%eax
mov    $0x6,%ecx
cmovg  %ecx,%ebp
cmovg  %eax,%r13d
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
cmp    %r13d,0x4(%rsp)
cmovg  %r12d,%ebp
mov    %r15,%rdi
mov    %ebp,%esi
call   1030 <printf@plt>
jmp    1150 <main+0x30>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 0, i32* %1
br label %6
6: ; preds = %0, %22
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
br label %7
7: ; preds = %19, %6
%8 = load i32, i32* %5
%9 = icmp slt i32 %8, 8
br i1 %9, label %10, label %22
10: ; preds = %7
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %2)
%12 = load i32, i32* %2
%13 = load i32, i32* %4
%14 = icmp sgt i32 %12, %13
br i1 %14, label %15, label %18
15: ; preds = %10
%16 = load i32, i32* %2
store i32 %16, i32* %4
%17 = load i32, i32* %5
store i32 %17, i32* %3
br label %18
18: ; preds = %15, %10
br label %19
19: ; preds = %18
%20 = load i32, i32* %5
%21 = add nsw i32 %20, 1
store i32 %21, i32* %5
br label %7
22: ; preds = %7
%23 = load i32, i32* %3
%24 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %23)
br label %6
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %0, %3
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = icmp sgt i32 %5, 0
%7 = select i1 %6, i32 %5, i32 0
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%9 = load i32, i32* %1
%10 = icmp sgt i32 %9, %7
%11 = zext i1 %10 to i32
%12 = select i1 %10, i32 %9, i32 %7
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%14 = load i32, i32* %1
%15 = icmp sgt i32 %14, %12
%16 = select i1 %15, i32 2, i32 %11
%17 = select i1 %15, i32 %14, i32 %12
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%19 = load i32, i32* %1
%20 = icmp sgt i32 %19, %17
%21 = select i1 %20, i32 3, i32 %16
%22 = select i1 %20, i32 %19, i32 %17
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%24 = load i32, i32* %1
%25 = icmp sgt i32 %24, %22
%26 = select i1 %25, i32 4, i32 %21
%27 = select i1 %25, i32 %24, i32 %22
%28 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%29 = load i32, i32* %1
%30 = icmp sgt i32 %29, %27
%31 = select i1 %30, i32 5, i32 %26
%32 = select i1 %30, i32 %29, i32 %27
%33 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%34 = load i32, i32* %1
%35 = icmp sgt i32 %34, %32
%36 = select i1 %35, i32 6, i32 %31
%37 = select i1 %35, i32 %34, i32 %32
%38 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%39 = load i32, i32* %1
%40 = icmp sgt i32 %39, %37
%41 = select i1 %40, i32 7, i32 %36
%42 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %41)
br label %3
}