#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 printMaxActivities(int s[], int f[], int n) {
  int i, j;
  printf("Following activities are selected \n");
  i = 0;
  printf("%d ", i);
  for (j = 1; j < n; j++) {
    if (s[j] >= f[i]) {
      printf("%d ", j);
      i = j;
    }
  }
}


x86 assembly (clang, -O0):
<printMaxActivities>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
lea    0xed6(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%esi
lea    0xee2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11a2 <printMaxActivities+0x92>
mov    -0x8(%rbp),%rax
movslq -0x1c(%rbp),%rcx
mov    (%rax,%rcx,4),%eax
mov    -0x10(%rbp),%rcx
movslq -0x18(%rbp),%rdx
cmp    (%rcx,%rdx,4),%eax
jl     118f <printMaxActivities+0x7f>
mov    -0x1c(%rbp),%esi
lea    0xea2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
mov    %eax,-0x18(%rbp)
jmp    1194 <printMaxActivities+0x84>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1150 <printMaxActivities+0x40>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<printMaxActivities>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
mov    %edx,%ebx
mov    %rsi,%r14
mov    %rdi,%r15
lea    0xecc(%rip),%rdi
call   1030 <puts@plt>
lea    0xebc(%rip),%rdi
xor    %esi,%esi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x2,%ebx
jl     1196 <printMaxActivities+0x76>
mov    %ebx,%r13d
mov    $0x1,%ebx
lea    0xe9f(%rip),%r12
xor    %eax,%eax
jmp    1179 <printMaxActivities+0x59>
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%rbx
cmp    %rbx,%r13
je     1196 <printMaxActivities+0x76>
mov    (%r15,%rbx,4),%ecx
movslq %eax,%rdx
cmp    (%r14,%rdx,4),%ecx
jl     1170 <printMaxActivities+0x50>
mov    %r12,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%eax
jmp    1170 <printMaxActivities+0x50>
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

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

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