#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 /*<<< orphan*/ scanf(char *, int *);
int main() {
  int sample[10];
  printf("Enter 10 integers (Each on a line): \n");
  for (int i = 0; i < 10; i++)
    scanf("%d", &sample[i]);
  int maximum = sample[0];
  int minimum = sample[0];
  printf("%d", minimum);
  for (int c = 1; c < 10; c++) {
    if (sample[c] > maximum) {
      maximum = sample[c];
    }
    if (sample[c] < minimum) {
      minimum = sample[c];
    }
  }
  printf("The maximum value is: %d\n", maximum);
  printf("The minimum value is: %d\n", minimum);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x34(%rbp)
cmpl   $0xa,-0x34(%rbp)
jge    1177 <main+0x57>
movslq -0x34(%rbp),%rax
lea    -0x30(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xec2(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    1144 <main+0x24>
mov    -0x30(%rbp),%eax
mov    %eax,-0x38(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x3c(%rbp),%esi
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x40(%rbp)
cmpl   $0xa,-0x40(%rbp)
jge    11f0 <main+0xd0>
movslq -0x40(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
cmp    -0x38(%rbp),%eax
jle    11c1 <main+0xa1>
movslq -0x40(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    %eax,-0x38(%rbp)
movslq -0x40(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
cmp    -0x3c(%rbp),%eax
jge    11dd <main+0xbd>
movslq -0x40(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%eax
mov    %eax,-0x3c(%rbp)
jmp    11e2 <main+0xc2>
mov    -0x40(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x40(%rbp)
jmp    119b <main+0x7b>
mov    -0x38(%rbp),%esi
lea    0xe2f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x3c(%rbp),%esi
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x28,%rsp
lea    0xef9(%rip),%rdi
call   1030 <puts@plt>
lea    0xeb6(%rip),%r14
mov    %rsp,%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
lea    0x4(%rsp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
lea    0x8(%rsp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
lea    0xc(%rsp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
lea    0x10(%rsp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
lea    0x14(%rsp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
lea    0x18(%rsp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
lea    0x1c(%rsp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
lea    0x20(%rsp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
lea    0x24(%rsp),%rsi
mov    %r14,%rdi
call   1050 <scanf@plt>
mov    (%rsp),%ebx
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x4(%rsp),%eax
cmp    %ebx,%eax
mov    %ebx,%esi
cmovg  %eax,%esi
cmovl  %eax,%ebx
mov    0x8(%rsp),%eax
cmp    %esi,%eax
cmovg  %eax,%esi
cmp    %ebx,%eax
cmovl  %eax,%ebx
mov    0xc(%rsp),%eax
cmp    %esi,%eax
cmovg  %eax,%esi
cmp    %ebx,%eax
cmovl  %eax,%ebx
mov    0x10(%rsp),%eax
cmp    %esi,%eax
cmovg  %eax,%esi
cmp    %ebx,%eax
cmovl  %eax,%ebx
mov    0x14(%rsp),%eax
cmp    %esi,%eax
cmovg  %eax,%esi
cmp    %ebx,%eax
cmovl  %eax,%ebx
mov    0x18(%rsp),%eax
cmp    %esi,%eax
cmovg  %eax,%esi
cmp    %ebx,%eax
cmovl  %eax,%ebx
mov    0x1c(%rsp),%eax
cmp    %esi,%eax
cmovg  %eax,%esi
cmp    %ebx,%eax
cmovl  %eax,%ebx
mov    0x20(%rsp),%eax
cmp    %esi,%eax
cmovg  %eax,%esi
cmp    %ebx,%eax
cmovl  %eax,%ebx
mov    0x24(%rsp),%eax
cmp    %esi,%eax
cmovg  %eax,%esi
cmp    %ebx,%eax
cmovl  %eax,%ebx
lea    0xda5(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xdb1(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x28,%rsp
pop    %rbx
pop    %r14
ret

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

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [26 x i8] c"The maximum value is: %d\0A\00"
@.str.3 = [26 x i8] c"The minimum value is: %d\0A\00"
@str = [37 x i8] c"Enter 10 integers (Each on a line): \00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = bitcast [10 x i32]* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
%4 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%6 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 1
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%8 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 2
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %8)
%10 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 3
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %10)
%12 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 4
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %12)
%14 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 5
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %14)
%16 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 6
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %16)
%18 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 7
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %18)
%20 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 8
%21 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %20)
%22 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 9
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %22)
%24 = load i32, i32* %4
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %24)
%26 = load i32, i32* %6
%27 = icmp sgt i32 %26, %24
%28 = select i1 %27, i32 %26, i32 %24
%29 = icmp slt i32 %26, %24
%30 = select i1 %29, i32 %26, i32 %24
%31 = load i32, i32* %8
%32 = icmp sgt i32 %31, %28
%33 = select i1 %32, i32 %31, i32 %28
%34 = icmp slt i32 %31, %30
%35 = select i1 %34, i32 %31, i32 %30
%36 = load i32, i32* %10
%37 = icmp sgt i32 %36, %33
%38 = select i1 %37, i32 %36, i32 %33
%39 = icmp slt i32 %36, %35
%40 = select i1 %39, i32 %36, i32 %35
%41 = load i32, i32* %12
%42 = icmp sgt i32 %41, %38
%43 = select i1 %42, i32 %41, i32 %38
%44 = icmp slt i32 %41, %40
%45 = select i1 %44, i32 %41, i32 %40
%46 = load i32, i32* %14
%47 = icmp sgt i32 %46, %43
%48 = select i1 %47, i32 %46, i32 %43
%49 = icmp slt i32 %46, %45
%50 = select i1 %49, i32 %46, i32 %45
%51 = load i32, i32* %16
%52 = icmp sgt i32 %51, %48
%53 = select i1 %52, i32 %51, i32 %48
%54 = icmp slt i32 %51, %50
%55 = select i1 %54, i32 %51, i32 %50
%56 = load i32, i32* %18
%57 = icmp sgt i32 %56, %53
%58 = select i1 %57, i32 %56, i32 %53
%59 = icmp slt i32 %56, %55
%60 = select i1 %59, i32 %56, i32 %55
%61 = load i32, i32* %20
%62 = icmp sgt i32 %61, %58
%63 = select i1 %62, i32 %61, i32 %58
%64 = icmp slt i32 %61, %60
%65 = select i1 %64, i32 %61, i32 %60
%66 = load i32, i32* %22
%67 = icmp sgt i32 %66, %63
%68 = select i1 %67, i32 %66, i32 %63
%69 = icmp slt i32 %66, %65
%70 = select i1 %69, i32 %66, i32 %65
%71 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.2, i64 0, i64 0), i32 %68)
%72 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.3, i64 0, i64 0), i32 %70)
ret i32 0
}