#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 *);
void init(int *choice) {
  static int i = 0;
  if (0 == i) {
    printf("%s\n", "Enter a choice:");
    printf("\t0\tPrint the array of grades\n");
    printf("\t1\tFind the minimum grade\n");
    printf("\t2\tFind the maximum grade\n");
    printf("\t3\tPrint the average on all tests for each student\n");
    printf("\t4\tEnd program\n");
  }
  ++i;
  scanf("%d", choice);
}


x86 assembly (clang, -O0):
<init>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
xor    %eax,%eax
cmp    0x2f00(%rip),%eax
jne    1195 <init+0x75>
lea    0xebf(%rip),%rdi
lea    0xebc(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xedb(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xee8(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf0e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    0x2e99(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2e90(%rip)
mov    -0x8(%rbp),%rsi
lea    0xefd(%rip),%rdi
call   1040 <scanf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<init>:
push   %rbx
mov    %rdi,%rbx
mov    0x2f0a(%rip),%eax
test   %eax,%eax
jne    117c <init+0x5c>
lea    0xecb(%rip),%rdi
call   1030 <puts@plt>
lea    0xed2(%rip),%rdi
call   1030 <puts@plt>
lea    0xee3(%rip),%rdi
call   1030 <puts@plt>
lea    0xef1(%rip),%rdi
call   1030 <puts@plt>
lea    0xeff(%rip),%rdi
call   1030 <puts@plt>
lea    0xf26(%rip),%rdi
call   1030 <puts@plt>
mov    0x2eb8(%rip),%eax
add    $0x1,%eax
mov    %eax,0x2eaf(%rip)
lea    0xe84(%rip),%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1040 <scanf@plt>

LLVM IR (-O0):
@init.i = internal global i32 0
@.str = [4 x i8] c"%s\0A\00"
@.str.1 = [16 x i8] c"Enter a choice:\00"
@.str.2 = [30 x i8] c"\090\09Print the array of grades\0A\00"
@.str.3 = [27 x i8] c"\091\09Find the minimum grade\0A\00"
@.str.4 = [27 x i8] c"\092\09Find the maximum grade\0A\00"
@.str.5 = [52 x i8] c"\093\09Print the average on all tests for each student\0A\00"
@.str.6 = [16 x i8] c"\094\09End program\0A\00"
@.str.7 = [3 x i8] c"%d\00"
define void @init(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32, i32* @init.i
%4 = icmp eq i32 0, %3
br i1 %4, label %5, label %12
5: ; preds = %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.2, i64 0, i64 0))
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0))
%9 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.4, i64 0, i64 0))
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str.5, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.6, i64 0, i64 0))
br label %12
12: ; preds = %5, %1
%13 = load i32, i32* @init.i
%14 = add nsw i32 %13, 1
store i32 %14, i32* @init.i
%15 = load i32*, i32** %2
%16 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %15)
ret void
}

LLVM IR (-O2):
@init.i = internal unnamed_addr global i32 0
@.str.1 = [16 x i8] c"Enter a choice:\00"
@.str.7 = [3 x i8] c"%d\00"
@str = [29 x i8] c"\090\09Print the array of grades\00"
@str.8 = [26 x i8] c"\091\09Find the minimum grade\00"
@str.9 = [26 x i8] c"\092\09Find the maximum grade\00"
@str.10 = [51 x i8] c"\093\09Print the average on all tests for each student\00"
@str.11 = [15 x i8] c"\094\09End program\00"
define void @init(i32* %0) {
%2 = load i32, i32* @init.i
%3 = icmp eq i32 %2, 0
br i1 %3, label %4, label %12
4: ; preds = %1
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @str, i64 0, i64 0))
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.8, i64 0, i64 0))
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @str.9, i64 0, i64 0))
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str.10, i64 0, i64 0))
%10 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @str.11, i64 0, i64 0))
%11 = load i32, i32* @init.i
br label %12
12: ; preds = %4, %1
%13 = phi i32 [ %11, %4 ], [ %2, %1 ]
%14 = add nsw i32 %13, 1
store i32 %14, i32* @init.i
%15 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.7, i64 0, i64 0), i32* %0)
ret void
}