#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 print_available_cores(int cores) {
  printf("Active cores are: ");
  int i;
  for (i = 0; i < cores; i++) {
    if (i == cores - 1)
      printf("%d\n", i);
    else
      printf("%d, ", i);
  }
}


x86 assembly (clang, -O0):
<print_available_cores>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xede(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jge    1187 <print_available_cores+0x77>
mov    -0x8(%rbp),%eax
mov    -0x4(%rbp),%ecx
sub    $0x1,%ecx
cmp    %ecx,%eax
jne    1163 <print_available_cores+0x53>
mov    -0x8(%rbp),%esi
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1174 <print_available_cores+0x64>
mov    -0x8(%rbp),%esi
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1179 <print_available_cores+0x69>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1130 <print_available_cores+0x20>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_available_cores>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %edi,%ebx
lea    0xedf(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
test   %ebx,%ebx
jle    1175 <print_available_cores+0x65>
lea    -0x1(%rbx),%r12d
neg    %ebx
lea    0xeda(%rip),%r14
lea    0xed7(%rip),%r15
xor    %ebp,%ebp
jmp    1165 <print_available_cores+0x55>
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r15,%rdi
mov    %ebp,%esi
xor    %eax,%eax
call   1030 <printf@plt>
add    $0x1,%ebp
mov    %ebx,%eax
add    %ebp,%eax
je     1175 <print_available_cores+0x65>
lea    (%rbx,%rbp,1),%eax
cmp    $0xffffffff,%eax
jne    1150 <print_available_cores+0x40>
mov    %r14,%rdi
mov    %r12d,%esi
jmp    1155 <print_available_cores+0x45>
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

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

LLVM IR (-O2):
@.str = [19 x i8] c"Active cores are: \00"
@.str.1 = [4 x i8] c"%d\0A\00"
@.str.2 = [5 x i8] c"%d, \00"
define void @print_available_cores(i32 %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
%3 = icmp sgt i32 %0, 0
br i1 %3, label %4, label %16
4: ; preds = %1
%5 = add nsw i32 %0, -1
br label %6
6: ; preds = %4, %13
%7 = phi i32 [ 0, %4 ], [ %14, %13 ]
%8 = icmp eq i32 %7, %5
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %5)
br label %13
11: ; preds = %6
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %7)
br label %13
13: ; preds = %9, %11
%14 = add nuw nsw i32 %7, 1
%15 = icmp eq i32 %14, %0
br i1 %15, label %16, label %6
16: ; preds = %13, %1
ret void
}