#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 insert_student(int a[3][4]) {
  int i, k, j;
  i = j = k = 0;
  while (i < 3 && j < 4) {
    printf("\nGive the ID, between 0 to 500 ,of the %d student:\n", i + 1);
    scanf("%d", &a[i][j]);
    k = 0;
    while (k < i) {
      if (a[i][j] == a[k][j]) {
        printf("\nAlready given.Give another ID, between 0 to 500 ,of the %d "
               "student:\n",
               i + 1);
        scanf("%d", &a[i][j]);
      } else
        k++;
    }
    j++;
    printf("\nGive the age ,between 18 and 35, of the %d student:\n", i + 1);
    scanf("%d", &a[i][j]);
    while (a[i][j] < 18 || a[i][j] > 35) {
      printf("\nAge out of range, between 18 and 35, of the %d student:\n",
             i + 1);
      scanf("%d", &a[i][j]);
    }
    j++;
    printf("\nGive the sex  ,1 for male and 2 for female,of the %d student:\n",
           i + 1);
    scanf("%d", &a[i][j]);
    while (a[i][j] < 1 || a[i][j] > 2) {
      printf("\nWrong,1 for male and 2 for female:\n");
      scanf("%d", &a[i][j]);
    }
    j++;
    printf("\nGive the degree , between 1 to 10,of the %d student:\n", i + 1);
    scanf("%d", &a[i][j]);
    while (a[i][j] < 1 || a[k][j] > 10) {
      printf("\nWrong degree,1 to N:\n");
      scanf("%d", &a[i][j]);
    }
    j = 0;
    i++;
  }
}


