#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 emptyBlocks(int fatSize, unsigned short *fat) {
  int i, flag = 0;
  for (i = 3; i < fatSize; i++) {
    if (fat[i] == 0 && flag == 0) {
      printf("LIVRE %d", i);
      flag = 1;
    } else if (fat[i] == 0 && flag > 0) {
      printf(", %d", i);
    }
  }
  printf("\n");
  return 1;
}


x86 assembly (clang, -O0):
<emptyBlocks>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x18(%rbp)
movl   $0x3,-0x14(%rbp)
mov    -0x14(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    11bd <emptyBlocks+0xad>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movzwl (%rax,%rcx,2),%eax
cmp    $0x0,%eax
jne    1175 <emptyBlocks+0x65>
cmpl   $0x0,-0x18(%rbp)
jne    1175 <emptyBlocks+0x65>
mov    -0x14(%rbp),%esi
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x18(%rbp)
jmp    11aa <emptyBlocks+0x9a>
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
movzwl (%rax,%rcx,2),%eax
cmp    $0x0,%eax
jne    11a5 <emptyBlocks+0x95>
cmpl   $0x0,-0x18(%rbp)
jle    11a5 <emptyBlocks+0x95>
mov    -0x14(%rbp),%esi
lea    0xe6b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11aa <emptyBlocks+0x9a>
jmp    11af <emptyBlocks+0x9f>
mov    -0x14(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x14(%rbp)
jmp    112d <emptyBlocks+0x1d>
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<emptyBlocks>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
cmp    $0x4,%edi
jl     1186 <emptyBlocks+0x66>
mov    %rsi,%r14
mov    %edi,%r15d
mov    $0x3,%ebx
lea    0xec0(%rip),%r12
lea    0xec2(%rip),%r13
xor    %eax,%eax
jmp    1167 <emptyBlocks+0x47>
nopl   0x0(%rax,%rax,1)
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%eax
add    $0x1,%rbx
cmp    %rbx,%r15
je     1186 <emptyBlocks+0x66>
movzwl (%r14,%rbx,2),%ecx
test   %cx,%cx
jne    1178 <emptyBlocks+0x58>
mov    %r12,%rdi
test   %eax,%eax
je     1150 <emptyBlocks+0x30>
test   %cx,%cx
jne    115e <emptyBlocks+0x3e>
mov    %r13,%rdi
test   %eax,%eax
jg     1150 <emptyBlocks+0x30>
jmp    115e <emptyBlocks+0x3e>
mov    $0xa,%edi
call   1030 <putchar@plt>
mov    $0x1,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
@.str = [9 x i8] c"LIVRE %d\00"
@.str.1 = [5 x i8] c", %d\00"
define i32 @emptyBlocks(i32 %0, i16* nocapture %1) {
%3 = icmp sgt i32 %0, 3
br i1 %3, label %4, label %25
4: ; preds = %2
%5 = zext i32 %0 to i64
br label %6
6: ; preds = %4, %21
%7 = phi i64 [ 3, %4 ], [ %23, %21 ]
%8 = phi i32 [ 0, %4 ], [ %22, %21 ]
%9 = getelementptr inbounds i16, i16* %1, i64 %7
%10 = load i16, i16* %9
%11 = icmp eq i16 %10, 0
%12 = icmp eq i32 %8, 0
%13 = select i1 %11, i1 %12, i1 false
br i1 %13, label %17, label %14
14: ; preds = %6
%15 = icmp sgt i32 %8, 0
%16 = select i1 %11, i1 %15, i1 false
br i1 %16, label %17, label %21
17: ; preds = %14, %6
%18 = phi i8* [ getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), %6 ], [ getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), %14 ]
%19 = trunc i64 %7 to i32
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %18, i32 %19)
br label %21
21: ; preds = %17, %14
%22 = phi i32 [ %8, %14 ], [ 1, %17 ]
%23 = add nuw nsw i64 %7, 1
%24 = icmp eq i64 %23, %5
br i1 %24, label %25, label %6
25: ; preds = %21, %2
%26 = tail call i32 @putchar(i32 10)
ret i32 1
}