#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 num;
  int max, min, i, z;
  printf("Anzahl: ");
  scanf("%d", &num);
  printf("\n");
  for (i = 1; i <= num; i++) {
    printf("%d. Zahl: ", i);
    scanf("%d", &z);
    if (i == 1)
      min = max = z;
    else {
      if (z < min)
        min = z;
      if (z > max)
        max = z;
    }
  }
  printf("\nMinimum: %d\nMaximum: %d\n", min, max);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec5(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
lea    0xedb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x8(%rbp),%eax
jg     11e3 <main+0xc3>
mov    -0x14(%rbp),%esi
lea    0xe94(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe83(%rip),%rdi
lea    -0x18(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x1,-0x14(%rbp)
jne    11a7 <main+0x87>
mov    -0x18(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    %eax,-0x10(%rbp)
jmp    11d0 <main+0xb0>
mov    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11b9 <main+0x99>
mov    -0x18(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0xc(%rbp),%eax
jle    11cb <main+0xab>
mov    -0x18(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    11d0 <main+0xb0>
jmp    11d5 <main+0xb5>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    1162 <main+0x42>
mov    -0x10(%rbp),%esi
mov    -0xc(%rbp),%edx
lea    0xe27(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xebe(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xeb9(%rip),%rbx
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    $0xa,%edi
call   1030 <putchar@plt>
lea    0xe9e(%rip),%rdi
mov    $0x1,%ebp
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1050 <scanf@plt>
mov    (%rsp),%r14d
cmpl   $0x2,0x4(%rsp)
jl     11e1 <main+0xb1>
lea    0xe70(%rip),%r15
lea    0xe66(%rip),%r12
mov    %rsp,%r13
mov    %r14d,%ebx
nopl   0x0(%rax)
add    $0x1,%ebp
mov    %r15,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1050 <scanf@plt>
mov    (%rsp),%eax
cmp    %r14d,%eax
cmovl  %eax,%r14d
cmp    %ebx,%eax
cmovg  %eax,%ebx
cmp    0x4(%rsp),%ebp
jl     11b0 <main+0x80>
jmp    11e4 <main+0xb4>
mov    %r14d,%ebx
lea    0xe2c(%rip),%rdi
mov    %r14d,%esi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [9 x i8] c"Anzahl: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [2 x i8] c"\0A\00"
@.str.3 = [11 x i8] c"%d. Zahl: \00"
@.str.4 = [26 x i8] c"\0AMinimum: %d\0AMaximum: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca 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 ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %5
br label %10
10: ; preds = %36, %0
%11 = load i32, i32* %5
%12 = load i32, i32* %2
%13 = icmp sle i32 %11, %12
br i1 %13, label %14, label %39
14: ; preds = %10
%15 = load i32, i32* %5
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %15)
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%18 = load i32, i32* %5
%19 = icmp eq i32 %18, 1
br i1 %19, label %20, label %22
20: ; preds = %14
%21 = load i32, i32* %6
store i32 %21, i32* %3
store i32 %21, i32* %4
br label %35
22: ; preds = %14
%23 = load i32, i32* %6
%24 = load i32, i32* %4
%25 = icmp slt i32 %23, %24
br i1 %25, label %26, label %28
26: ; preds = %22
%27 = load i32, i32* %6
store i32 %27, i32* %4
br label %28
28: ; preds = %26, %22
%29 = load i32, i32* %6
%30 = load i32, i32* %3
%31 = icmp sgt i32 %29, %30
br i1 %31, label %32, label %34
32: ; preds = %28
%33 = load i32, i32* %6
store i32 %33, i32* %3
br label %34
34: ; preds = %32, %28
br label %35
35: ; preds = %34, %20
br label %36
36: ; preds = %35
%37 = load i32, i32* %5
%38 = add nsw i32 %37, 1
store i32 %38, i32* %5
br label %10
39: ; preds = %10
%40 = load i32, i32* %4
%41 = load i32, i32* %3
%42 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i32 %40, i32 %41)
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"Anzahl: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [11 x i8] c"%d. Zahl: \00"
@.str.4 = [26 x i8] c"\0AMinimum: %d\0AMaximum: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%7 = call i32 @putchar(i32 10)
%8 = load i32, i32* %1
%9 = icmp sgt i32 %8, 0
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 1)
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%12 = load i32, i32* %2
%13 = load i32, i32* %1
%14 = icmp sgt i32 %13, 1
br i1 %14, label %15, label %29
15: ; preds = %0, %15
%16 = phi i32 [ %26, %15 ], [ 2, %0 ]
%17 = phi i32 [ %23, %15 ], [ %12, %0 ]
%18 = phi i32 [ %25, %15 ], [ %12, %0 ]
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.3, i64 0, i64 0), i32 %16)
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%21 = load i32, i32* %2
%22 = icmp slt i32 %21, %17
%23 = select i1 %22, i32 %21, i32 %17
%24 = icmp sgt i32 %21, %18
%25 = select i1 %24, i32 %21, i32 %18
%26 = add nuw nsw i32 %16, 1
%27 = load i32, i32* %1
%28 = icmp slt i32 %16, %27
br i1 %28, label %15, label %29
29: ; preds = %15, %0
%30 = phi i32 [ %12, %0 ], [ %25, %15 ]
%31 = phi i32 [ %12, %0 ], [ %23, %15 ]
%32 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i32 %31, i32 %30)
ret i32 0
}