#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 *);
void jollycheck(int a[], int len) {
  int i, temp = 0;
  for (i = 1; i < len; i++) {
    if (a[i] == 0) {
      printf("Not jolly\n");
      temp = 1;
      break;
    }
  }
  if (temp == 0)
    printf("Jolly\n");
}


x86 assembly (clang, -O0):
<jollycheck>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x1,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1176 <jollycheck+0x66>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
cmpl   $0x0,(%rax,%rcx,4)
jne    1163 <jollycheck+0x53>
lea    0xeae(%rip),%rdi
call   1030 <printf@plt>
movl   $0x1,-0x14(%rbp)
jmp    1176 <jollycheck+0x66>
jmp    1168 <jollycheck+0x58>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    112d <jollycheck+0x1d>
cmpl   $0x0,-0x14(%rbp)
jne    118c <jollycheck+0x7c>
lea    0xe84(%rip),%rdi
call   1030 <printf@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<jollycheck>:
mov    %rdi,%rax
lea    0xee6(%rip),%rdi
cmp    $0x2,%esi
jl     113f <jollycheck+0x2f>
mov    %esi,%ecx
mov    $0x1,%esi
lea    0xed9(%rip),%rdx
nopl   (%rax)
cmpl   $0x0,(%rax,%rsi,4)
je     1144 <jollycheck+0x34>
add    $0x1,%rsi
cmp    %rsi,%rcx
jne    1130 <jollycheck+0x20>
jmp    1030 <puts@plt>
mov    %rdx,%rdi
jmp    1030 <puts@plt>

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

LLVM IR (-O2):
@str = [6 x i8] c"Jolly\00"
@str.2 = [10 x i8] c"Not jolly\00"
define void @jollycheck(i32* nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 1
br i1 %3, label %4, label %14
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %8
6: ; preds = %8
%7 = icmp eq i64 %13, %5
br i1 %7, label %14, label %8
8: ; preds = %4, %6
%9 = phi i64 [ 1, %4 ], [ %13, %6 ]
%10 = getelementptr inbounds i32, i32* %0, i64 %9
%11 = load i32, i32* %10
%12 = icmp eq i32 %11, 0
%13 = add nuw nsw i64 %9, 1
br i1 %12, label %14, label %6
14: ; preds = %6, %8, %2
%15 = phi i8* [ getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0), %2 ], [ getelementptr inbounds ([10 x i8], [10 x i8]* @str.2, i64 0, i64 0), %8 ], [ getelementptr inbounds ([6 x i8], [6 x i8]* @str, i64 0, i64 0), %6 ]
%16 = tail call i32 @puts(i8* dereferenceable(1) %15)
ret void
}