x86 assembly (clang, -O0):
<insert_student>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0xc(%rbp)
xor    %eax,%eax
cmpl   $0x3,-0xc(%rbp)
mov    %al,-0x15(%rbp)
jge    115a <insert_student+0x3a>
cmpl   $0x4,-0x14(%rbp)
setl   %al
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
test   $0x1,%al
jne    116a <insert_student+0x4a>
jmp    14b2 <insert_student+0x392>
mov    -0xc(%rbp),%esi
add    $0x1,%esi
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
movslq -0xc(%rbp),%rax
shl    $0x4,%rax
add    %rax,%rsi
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe95(%rip),%rdi
call   1040 <scanf@plt>
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1236 <insert_student+0x116>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0x14(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x8(%rbp),%rcx
movslq -0x10(%rbp),%rdx
shl    $0x4,%rdx
add    %rdx,%rcx
movslq -0x14(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jne    1228 <insert_student+0x108>
mov    -0xc(%rbp),%esi
add    $0x1,%esi
lea    0xe41(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
movslq -0xc(%rbp),%rax
shl    $0x4,%rax
add    %rax,%rsi
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe16(%rip),%rdi
call   1040 <scanf@plt>
jmp    1231 <insert_student+0x111>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    11ab <insert_student+0x8b>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%esi
add    $0x1,%esi
lea    0xe31(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
movslq -0xc(%rbp),%rax
shl    $0x4,%rax
add    %rax,%rsi
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xdc0(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%rcx
movslq -0xc(%rbp),%rax
shl    $0x4,%rax
add    %rax,%rcx
movslq -0x14(%rbp),%rdx
mov    $0x1,%al
cmpl   $0x12,(%rcx,%rdx,4)
mov    %al,-0x16(%rbp)
jl     12b8 <insert_student+0x198>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0x14(%rbp),%rcx
cmpl   $0x23,(%rax,%rcx,4)
setg   %al
mov    %al,-0x16(%rbp)
mov    -0x16(%rbp),%al
test   $0x1,%al
jne    12c8 <insert_student+0x1a8>
jmp    1307 <insert_student+0x1e7>
mov    -0xc(%rbp),%esi
add    $0x1,%esi
lea    0xdde(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
movslq -0xc(%rbp),%rax
shl    $0x4,%rax
add    %rax,%rsi
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xd37(%rip),%rdi
call   1040 <scanf@plt>
jmp    1279 <insert_student+0x159>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%esi
add    $0x1,%esi
lea    0xdd0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
movslq -0xc(%rbp),%rax
shl    $0x4,%rax
add    %rax,%rsi
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xcef(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%rcx
movslq -0xc(%rbp),%rax
shl    $0x4,%rax
add    %rax,%rcx
movslq -0x14(%rbp),%rdx
mov    $0x1,%al
cmpl   $0x1,(%rcx,%rdx,4)
mov    %al,-0x17(%rbp)
jl     1389 <insert_student+0x269>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0x14(%rbp),%rcx
cmpl   $0x2,(%rax,%rcx,4)
setg   %al
mov    %al,-0x17(%rbp)
mov    -0x17(%rbp),%al
test   $0x1,%al
jne    1399 <insert_student+0x279>
jmp    13d2 <insert_student+0x2b2>
lea    0xd8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
movslq -0xc(%rbp),%rax
shl    $0x4,%rax
add    %rax,%rsi
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xc6c(%rip),%rdi
call   1040 <scanf@plt>
jmp    134a <insert_student+0x22a>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
mov    -0xc(%rbp),%esi
add    $0x1,%esi
lea    0xd6a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
movslq -0xc(%rbp),%rax
shl    $0x4,%rax
add    %rax,%rsi
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xc24(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x8(%rbp),%rcx
movslq -0xc(%rbp),%rax
shl    $0x4,%rax
add    %rax,%rcx
movslq -0x14(%rbp),%rdx
mov    $0x1,%al
cmpl   $0x1,(%rcx,%rdx,4)
mov    %al,-0x18(%rbp)
jl     1454 <insert_student+0x334>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
shl    $0x4,%rcx
add    %rcx,%rax
movslq -0x14(%rbp),%rcx
cmpl   $0xa,(%rax,%rcx,4)
setg   %al
mov    %al,-0x18(%rbp)
mov    -0x18(%rbp),%al
test   $0x1,%al
jne    1464 <insert_student+0x344>
jmp    149d <insert_student+0x37d>
lea    0xd1e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
movslq -0xc(%rbp),%rax
shl    $0x4,%rax
add    %rax,%rsi
movslq -0x14(%rbp),%rax
shl    $0x2,%rax
add    %rax,%rsi
lea    0xba1(%rip),%rdi
call   1040 <scanf@plt>
jmp    1415 <insert_student+0x2f5>
movl   $0x0,-0x14(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1141 <insert_student+0x21>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<insert_student>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xeef(%rip),%r12
lea    0xeeb(%rip),%rbx
xor    %ebp,%ebp
mov    %rdi,(%rsp)
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
lea    0x1(%rbp),%rsi
lea    0xe95(%rip),%rdi
mov    %rsi,0x8(%rsp)
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbp,%rcx
shl    $0x4,%rcx
mov    (%rsp),%rax
mov    %rcx,0x10(%rsp)
lea    (%rax,%rcx,1),%r13
mov    %r12,%rdi
mov    %r13,%rsi
call   1050 <scanf@plt>
mov    (%rsp),%rdx
mov    $0x0,%r14d
test   %rbp,%rbp
je     11f2 <insert_student+0xc2>
xor    %r14d,%r14d
jmp    11bc <insert_student+0x8c>
nopw   0x0(%rax,%rax,1)
add    $0x1,%r14d
movslq %r14d,%r15
cmp    %rbp,%r15
jge    11f2 <insert_student+0xc2>
mov    0x0(%r13),%eax
movslq %r14d,%r15
mov    %r15,%rcx
shl    $0x4,%rcx
cmp    (%rdx,%rcx,1),%eax
jne    11b0 <insert_student+0x80>
mov    %rbx,%rdi
mov    0x8(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %r13,%rsi
call   1050 <scanf@plt>
mov    (%rsp),%rdx
cmp    %rbp,%r15
jl     11bc <insert_student+0x8c>
mov    %rdx,%rbx
lea    0xe81(%rip),%rdi
mov    0x8(%rsp),%r15
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0x10(%rsp),%r13
lea    (%rbx,%r13,1),%rbp
add    $0x4,%rbp
mov    %r12,%rdi
mov    %rbp,%rsi
call   1050 <scanf@plt>
mov    0x4(%rbx,%r13,1),%eax
add    $0xffffffdc,%eax
cmp    $0xffffffed,%eax
lea    0xe7e(%rip),%rbx
ja     1263 <insert_student+0x133>
nopw   0x0(%rax,%rax,1)
mov    %rbx,%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r12,%rdi
mov    %rbp,%rsi
call   1050 <scanf@plt>
mov    0x0(%rbp),%eax
add    $0xffffffdc,%eax
cmp    $0xffffffee,%eax
jb     1240 <insert_student+0x110>
lea    0xe83(%rip),%rdi
mov    %r15d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rsp),%r15
mov    0x10(%rsp),%rbx
lea    (%r15,%rbx,1),%rbp
add    $0x8,%rbp
mov    %r12,%rdi
mov    %rbp,%rsi
call   1050 <scanf@plt>
mov    0x8(%r15,%rbx,1),%eax
add    $0xfffffffd,%eax
cmp    $0xfffffffd,%eax
lea    0xed8(%rip),%rbx
lea    0xebb(%rip),%r15
ja     12ce <insert_student+0x19e>
nopl   0x0(%rax,%rax,1)
mov    %rbx,%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
mov    %rbp,%rsi
call   1050 <scanf@plt>
mov    0x0(%rbp),%eax
add    $0xfffffffd,%eax
cmp    $0xfffffffe,%eax
jb     12b0 <insert_student+0x180>
lea    0xe58(%rip),%rdi
mov    0x8(%rsp),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rsp),%rbx
mov    0x10(%rsp),%rax
lea    (%rbx,%rax,1),%rbp
add    $0xc,%rbp
mov    %r12,%rdi
mov    %rbp,%rsi
call   1050 <scanf@plt>
movslq %r14d,%rax
shl    $0x4,%rax
add    %rax,%rbx
add    $0xc,%rbx
jmp    1323 <insert_student+0x1f3>
nopl   (%rax)
mov    %r15,%rdi
call   1030 <puts@plt>
mov    %r12,%rdi
mov    %rbp,%rsi
call   1050 <scanf@plt>
cmpl   $0x0,0x0(%rbp)
jle    1310 <insert_student+0x1e0>
cmpl   $0xb,(%rbx)
jge    1310 <insert_student+0x1e0>
mov    0x8(%rsp),%rax
mov    %rax,%rbp
cmp    $0x3,%rax
lea    0xcf6(%rip),%rbx
jne    1160 <insert_student+0x30>
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [52 x i8] c"\0AGive the ID, between 0 to 500 ,of the %d student:\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [70 x i8] c"\0AAlready given.Give another ID, between 0 to 500 ,of the %d student:\0A\00"
@.str.3 = [54 x i8] c"\0AGive the age ,between 18 and 35, of the %d student:\0A\00"
@.str.4 = [58 x i8] c"\0AAge out of range, between 18 and 35, of the %d student:\0A\00"
@.str.5 = [64 x i8] c"\0AGive the sex ,1 for male and 2 for female,of the %d student:\0A\00"
@.str.6 = [37 x i8] c"\0AWrong,1 for male and 2 for female:\0A\00"
@.str.7 = [55 x i8] c"\0AGive the degree , between 1 to 10,of the %d student:\0A\00"
@.str.8 = [23 x i8] c"\0AWrong degree,1 to N:\0A\00"
define void @insert_student([4 x i32]* %0) {
%2 = alloca [4 x i32]*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store [4 x i32]* %0, [4 x i32]** %2
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %3
br label %6
6: ; preds = %204, %1
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 3
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = load i32, i32* %5
%11 = icmp slt i32 %10, 4
br label %12
12: ; preds = %9, %6
%13 = phi i1 [ false, %6 ], [ %11, %9 ]
br i1 %13, label %14, label %207
14: ; preds = %12
%15 = load i32, i32* %3
%16 = add nsw i32 %15, 1
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i32 %16)
%18 = load [4 x i32]*, [4 x i32]** %2
%19 = load i32, i32* %3
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [4 x i32], [4 x i32]* %18, i64 %20
%22 = load i32, i32* %5
%23 = sext i32 %22 to i64
%24 = getelementptr inbounds [4 x i32], [4 x i32]* %21, i64 0, i64 %23
%25 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %24)
store i32 0, i32* %4
br label %26
26: ; preds = %63, %14
%27 = load i32, i32* %4
%28 = load i32, i32* %3
%29 = icmp slt i32 %27, %28
br i1 %29, label %30, label %64
30: ; preds = %26
%31 = load [4 x i32]*, [4 x i32]** %2
%32 = load i32, i32* %3
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [4 x i32], [4 x i32]* %31, i64 %33
%35 = load i32, i32* %5
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [4 x i32], [4 x i32]* %34, i64 0, i64 %36
%38 = load i32, i32* %37
%39 = load [4 x i32]*, [4 x i32]** %2
%40 = load i32, i32* %4
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [4 x i32], [4 x i32]* %39, i64 %41
%43 = load i32, i32* %5
%44 = sext i32 %43 to i64
%45 = getelementptr inbounds [4 x i32], [4 x i32]* %42, i64 0, i64 %44
%46 = load i32, i32* %45
%47 = icmp eq i32 %38, %46
br i1 %47, label %48, label %60
48: ; preds = %30
%49 = load i32, i32* %3
%50 = add nsw i32 %49, 1
%51 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str.2, i64 0, i64 0), i32 %50)
%52 = load [4 x i32]*, [4 x i32]** %2
%53 = load i32, i32* %3
%54 = sext i32 %53 to i64
%55 = getelementptr inbounds [4 x i32], [4 x i32]* %52, i64 %54
%56 = load i32, i32* %5
%57 = sext i32 %56 to i64
%58 = getelementptr inbounds [4 x i32], [4 x i32]* %55, i64 0, i64 %57
%59 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %58)
br label %63
60: ; preds = %30
%61 = load i32, i32* %4
%62 = add nsw i32 %61, 1
store i32 %62, i32* %4
br label %63
63: ; preds = %60, %48
br label %26
64: ; preds = %26
%65 = load i32, i32* %5
%66 = add nsw i32 %65, 1
store i32 %66, i32* %5
%67 = load i32, i32* %3
%68 = add nsw i32 %67, 1
%69 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.3, i64 0, i64 0), i32 %68)
%70 = load [4 x i32]*, [4 x i32]** %2
%71 = load i32, i32* %3
%72 = sext i32 %71 to i64
%73 = getelementptr inbounds [4 x i32], [4 x i32]* %70, i64 %72
%74 = load i32, i32* %5
%75 = sext i32 %74 to i64
%76 = getelementptr inbounds [4 x i32], [4 x i32]* %73, i64 0, i64 %75
%77 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %76)
br label %78
78: ; preds = %100, %64
%79 = load [4 x i32]*, [4 x i32]** %2
%80 = load i32, i32* %3
%81 = sext i32 %80 to i64
%82 = getelementptr inbounds [4 x i32], [4 x i32]* %79, i64 %81
%83 = load i32, i32* %5
%84 = sext i32 %83 to i64
%85 = getelementptr inbounds [4 x i32], [4 x i32]* %82, i64 0, i64 %84
%86 = load i32, i32* %85
%87 = icmp slt i32 %86, 18
br i1 %87, label %98, label %88
88: ; preds = %78
%89 = load [4 x i32]*, [4 x i32]** %2
%90 = load i32, i32* %3
%91 = sext i32 %90 to i64
%92 = getelementptr inbounds [4 x i32], [4 x i32]* %89, i64 %91
%93 = load i32, i32* %5
%94 = sext i32 %93 to i64
%95 = getelementptr inbounds [4 x i32], [4 x i32]* %92, i64 0, i64 %94
%96 = load i32, i32* %95
%97 = icmp sgt i32 %96, 35
br label %98
98: ; preds = %88, %78
%99 = phi i1 [ true, %78 ], [ %97, %88 ]
br i1 %99, label %100, label %112
100: ; preds = %98
%101 = load i32, i32* %3
%102 = add nsw i32 %101, 1
%103 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str.4, i64 0, i64 0), i32 %102)
%104 = load [4 x i32]*, [4 x i32]** %2
%105 = load i32, i32* %3
%106 = sext i32 %105 to i64
%107 = getelementptr inbounds [4 x i32], [4 x i32]* %104, i64 %106
%108 = load i32, i32* %5
%109 = sext i32 %108 to i64
%110 = getelementptr inbounds [4 x i32], [4 x i32]* %107, i64 0, i64 %109
%111 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %110)
br label %78
112: ; preds = %98
%113 = load i32, i32* %5
%114 = add nsw i32 %113, 1
store i32 %114, i32* %5
%115 = load i32, i32* %3
%116 = add nsw i32 %115, 1
%117 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([64 x i8], [64 x i8]* @.str.5, i64 0, i64 0), i32 %116)
%118 = load [4 x i32]*, [4 x i32]** %2
%119 = load i32, i32* %3
%120 = sext i32 %119 to i64
%121 = getelementptr inbounds [4 x i32], [4 x i32]* %118, i64 %120
%122 = load i32, i32* %5
%123 = sext i32 %122 to i64
%124 = getelementptr inbounds [4 x i32], [4 x i32]* %121, i64 0, i64 %123
%125 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %124)
br label %126
126: ; preds = %148, %112
%127 = load [4 x i32]*, [4 x i32]** %2
%128 = load i32, i32* %3
%129 = sext i32 %128 to i64
%130 = getelementptr inbounds [4 x i32], [4 x i32]* %127, i64 %129
%131 = load i32, i32* %5
%132 = sext i32 %131 to i64
%133 = getelementptr inbounds [4 x i32], [4 x i32]* %130, i64 0, i64 %132
%134 = load i32, i32* %133
%135 = icmp slt i32 %134, 1
br i1 %135, label %146, label %136
136: ; preds = %126
%137 = load [4 x i32]*, [4 x i32]** %2
%138 = load i32, i32* %3
%139 = sext i32 %138 to i64
%140 = getelementptr inbounds [4 x i32], [4 x i32]* %137, i64 %139
%141 = load i32, i32* %5
%142 = sext i32 %141 to i64
%143 = getelementptr inbounds [4 x i32], [4 x i32]* %140, i64 0, i64 %142
%144 = load i32, i32* %143
%145 = icmp sgt i32 %144, 2
br label %146
146: ; preds = %136, %126
%147 = phi i1 [ true, %126 ], [ %145, %136 ]
br i1 %147, label %148, label %158
148: ; preds = %146
%149 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.6, i64 0, i64 0))
%150 = load [4 x i32]*, [4 x i32]** %2
%151 = load i32, i32* %3
%152 = sext i32 %151 to i64
%153 = getelementptr inbounds [4 x i32], [4 x i32]* %150, i64 %152
%154 = load i32, i32* %5
%155 = sext i32 %154 to i64
%156 = getelementptr inbounds [4 x i32], [4 x i32]* %153, i64 0, i64 %155
%157 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %156)
br label %126
158: ; preds = %146
%159 = load i32, i32* %5
%160 = add nsw i32 %159, 1
store i32 %160, i32* %5
%161 = load i32, i32* %3
%162 = add nsw i32 %161, 1
%163 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([55 x i8], [55 x i8]* @.str.7, i64 0, i64 0), i32 %162)
%164 = load [4 x i32]*, [4 x i32]** %2
%165 = load i32, i32* %3
%166 = sext i32 %165 to i64
%167 = getelementptr inbounds [4 x i32], [4 x i32]* %164, i64 %166
%168 = load i32, i32* %5
%169 = sext i32 %168 to i64
%170 = getelementptr inbounds [4 x i32], [4 x i32]* %167, i64 0, i64 %169
%171 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %170)
br label %172
172: ; preds = %194, %158
%173 = load [4 x i32]*, [4 x i32]** %2
%174 = load i32, i32* %3
%175 = sext i32 %174 to i64
%176 = getelementptr inbounds [4 x i32], [4 x i32]* %173, i64 %175
%177 = load i32, i32* %5
%178 = sext i32 %177 to i64
%179 = getelementptr inbounds [4 x i32], [4 x i32]* %176, i64 0, i64 %178
%180 = load i32, i32* %179
%181 = icmp slt i32 %180, 1
br i1 %181, label %192, label %182
182: ; preds = %172
%183 = load [4 x i32]*, [4 x i32]** %2
%184 = load i32, i32* %4
%185 = sext i32 %184 to i64
%186 = getelementptr inbounds [4 x i32], [4 x i32]* %183, i64 %185
%187 = load i32, i32* %5
%188 = sext i32 %187 to i64
%189 = getelementptr inbounds [4 x i32], [4 x i32]* %186, i64 0, i64 %188
%190 = load i32, i32* %189
%191 = icmp sgt i32 %190, 10
br label %192
192: ; preds = %182, %172
%193 = phi i1 [ true, %172 ], [ %191, %182 ]
br i1 %193, label %194, label %204
194: ; preds = %192
%195 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.8, i64 0, i64 0))
%196 = load [4 x i32]*, [4 x i32]** %2
%197 = load i32, i32* %3
%198 = sext i32 %197 to i64
%199 = getelementptr inbounds [4 x i32], [4 x i32]* %196, i64 %198
%200 = load i32, i32* %5
%201 = sext i32 %200 to i64
%202 = getelementptr inbounds [4 x i32], [4 x i32]* %199, i64 0, i64 %201
%203 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %202)
br label %172
204: ; preds = %192
store i32 0, i32* %5
%205 = load i32, i32* %3
%206 = add nsw i32 %205, 1
store i32 %206, i32* %3
br label %6
207: ; preds = %12
ret void
}

