#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 iscommon(int *, int *, int, int);
int /*<<< orphan*/ printf(char *);
void main(void) {
  int a[5] = {1, 2, 3, 4, 5};
  int b[5] = {10, 6, 4, 9};
  int test = iscommon(a, b, 5, 4);
  if (test == 1)
    printf("Have a common element\n");
  else
    printf("No common element\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xecc(%rip),%eax
mov    %eax,-0x10(%rbp)
mov    0xed2(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xecf(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xecd(%rip),%eax
mov    %eax,-0x30(%rbp)
lea    -0x20(%rbp),%rdi
lea    -0x40(%rbp),%rsi
mov    $0x5,%edx
mov    $0x4,%ecx
call   1040 <iscommon@plt>
mov    %eax,-0x44(%rbp)
cmpl   $0x1,-0x44(%rbp)
jne    119b <main+0x7b>
lea    0xea3(%rip),%rdi
call   1030 <printf@plt>
jmp    11a7 <main+0x87>
lea    0xea9(%rip),%rdi
call   1030 <printf@plt>
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x38,%rsp
mov    0xee6(%rip),%eax
mov    %eax,0x30(%rsp)
movaps 0xecb(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
mov    0xef0(%rip),%eax
mov    %eax,0x10(%rsp)
movaps 0xed5(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x20(%rsp),%rdi
mov    %rsp,%rsi
mov    $0x5,%edx
mov    $0x4,%ecx
call   1040 <iscommon@plt>
cmp    $0x1,%eax
lea    0xed6(%rip),%rax
lea    0xebd(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
add    $0x38,%rsp
ret

LLVM IR (-O0):
@__const.main.a = [5 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5]
@__const.main.b = [5 x i32] [i32 10, i32 6, i32 4, i32 9, i32 0]
@.str = [23 x i8] c"Have a common element\0A\00"
@.str.1 = [19 x i8] c"No common element\0A\00"
define void @main() {
%1 = alloca [5 x i32]
%2 = alloca [5 x i32]
%3 = alloca i32
%4 = bitcast [5 x i32]* %1 to i8*
%5 = bitcast [5 x i32]* %2 to i8*
%6 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%7 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%8 = call i32 @iscommon(i32* %6, i32* %7, i32 5, i32 4)
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = icmp eq i32 %9, 1
br i1 %10, label %11, label %13
11: ; preds = %0
%12 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
br label %15
13: ; preds = %0
%14 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
br label %15
15: ; preds = %13, %11
ret void
}

LLVM IR (-O2):
@__const.main.a = [5 x i32] [i32 1, i32 2, i32 3, i32 4, i32 5]
@__const.main.b = [5 x i32] [i32 10, i32 6, i32 4, i32 9, i32 0]
@str = [18 x i8] c"No common element\00"
@str.2 = [22 x i8] c"Have a common element\00"
define void @main() {
%1 = alloca [5 x i32]
%2 = alloca [5 x i32]
%3 = bitcast [5 x i32]* %1 to i8*
%4 = bitcast [5 x i32]* %2 to i8*
%5 = getelementptr inbounds [5 x i32], [5 x i32]* %1, i64 0, i64 0
%6 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%7 = call i32 @iscommon(i32* %5, i32* %6, i32 5, i32 4)
%8 = icmp eq i32 %7, 1
%9 = select i1 %8, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @str.2, i64 0, i64 0), i8* getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0)
%10 = call i32 @puts(i8* dereferenceable(1) %9)
ret void
}