#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 oddElms(int nums[]) {
  int i, odd = 0;
  for (i = 0; i < 5; i++) {
    printf("\nElement %d: %d ", i + 1, nums[i]);
    if (nums[i] % 2 == 0) {
      printf("is even\n");
    } else {
      printf("is odd\n");
      odd++;
    }
  }
  return odd;
}


x86 assembly (clang, -O0):
<oddElms>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0x5,-0xc(%rbp)
jge    11ac <oddElms+0x9c>
mov    -0xc(%rbp),%esi
add    $0x1,%esi
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%edx
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1182 <oddElms+0x72>
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1199 <oddElms+0x89>
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    119e <oddElms+0x8e>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    112a <oddElms+0x1a>
mov    -0x10(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<oddElms>:
push   %rbp
push   %r14
push   %rbx
mov    %rdi,%rbx
mov    (%rdi),%edx
lea    0xed0(%rip),%r14
mov    %r14,%rdi
mov    $0x1,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    (%rbx),%ebp
test   $0x1,%bpl
lea    0xecc(%rip),%rax
lea    0xebe(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
mov    0x4(%rbx),%edx
mov    %r14,%rdi
mov    $0x2,%esi
xor    %eax,%eax
call   1040 <printf@plt>
testb  $0x1,0x4(%rbx)
jne    1185 <oddElms+0x65>
and    $0x1,%ebp
lea    0xe9a(%rip),%rdi
call   1030 <puts@plt>
jmp    1197 <oddElms+0x77>
and    $0x1,%ebp
lea    0xe82(%rip),%rdi
call   1030 <puts@plt>
add    $0x1,%ebp
mov    0x8(%rbx),%edx
lea    0xe5f(%rip),%rdi
mov    $0x3,%esi
xor    %eax,%eax
call   1040 <printf@plt>
testb  $0x1,0x8(%rbx)
jne    11c1 <oddElms+0xa1>
lea    0xe5e(%rip),%rdi
call   1030 <puts@plt>
jmp    11d0 <oddElms+0xb0>
lea    0xe49(%rip),%rdi
call   1030 <puts@plt>
add    $0x1,%ebp
mov    0xc(%rbx),%edx
lea    0xe26(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
call   1040 <printf@plt>
testb  $0x1,0xc(%rbx)
jne    11fa <oddElms+0xda>
lea    0xe25(%rip),%rdi
call   1030 <puts@plt>
jmp    1209 <oddElms+0xe9>
lea    0xe10(%rip),%rdi
call   1030 <puts@plt>
add    $0x1,%ebp
mov    0x10(%rbx),%edx
lea    0xded(%rip),%rdi
mov    $0x5,%esi
xor    %eax,%eax
call   1040 <printf@plt>
testb  $0x1,0x10(%rbx)
jne    1233 <oddElms+0x113>
lea    0xdec(%rip),%rdi
call   1030 <puts@plt>
jmp    1242 <oddElms+0x122>
lea    0xdd7(%rip),%rdi
call   1030 <puts@plt>
add    $0x1,%ebp
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [17 x i8] c"\0AElement %d: %d \00"
@.str.1 = [9 x i8] c"is even\0A\00"
@.str.2 = [8 x i8] c"is odd\0A\00"
define i32 @oddElms(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
store i32* %0, i32** %2
store i32 0, i32* %4
store i32 0, i32* %3
br label %5
5: ; preds = %31, %1
%6 = load i32, i32* %3
%7 = icmp slt i32 %6, 5
br i1 %7, label %8, label %34
8: ; preds = %5
%9 = load i32, i32* %3
%10 = add nsw i32 %9, 1
%11 = load i32*, i32** %2
%12 = load i32, i32* %3
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i32, i32* %11, i64 %13
%15 = load i32, i32* %14
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %10, i32 %15)
%17 = load i32*, i32** %2
%18 = load i32, i32* %3
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds i32, i32* %17, i64 %19
%21 = load i32, i32* %20
%22 = srem i32 %21, 2
%23 = icmp eq i32 %22, 0
br i1 %23, label %24, label %26
24: ; preds = %8
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0))
br label %30
26: ; preds = %8
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
%28 = load i32, i32* %4
%29 = add nsw i32 %28, 1
store i32 %29, i32* %4
br label %30
30: ; preds = %26, %24
br label %31
31: ; preds = %30
%32 = load i32, i32* %3
%33 = add nsw i32 %32, 1
store i32 %33, i32* %3
br label %5
34: ; preds = %5
%35 = load i32, i32* %4
ret i32 %35
}

LLVM IR (-O2):
@.str = [17 x i8] c"\0AElement %d: %d \00"
@str = [7 x i8] c"is odd\00"
@str.3 = [8 x i8] c"is even\00"
define i32 @oddElms(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 1, i32 %2)
%4 = load i32, i32* %0
%5 = and i32 %4, 1
%6 = icmp eq i32 %5, 0
%7 = select i1 %6, i8* getelementptr inbounds ([8 x i8], [8 x i8]* @str.3, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0)
%8 = tail call i32 @puts(i8* dereferenceable(1) %7)
%9 = getelementptr inbounds i32, i32* %0, i64 1
%10 = load i32, i32* %9
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 2, i32 %10)
%12 = load i32, i32* %9
%13 = and i32 %12, 1
%14 = icmp eq i32 %13, 0
br i1 %14, label %18, label %15
15: ; preds = %1
%16 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%17 = select i1 %6, i32 1, i32 2
br label %22
18: ; preds = %1
%19 = xor i1 %6, true
%20 = zext i1 %19 to i32
%21 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.3, i64 0, i64 0))
br label %22
22: ; preds = %18, %15
%23 = phi i32 [ %20, %18 ], [ %17, %15 ]
%24 = getelementptr inbounds i32, i32* %0, i64 2
%25 = load i32, i32* %24
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 3, i32 %25)
%27 = load i32, i32* %24
%28 = and i32 %27, 1
%29 = icmp eq i32 %28, 0
br i1 %29, label %33, label %30
30: ; preds = %22
%31 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%32 = add nuw nsw i32 %23, 1
br label %35
33: ; preds = %22
%34 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.3, i64 0, i64 0))
br label %35
35: ; preds = %33, %30
%36 = phi i32 [ %23, %33 ], [ %32, %30 ]
%37 = getelementptr inbounds i32, i32* %0, i64 3
%38 = load i32, i32* %37
%39 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 4, i32 %38)
%40 = load i32, i32* %37
%41 = and i32 %40, 1
%42 = icmp eq i32 %41, 0
br i1 %42, label %46, label %43
43: ; preds = %35
%44 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%45 = add nuw nsw i32 %36, 1
br label %48
46: ; preds = %35
%47 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.3, i64 0, i64 0))
br label %48
48: ; preds = %46, %43
%49 = phi i32 [ %36, %46 ], [ %45, %43 ]
%50 = getelementptr inbounds i32, i32* %0, i64 4
%51 = load i32, i32* %50
%52 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 5, i32 %51)
%53 = load i32, i32* %50
%54 = and i32 %53, 1
%55 = icmp eq i32 %54, 0
br i1 %55, label %59, label %56
56: ; preds = %48
%57 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0))
%58 = add nuw nsw i32 %49, 1
br label %61
59: ; preds = %48
%60 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([8 x i8], [8 x i8]* @str.3, i64 0, i64 0))
br label %61
61: ; preds = %59, %56
%62 = phi i32 [ %49, %59 ], [ %58, %56 ]
ret i32 %62
}