LLVM IR (-O2):
@.str = [52 x i8] c"\0AGive the ID, between 0 to 500 ,of the %d student:\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [70 x i8] c"\0AAlready given.Give another ID, between 0 to 500 ,of the %d student:\0A\00"
@.str.3 = [54 x i8] c"\0AGive the age ,between 18 and 35, of the %d student:\0A\00"
@.str.4 = [58 x i8] c"\0AAge out of range, between 18 and 35, of the %d student:\0A\00"
@.str.5 = [64 x i8] c"\0AGive the sex ,1 for male and 2 for female,of the %d student:\0A\00"
@.str.7 = [55 x i8] c"\0AGive the degree , between 1 to 10,of the %d student:\0A\00"
@str = [22 x i8] c"\0AWrong degree,1 to N:\00"
@str.9 = [36 x i8] c"\0AWrong,1 for male and 2 for female:\00"
define void @insert_student([4 x i32]* %0) {
br label %4
2: ; preds = %65
%3 = icmp eq i64 %6, 3
br i1 %3, label %71, label %4
4: ; preds = %1, %2
%5 = phi i64 [ 0, %1 ], [ %6, %2 ]
%6 = add nuw nsw i64 %5, 1
%7 = trunc i64 %6 to i32
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = getelementptr inbounds [4 x i32], [4 x i32]* %0, i64 %5, i64 0
%10 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %9)
%11 = icmp eq i64 %5, 0
br i1 %11, label %29, label %12
12: ; preds = %4, %25
%13 = phi i32 [ %27, %25 ], [ 0, %4 ]
%14 = load i32, i32* %9
%15 = sext i32 %13 to i64
%16 = getelementptr inbounds [4 x i32], [4 x i32]* %0, i64 %15, i64 0
%17 = load i32, i32* %16
%18 = icmp eq i32 %14, %17
br i1 %18, label %19, label %22
19: ; preds = %12
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([70 x i8], [70 x i8]* @.str.2, i64 0, i64 0), i32 %7)
%21 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %9)
br label %25
22: ; preds = %12
%23 = add nsw i32 %13, 1
%24 = sext i32 %23 to i64
br label %25
25: ; preds = %22, %19
%26 = phi i64 [ %24, %22 ], [ %15, %19 ]
%27 = phi i32 [ %23, %22 ], [ %13, %19 ]
%28 = icmp slt i64 %26, %5
br i1 %28, label %12, label %29
29: ; preds = %25, %4
%30 = phi i32 [ 0, %4 ], [ %27, %25 ]
%31 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str.3, i64 0, i64 0), i32 %7)
%32 = getelementptr inbounds [4 x i32], [4 x i32]* %0, i64 %5, i64 1
%33 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %32)
%34 = load i32, i32* %32
%35 = add i32 %34, -36
%36 = icmp ult i32 %35, -18
br i1 %36, label %37, label %43
37: ; preds = %29, %37
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @.str.4, i64 0, i64 0), i32 %7)
%39 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %32)
%40 = load i32, i32* %32
%41 = add i32 %40, -36
%42 = icmp ult i32 %41, -18
br i1 %42, label %37, label %43
43: ; preds = %37, %29
%44 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([64 x i8], [64 x i8]* @.str.5, i64 0, i64 0), i32 %7)
%45 = getelementptr inbounds [4 x i32], [4 x i32]* %0, i64 %5, i64 2
%46 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %45)
%47 = load i32, i32* %45
%48 = add i32 %47, -3
%49 = icmp ult i32 %48, -2
br i1 %49, label %50, label %56
50: ; preds = %43, %50
%51 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str.9, i64 0, i64 0))
%52 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %45)
%53 = load i32, i32* %45
%54 = add i32 %53, -3
%55 = icmp ult i32 %54, -2
br i1 %55, label %50, label %56
56: ; preds = %50, %43
%57 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([55 x i8], [55 x i8]* @.str.7, i64 0, i64 0), i32 %7)
%58 = getelementptr inbounds [4 x i32], [4 x i32]* %0, i64 %5, i64 3
%59 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %58)
%60 = sext i32 %30 to i64
%61 = getelementptr inbounds [4 x i32], [4 x i32]* %0, i64 %60, i64 3
br label %62
62: ; preds = %68, %56
%63 = load i32, i32* %58
%64 = icmp slt i32 %63, 1
br i1 %64, label %68, label %65
65: ; preds = %62
%66 = load i32, i32* %61
%67 = icmp sgt i32 %66, 10
br i1 %67, label %68, label %2
68: ; preds = %62, %65
%69 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @str, i64 0, i64 0))
%70 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %58)
br label %62
71: ; preds = %2
ret void
}