#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 receiver(int *, int, int);
int /*<<< orphan*/ scanf(char *, int *);
int sender(int *, int);
int main() {
  int a[10], i, m, scheck, rcheck;
  printf("\nENTER SIZE OF THE STRING:");
  scanf("%d", &m);
  printf("\nENTER THE ELEMENTS OF THE ARRAY:");
  for (i = 0; i < m; i++)
    scanf("%d", &a[i]);
  scheck = sender(a, m);
  rcheck = receiver(a, m, scheck);
  if (rcheck == 0)
    printf("\n\nNO ERROR IN TRANSMISSION\n\n");
  else
    printf("\n\nERROR DETECTED");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeaa(%rip),%rdi
call   1030 <printf@plt>
lea    0xeb9(%rip),%rdi
lea    -0x38(%rbp),%rsi
call   1050 <scanf@plt>
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
movl   $0x0,-0x34(%rbp)
mov    -0x34(%rbp),%eax
cmp    -0x38(%rbp),%eax
jge    11b3 <main+0x73>
movslq -0x34(%rbp),%rax
lea    -0x30(%rbp),%rsi
shl    $0x2,%rax
add    %rax,%rsi
lea    0xe7b(%rip),%rdi
call   1050 <scanf@plt>
mov    -0x34(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x34(%rbp)
jmp    117e <main+0x3e>
lea    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%esi
call   1060 <sender@plt>
mov    %eax,-0x3c(%rbp)
lea    -0x30(%rbp),%rdi
mov    -0x38(%rbp),%esi
mov    -0x3c(%rbp),%edx
call   1040 <receiver@plt>
mov    %eax,-0x40(%rbp)
cmpl   $0x0,-0x40(%rbp)
jne    11ef <main+0xaf>
lea    0xe5b(%rip),%rdi
call   1030 <printf@plt>
jmp    11fb <main+0xbb>
lea    0xe67(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x40,%rsp
lea    0xea0(%rip),%rdi
call   1040 <printf@plt>
lea    0xeaf(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1060 <scanf@plt>
lea    0xea1(%rip),%rdi
call   1040 <printf@plt>
mov    0xc(%rsp),%esi
test   %esi,%esi
jle    11bd <main+0x6d>
lea    0x10(%rsp),%r15
xor    %ebx,%ebx
lea    0xe83(%rip),%r14
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %r15,%rsi
call   1060 <scanf@plt>
add    $0x1,%rbx
movslq 0xc(%rsp),%rsi
add    $0x4,%r15
cmp    %rsi,%rbx
jl     11a0 <main+0x50>
lea    0x10(%rsp),%rbx
mov    %rbx,%rdi
call   1070 <sender@plt>
mov    0xc(%rsp),%esi
mov    %rbx,%rdi
mov    %eax,%edx
call   1050 <receiver@plt>
test   %eax,%eax
je     11ea <main+0x9a>
lea    0xe5d(%rip),%rdi
call   1040 <printf@plt>
jmp    11f6 <main+0xa6>
lea    0xe60(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [27 x i8] c"\0AENTER SIZE OF THE STRING:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [34 x i8] c"\0AENTER THE ELEMENTS OF THE ARRAY:\00"
@.str.3 = [29 x i8] c"\0A\0ANO ERROR IN TRANSMISSION\0A\0A\00"
@.str.4 = [17 x i8] c"\0A\0AERROR DETECTED\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
%7 = call i32 @printf(i8* getelementptr inbounds ([27 x i8], [27 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* %4)
%9 = call i32 @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %3
br label %10
10: ; preds = %19, %0
%11 = load i32, i32* %3
%12 = load i32, i32* %4
%13 = icmp slt i32 %11, %12
br i1 %13, label %14, label %22
14: ; preds = %10
%15 = load i32, i32* %3
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 %16
%18 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %17)
br label %19
19: ; preds = %14
%20 = load i32, i32* %3
%21 = add nsw i32 %20, 1
store i32 %21, i32* %3
br label %10
22: ; preds = %10
%23 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%24 = load i32, i32* %4
%25 = call i32 @sender(i32* %23, i32 %24)
store i32 %25, i32* %5
%26 = getelementptr inbounds [10 x i32], [10 x i32]* %2, i64 0, i64 0
%27 = load i32, i32* %4
%28 = load i32, i32* %5
%29 = call i32 @receiver(i32* %26, i32 %27, i32 %28)
store i32 %29, i32* %6
%30 = load i32, i32* %6
%31 = icmp eq i32 %30, 0
br i1 %31, label %32, label %34
32: ; preds = %22
%33 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.3, i64 0, i64 0))
br label %36
34: ; preds = %22
%35 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
br label %36
36: ; preds = %34, %32
%37 = load i32, i32* %1
ret i32 %37
}

LLVM IR (-O2):
@.str = [27 x i8] c"\0AENTER SIZE OF THE STRING:\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [34 x i8] c"\0AENTER THE ELEMENTS OF THE ARRAY:\00"
@.str.4 = [17 x i8] c"\0A\0AERROR DETECTED\00"
@str = [28 x i8] c"\0A\0ANO ERROR IN TRANSMISSION\0A\00"
define i32 @main() {
%1 = alloca [10 x i32]
%2 = alloca i32
%3 = bitcast [10 x i32]* %1 to i8*
%4 = bitcast i32* %2 to i8*
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 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* %2)
%7 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.2, i64 0, i64 0))
%8 = load i32, i32* %2
%9 = icmp sgt i32 %8, 0
br i1 %9, label %10, label %18
10: ; preds = %0, %10
%11 = phi i64 [ %14, %10 ], [ 0, %0 ]
%12 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 %11
%13 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %12)
%14 = add nuw nsw i64 %11, 1
%15 = load i32, i32* %2
%16 = sext i32 %15 to i64
%17 = icmp slt i64 %14, %16
br i1 %17, label %10, label %18
18: ; preds = %10, %0
%19 = phi i32 [ %8, %0 ], [ %15, %10 ]
%20 = getelementptr inbounds [10 x i32], [10 x i32]* %1, i64 0, i64 0
%21 = call i32 @sender(i32* %20, i32 %19)
%22 = load i32, i32* %2
%23 = call i32 @receiver(i32* %20, i32 %22, i32 %21)
%24 = icmp eq i32 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %18
%26 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
br label %29
27: ; preds = %18
%28 = call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.4, i64 0, i64 0))
br label %29
29: ; preds = %27, %25
ret i32 0
}