#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 /*<<< orphan*/ a;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int main(int argc, char *argv[]) {
  int a[] = {10, 11, 7, 10, 6};
  int size = sizeof(a) / sizeof(a[0]);
  int i = 0, max = a[1] - a[0];
  for (int j = 1; j < size; j++) {
    if (a[i] - a[j] > max)
      max = a[i] - a[j];
    {
      if (a[j] < a[i])
        i = j;
    }
  }
  printf("\n[When to buy] Day i is %d, price is %d\n", i, a[i]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xed3(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xed0(%rip),%rax
mov    %rax,-0x28(%rbp)
mov    0xece(%rip),%eax
mov    %eax,-0x20(%rbp)
movl   $0x5,-0x34(%rbp)
movl   $0x0,-0x38(%rbp)
mov    -0x2c(%rbp),%eax
sub    -0x30(%rbp),%eax
mov    %eax,-0x3c(%rbp)
movl   $0x1,-0x40(%rbp)
mov    -0x40(%rbp),%eax
cmp    -0x34(%rbp),%eax
jge    11ca <main+0xba>
movslq -0x38(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
movslq -0x40(%rbp),%rcx
sub    -0x30(%rbp,%rcx,4),%eax
cmp    -0x3c(%rbp),%eax
jle    119b <main+0x8b>
movslq -0x38(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
movslq -0x40(%rbp),%rcx
sub    -0x30(%rbp,%rcx,4),%eax
mov    %eax,-0x3c(%rbp)
movslq -0x40(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
movslq -0x38(%rbp),%rcx
cmp    -0x30(%rbp,%rcx,4),%eax
jge    11b7 <main+0xa7>
mov    -0x40(%rbp),%eax
mov    %eax,-0x38(%rbp)
jmp    11bc <main+0xac>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    1163 <main+0x53>
mov    -0x38(%rbp),%esi
movslq -0x38(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%edx
lea    0xe38(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x4,%esi
mov    $0x6,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@__const.main.a = [5 x i32] [i32 10, i32 11, i32 7, i32 10, i32 6]
@.str = [41 x i8] c"\0A[When to buy] Day i is %d, price is %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [5 x i32]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
%10 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = bitcast [5 x i32]* %6 to i8*
store i32 5, i32* %7
store i32 0, i32* %8
%12 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 1
%13 = load i32, i32* %12
%14 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 0
%15 = load i32, i32* %14
%16 = sub nsw i32 %13, %15
store i32 %16, i32* %9
store i32 1, i32* %10
br label %17
17: ; preds = %56, %2
%18 = load i32, i32* %10
%19 = load i32, i32* %7
%20 = icmp slt i32 %18, %19
br i1 %20, label %21, label %59
21: ; preds = %17
%22 = load i32, i32* %8
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 %23
%25 = load i32, i32* %24
%26 = load i32, i32* %10
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 %27
%29 = load i32, i32* %28
%30 = sub nsw i32 %25, %29
%31 = load i32, i32* %9
%32 = icmp sgt i32 %30, %31
br i1 %32, label %33, label %43
33: ; preds = %21
%34 = load i32, i32* %8
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 %35
%37 = load i32, i32* %36
%38 = load i32, i32* %10
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 %39
%41 = load i32, i32* %40
%42 = sub nsw i32 %37, %41
store i32 %42, i32* %9
br label %43
43: ; preds = %33, %21
%44 = load i32, i32* %10
%45 = sext i32 %44 to i64
%46 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 %45
%47 = load i32, i32* %46
%48 = load i32, i32* %8
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 %49
%51 = load i32, i32* %50
%52 = icmp slt i32 %47, %51
br i1 %52, label %53, label %55
53: ; preds = %43
%54 = load i32, i32* %10
store i32 %54, i32* %8
br label %55
55: ; preds = %53, %43
br label %56
56: ; preds = %55
%57 = load i32, i32* %10
%58 = add nsw i32 %57, 1
store i32 %58, i32* %10
br label %17
59: ; preds = %17
%60 = load i32, i32* %8
%61 = load i32, i32* %8
%62 = sext i32 %61 to i64
%63 = getelementptr inbounds [5 x i32], [5 x i32]* %6, i64 0, i64 %62
%64 = load i32, i32* %63
%65 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 %60, i32 %64)
ret i32 0
}

LLVM IR (-O2):
@.str = [41 x i8] c"\0A[When to buy] Day i is %d, price is %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0), i32 4, i32 6)
ret i32 0
}