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


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
lea    -0x20(%rbp),%rdi
call   1030 <getid@plt>
movss  -0x20(%rbp),%xmm0
movss  %xmm0,-0x24(%rbp)
movl   $0x0,-0x4(%rbp)
cmpl   $0x5,-0x4(%rbp)
jge    118b <main+0x6b>
movslq -0x4(%rbp),%rax
movss  -0x20(%rbp,%rax,4),%xmm0
ucomiss -0x24(%rbp),%xmm0
jbe    1178 <main+0x58>
movslq -0x4(%rbp),%rax
movss  -0x20(%rbp,%rax,4),%xmm0
movss  %xmm0,-0x24(%rbp)
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    117d <main+0x5d>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    1142 <main+0x22>
cvttss2si -0x24(%rbp),%edi
call   1040 <printid@plt>
mov    -0x8(%rbp),%edi
call   1040 <printid@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
mov    %rsp,%rdi
call   1030 <getid@plt>
movss  (%rsp),%xmm0
movss  0x4(%rsp),%xmm1
xor    %eax,%eax
ucomiss %xmm0,%xmm1
seta   %al
add    $0x1,%eax
maxss  %xmm0,%xmm1
movss  0x8(%rsp),%xmm0
ucomiss %xmm1,%xmm0
mov    $0x3,%ecx
cmovbe %eax,%ecx
maxss  %xmm1,%xmm0
movss  0xc(%rsp),%xmm1
ucomiss %xmm0,%xmm1
mov    $0x4,%eax
cmovbe %ecx,%eax
maxss  %xmm0,%xmm1
movss  0x10(%rsp),%xmm0
ucomiss %xmm1,%xmm0
mov    $0x5,%ebx
cmovbe %eax,%ebx
maxss  %xmm1,%xmm0
cvttss2si %xmm0,%edi
call   1040 <printid@plt>
mov    %ebx,%edi
call   1040 <printid@plt>
add    $0x20,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
define void @main() {
%1 = alloca [5 x float]
%2 = bitcast [5 x float]* %1 to i8*
%3 = getelementptr inbounds [5 x float], [5 x float]* %1, i64 0, i64 0
%4 = call i32 @getid(float* %3)
%5 = load float, float* %3
%6 = getelementptr inbounds [5 x float], [5 x float]* %1, i64 0, i64 1
%7 = load float, float* %6
%8 = fcmp ogt float %7, %5
%9 = select i1 %8, i32 2, i32 1
%10 = select i1 %8, float %7, float %5
%11 = getelementptr inbounds [5 x float], [5 x float]* %1, i64 0, i64 2
%12 = load float, float* %11
%13 = fcmp ogt float %12, %10
%14 = select i1 %13, i32 3, i32 %9
%15 = select i1 %13, float %12, float %10
%16 = getelementptr inbounds [5 x float], [5 x float]* %1, i64 0, i64 3
%17 = load float, float* %16
%18 = fcmp ogt float %17, %15
%19 = select i1 %18, i32 4, i32 %14
%20 = select i1 %18, float %17, float %15
%21 = getelementptr inbounds [5 x float], [5 x float]* %1, i64 0, i64 4
%22 = load float, float* %21
%23 = fcmp ogt float %22, %20
%24 = select i1 %23, i32 5, i32 %19
%25 = select i1 %23, float %22, float %20
%26 = fptosi float %25 to i32
%27 = call i32 @printid(i32 %26)
%28 = call i32 @printid(i32 %24)
ret void
}