#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 main() {
  int A[5], b;
  int i, k, flag = 1;
  printf("Enter A: ");
  for (i = 0; i < 5; i++) {
    scanf("%d", &A[i]);
  }
  printf("Enter B: ");
  scanf("%d", &b);
  for (i = 0; i < 5; i++) {
    if (b == A[i]) {
      flag = 0;
    }
  }
  if (flag == 0) {
    printf("%d is saved in array", b);
  } else
    printf(" %d is not saved in array", b);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x1,-0x30(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x28(%rbp)
cmpl   $0x5,-0x28(%rbp)
jge    1177 <main+0x57>
movslq -0x28(%rbp),%rax
lea    -0x20(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xea6(%rip),%rdi
call   1040 <scanf@plt>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    1144 <main+0x24>
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe7e(%rip),%rdi
lea    -0x24(%rbp),%rsi
call   1040 <scanf@plt>
movl   $0x0,-0x28(%rbp)
cmpl   $0x5,-0x28(%rbp)
jge    11d1 <main+0xb1>
mov    -0x24(%rbp),%eax
movslq -0x28(%rbp),%rcx
cmp    -0x20(%rbp,%rcx,4),%eax
jne    11be <main+0x9e>
movl   $0x0,-0x30(%rbp)
jmp    11c3 <main+0xa3>
mov    -0x28(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x28(%rbp)
jmp    119c <main+0x7c>
cmpl   $0x0,-0x30(%rbp)
jne    11f1 <main+0xd1>
mov    -0x24(%rbp),%esi
lea    0xe32(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1202 <main+0xe2>
mov    -0x24(%rbp),%esi
lea    0xe31(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x30,%rsp
lea    0xed4(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed0(%rip),%rbx
lea    0x10(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x14(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x18(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x1c(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0x20(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
lea    0xe8b(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xc(%rsp),%rsi
mov    %rbx,%rdi
call   1040 <scanf@plt>
mov    0xc(%rsp),%esi
cmp    0x10(%rsp),%esi
movdqu 0x14(%rsp),%xmm0
movd   %esi,%xmm1
pshufd $0x0,%xmm1,%xmm1
pcmpeqd %xmm0,%xmm1
pslld  $0x1f,%xmm1
lea    0xe5a(%rip),%rax
lea    0xe68(%rip),%rdi
cmove  %rax,%rdi
movmskps %xmm1,%ecx
test   %ecx,%ecx
cmovne %rax,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x30,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"Enter A: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [10 x i8] c"Enter B: \00"
@.str.3 = [21 x i8] c"%d is saved in array\00"
@.str.4 = [26 x i8] c" %d is not saved in array\00"
define void @main() {
%1 = alloca [5 x i32]
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 1, i32* %5
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %7
7: ; preds = %15, %0
%8 = load i32, i32* %3
%9 = icmp slt i32 %8, 5
br i1 %9, label %10, label %18
10: ; preds = %7
%11 = load i32, i32* %3
%12 = sext i32 %11 to i64
%13 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 %12
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %13)
br label %15
15: ; preds = %10
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
br label %7
18: ; preds = %7
%19 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%20 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
store i32 0, i32* %3
br label %21
21: ; preds = %33, %18
%22 = load i32, i32* %3
%23 = icmp slt i32 %22, 5
br i1 %23, label %24, label %36
24: ; preds = %21
%25 = load i32, i32* %2
%26 = load i32, i32* %3
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 %27
%29 = load i32, i32* %28
%30 = icmp eq i32 %25, %29
br i1 %30, label %31, label %32
31: ; preds = %24
store i32 0, i32* %5
br label %32
32: ; preds = %31, %24
br label %33
33: ; preds = %32
%34 = load i32, i32* %3
%35 = add nsw i32 %34, 1
store i32 %35, i32* %3
br label %21
36: ; preds = %21
%37 = load i32, i32* %5
%38 = icmp eq i32 %37, 0
br i1 %38, label %39, label %42
39: ; preds = %36
%40 = load i32, i32* %2
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %40)
br label %45
42: ; preds = %36
%43 = load i32, i32* %2
%44 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0), i32 %43)
br label %45
45: ; preds = %42, %39
ret void
}

LLVM IR (-O2):
@.str = [10 x i8] c"Enter A: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [10 x i8] c"Enter B: \00"
@.str.3 = [21 x i8] c"%d is saved in array\00"
@.str.4 = [26 x i8] c" %d is not saved in array\00"
define void @main() {
%1 = alloca [5 x i32]
%2 = alloca i32
%3 = bitcast [5 x i32]* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%7 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%8 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 1
%9 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %8)
%10 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 2
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %10)
%12 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 3
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %12)
%14 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 4
%15 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %14)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0))
%17 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%18 = load i32, i32* %2
%19 = load i32, i32* %6
%20 = icmp eq i32 %18, %19
%21 = bitcast i32* %8 to <4 x i32>*
%22 = load <4 x i32>, <4 x i32>* %21
%23 = insertelement <4 x i32> poison, i32 %18, i64 0
%24 = shufflevector <4 x i32> %23, <4 x i32> poison, <4 x i32> zeroinitializer
%25 = icmp eq <4 x i32> %24, %22
%26 = freeze <4 x i1> %25
%27 = bitcast <4 x i1> %26 to i4
%28 = icmp ne i4 %27, 0
%29 = select i1 %28, i1 true, i1 %20
%30 = select i1 %29, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.4, i64 0, i64 0)
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %30, i32 %18)
ret void
}