#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(int *b, int n) {
  if (n >= 1) {
    printf("Insert Element at 2nd Position: ");
    scanf("%d", b + 1);
  }
  if (n >= 4) {
    printf("Insert Element at 5th Position: ");
    scanf("%d", b + 4);
  }
}


x86 assembly (clang, -O0):
<insert>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
cmpl   $0x1,-0xc(%rbp)
jl     1159 <insert+0x39>
lea    0xec0(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
add    $0x4,%rsi
lea    0xecd(%rip),%rdi
call   1040 <scanf@plt>
cmpl   $0x4,-0xc(%rbp)
jl     1183 <insert+0x63>
lea    0xeba(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%rsi
add    $0x10,%rsi
lea    0xea3(%rip),%rdi
call   1040 <scanf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<insert>:
push   %rbp
push   %rbx
push   %rax
test   %esi,%esi
jle    1172 <insert+0x52>
mov    %esi,%ebp
mov    %rdi,%rbx
lea    0xecd(%rip),%rdi
call   1030 <printf@plt>
lea    0x4(%rbx),%rsi
lea    0xede(%rip),%rdi
call   1040 <scanf@plt>
cmp    $0x4,%ebp
jb     1172 <insert+0x52>
lea    0xed0(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rbx
lea    0xebd(%rip),%rdi
mov    %rbx,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <scanf@plt>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [33 x i8] c"Insert Element at 2nd Position: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [33 x i8] c"Insert Element at 5th Position: \00"
define void @insert(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = icmp sge i32 %5, 1
br i1 %6, label %7, label %12
7: ; preds = %2
%8 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%9 = load i32*, i32** %3
%10 = getelementptr inbounds i32, i32* %9, i64 1
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %10)
br label %12
12: ; preds = %7, %2
%13 = load i32, i32* %4
%14 = icmp sge i32 %13, 4
br i1 %14, label %15, label %20
15: ; preds = %12
%16 = call i32 @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
%17 = load i32*, i32** %3
%18 = getelementptr inbounds i32, i32* %17, i64 4
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %18)
br label %20
20: ; preds = %15, %12
ret void
}

LLVM IR (-O2):
@.str = [33 x i8] c"Insert Element at 2nd Position: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [33 x i8] c"Insert Element at 5th Position: \00"
define void @insert(i32* %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %13
4: ; preds = %2
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds i32, i32* %0, i64 1
%7 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%8 = icmp ugt i32 %1, 3
br i1 %8, label %9, label %13
9: ; preds = %4
%10 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
%11 = getelementptr inbounds i32, i32* %0, i64 4
%12 = tail call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %11)
br label %13
13: ; preds = %2, %9, %4
ret void
}