#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 elem(int, int *);
int notelem(int, int *);
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int myarray[5] = {2, 3, 5, 7, 11};
  int myarray2[5] = {4, 6, 8, 10, 12};
  printf("Result is %d \n", elem(5, myarray));
  printf("Result is %d \n", elem(5, myarray2));
  printf("Result is %d \n", notelem(5, myarray));
  printf("Result is %d \n", notelem(5, myarray2));
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xeba(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xeb7(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xeb5(%rip),%eax
mov    %eax,-0x10(%rbp)
mov    0xebb(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xeb8(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xeb6(%rip),%eax
mov    %eax,-0x30(%rbp)
lea    -0x20(%rbp),%rsi
mov    $0x5,%edi
call   1050 <elem@plt>
mov    %eax,%esi
lea    0xea0(%rip),%rdi
call   1030 <printf@plt>
lea    -0x40(%rbp),%rsi
mov    $0x5,%edi
call   1050 <elem@plt>
mov    %eax,%esi
lea    0xe84(%rip),%rdi
call   1030 <printf@plt>
lea    -0x20(%rbp),%rsi
mov    $0x5,%edi
call   1040 <notelem@plt>
mov    %eax,%esi
lea    0xe68(%rip),%rdi
call   1030 <printf@plt>
lea    -0x40(%rbp),%rsi
mov    $0x5,%edi
call   1040 <notelem@plt>
mov    %eax,%esi
lea    0xe4c(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x40,%rsp
mov    0xed1(%rip),%eax
mov    %eax,0x30(%rsp)
movaps 0xeb6(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
mov    0xedb(%rip),%eax
mov    %eax,0x10(%rsp)
movaps 0xec0(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0x20(%rsp),%r14
mov    $0x5,%edi
mov    %r14,%rsi
call   1050 <elem@plt>
lea    0xeb7(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    %rsp,%r15
mov    $0x5,%edi
mov    %r15,%rsi
call   1050 <elem@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0x5,%edi
mov    %r14,%rsi
call   1040 <notelem@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
mov    $0x5,%edi
mov    %r15,%rsi
call   1040 <notelem@plt>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@__const.main.myarray = [5 x i32] [i32 2, i32 3, i32 5, i32 7, i32 11]
@__const.main.myarray2 = [5 x i32] [i32 4, i32 6, i32 8, i32 10, i32 12]
@.str = [15 x i8] c"Result is %d \0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i32]
%3 = alloca [5 x i32]
store i32 0, i32* %1
%4 = bitcast [5 x i32]* %2 to i8*
%5 = bitcast [5 x i32]* %3 to i8*
%6 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%7 = call i32 @elem(i32 5, i32* %6)
%8 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
%10 = call i32 @elem(i32 5, i32* %9)
%11 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%13 = call i32 @notelem(i32 5, i32* %12)
%14 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %13)
%15 = getelementptr inbounds [5 x i32], [5 x i32]* %3, i64 0, i64 0
%16 = call i32 @notelem(i32 5, i32* %15)
%17 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %16)
ret i32 0
}

LLVM IR (-O2):
@__const.main.myarray = [5 x i32] [i32 2, i32 3, i32 5, i32 7, i32 11]
@__const.main.myarray2 = [5 x i32] [i32 4, i32 6, i32 8, i32 10, i32 12]
@.str = [15 x i8] c"Result is %d \0A\00"
define i32 @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 = call i32 @elem(i32 5, i32* %5)
%7 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = getelementptr inbounds [5 x i32], [5 x i32]* %2, i64 0, i64 0
%9 = call i32 @elem(i32 5, i32* %8)
%10 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %9)
%11 = call i32 @notelem(i32 5, i32* %5)
%12 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %11)
%13 = call i32 @notelem(i32 5, i32* %8)
%14 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0), i32 %13)
ret i32 0
}