#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*/ getid(int *);
int /*<<< orphan*/ printid(int);
void main() {
  int i, ind, max;
  int a[10];
  getid(a);
  max = a[0];
  ind = 0;
  for (i = 1; i < 9; i++)
    ;
  if (a[i] > max) {
    ind = i;
    max = a[i];
  }
  printid(max);
  printid(ind);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
lea    -0x40(%rbp),%rdi
call   1030 <getid@plt>
mov    -0x40(%rbp),%eax
mov    %eax,-0xc(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x1,-0x4(%rbp)
cmpl   $0x9,-0x4(%rbp)
jge    1162 <main+0x42>
jmp    1154 <main+0x34>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1145 <main+0x25>
movslq -0x4(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%eax
cmp    -0xc(%rbp),%eax
jle    1184 <main+0x64>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8(%rbp)
movslq -0x4(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1040 <printid@plt>
mov    -0x8(%rbp),%edi
call   1040 <printid@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
mov    %rsp,%rdi
call   1030 <getid@plt>
mov    (%rsp),%edi
mov    0x24(%rsp),%eax
xor    %ecx,%ecx
cmp    %edi,%eax
setg   %cl
lea    (%rcx,%rcx,8),%ebx
cmovg  %eax,%edi
call   1040 <printid@plt>
mov    %ebx,%edi
call   1040 <printid@plt>
add    $0x30,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define void @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%4 = call i32 @getid(i32* %3)
%5 = load i32, i32* %3
%6 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 9
%7 = load i32, i32* %6
%8 = icmp sgt i32 %7, %5
%9 = select i1 %8, i32 9, i32 0
%10 = select i1 %8, i32 %7, i32 %5
%11 = call i32 @printid(i32 %10)
%12 = call i32 @printid(i32 %9)
ret void
}