#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*/ GREEDY_ACTIVITY_SELECTOR(int *, int *, int, int *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
void main() {
  int s[100], f[100], len, i, n;
  int a2[] = {1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0};
  printf("Enter no of elements");
  scanf("%d", &n);
  printf("Enter elements");
  for (i = 0; i < n; i++) {
    scanf("%d", s[i]);
  }
  printf("Enter no of elements");
  scanf("%d", &n);
  GREEDY_ACTIVITY_SELECTOR(s, f, len, a2);
  printf("Solution:");
  for (i = 0; i < len; i++) {
    if (a2[i] == 1)
      printf("%d", i + 1);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x370,%rsp
lea    -0x370(%rbp),%rdi
xor    %esi,%esi
mov    $0x38,%edx
call   1050 <memset@plt>
movl   $0x1,-0x370(%rbp)
lea    0xe91(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe98(%rip),%rdi
lea    -0x32c(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
lea    0xe86(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x328(%rbp)
mov    -0x328(%rbp),%eax
cmp    -0x32c(%rbp),%eax
jge    11e5 <main+0xa5>
movslq -0x328(%rbp),%rax
mov    -0x190(%rbp,%rax,4),%esi
lea    0xe4b(%rip),%rdi
mov    $0x0,%al
call   1060 <scanf@plt>
mov    -0x328(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x328(%rbp)
jmp    11a3 <main+0x63>
lea    0xe14(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
lea    0xe1b(%rip),%rdi
lea    -0x32c(%rbp),%rsi
mov    $0x0,%al
call   1060 <scanf@plt>
lea    -0x190(%rbp),%rdi
lea    -0x320(%rbp),%rsi
mov    -0x324(%rbp),%edx
lea    -0x370(%rbp),%rcx
call   1030 <GREEDY_ACTIVITY_SELECTOR@plt>
lea    0xdf8(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x328(%rbp)
mov    -0x328(%rbp),%eax
cmp    -0x324(%rbp),%eax
jge    1297 <main+0x157>
movslq -0x328(%rbp),%rax
cmpl   $0x1,-0x370(%rbp,%rax,4)
01
jne    127e <main+0x13e>
mov    -0x328(%rbp),%esi
add    $0x1,%esi
lea    0xd9e(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1283 <main+0x143>
mov    -0x328(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x328(%rbp)
jmp    1240 <main+0x100>
add    $0x370,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x370,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movq   $0x0,0x40(%rsp)
movl   $0x1,0x10(%rsp)
lea    0xe9a(%rip),%r14
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe9e(%rip),%rbx
lea    0xc(%rsp),%r15
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0xe88(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbx,%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
lea    0x1e0(%rsp),%rdi
lea    0x50(%rsp),%rsi
lea    0x10(%rsp),%rcx
call   1030 <GREEDY_ACTIVITY_SELECTOR@plt>
lea    0xe5b(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x370,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [21 x i8] c"Enter no of elements\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [15 x i8] c"Enter elements\00"
@.str.3 = [10 x i8] c"Solution:\00"
define void @main() {
%1 = alloca [100 x i32]
%2 = alloca [100 x i32]
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [14 x i32]
%7 = bitcast [14 x i32]* %6 to i8*
%8 = bitcast i8* %7 to <{ i32, [13 x i32] }>*
%9 = getelementptr inbounds <{ i32, [13 x i32] }>, <{ i32, [13 x i32] }>* %8, i32 0, i32 0
store i32 1, i32* %9
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
store i32 0, i32* %4
br label %13
13: ; preds = %23, %0
%14 = load i32, i32* %4
%15 = load i32, i32* %5
%16 = icmp slt i32 %14, %15
br i1 %16, label %17, label %26
17: ; preds = %13
%18 = load i32, i32* %4
%19 = sext i32 %18 to i64
%20 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 %19
%21 = load i32, i32* %20
%22 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %21)
br label %23
23: ; preds = %17
%24 = load i32, i32* %4
%25 = add nsw i32 %24, 1
store i32 %25, i32* %4
br label %13
26: ; preds = %13
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%28 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %5)
%29 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 0
%30 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 0
%31 = load i32, i32* %3
%32 = getelementptr inbounds [14 x i32], [14 x i32]* %6, i64 0, i64 0
%33 = call i32 @GREEDY_ACTIVITY_SELECTOR(i32* %29, i32* %30, i32 %31, i32* %32)
%34 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %4
br label %35
35: ; preds = %50, %26
%36 = load i32, i32* %4
%37 = load i32, i32* %3
%38 = icmp slt i32 %36, %37
br i1 %38, label %39, label %53
39: ; preds = %35
%40 = load i32, i32* %4
%41 = sext i32 %40 to i64
%42 = getelementptr inbounds [14 x i32], [14 x i32]* %6, i64 0, i64 %41
%43 = load i32, i32* %42
%44 = icmp eq i32 %43, 1
br i1 %44, label %45, label %49
45: ; preds = %39
%46 = load i32, i32* %4
%47 = add nsw i32 %46, 1
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %47)
br label %49
49: ; preds = %45, %39
br label %50
50: ; preds = %49
%51 = load i32, i32* %4
%52 = add nsw i32 %51, 1
store i32 %52, i32* %4
br label %35
53: ; preds = %35
ret void
}

LLVM IR (-O2):
@.str = [21 x i8] c"Enter no of elements\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [15 x i8] c"Enter elements\00"
@.str.3 = [10 x i8] c"Solution:\00"
define void @main() {
%1 = alloca [100 x i32]
%2 = alloca [100 x i32]
%3 = alloca i32
%4 = alloca [14 x i32]
%5 = bitcast [100 x i32]* %1 to i8*
%6 = bitcast [100 x i32]* %2 to i8*
%7 = bitcast i32* %3 to i8*
%8 = bitcast [14 x i32]* %4 to i8*
%9 = getelementptr inbounds [14 x i32], [14 x i32]* %4, i64 0, i64 0
store i32 1, i32* %9
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0))
%13 = load i32, i32* %3
%14 = icmp slt i32 %13, 1
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0))
%16 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%17 = getelementptr inbounds [100 x i32], [100 x i32]* %1, i64 0, i64 0
%18 = getelementptr inbounds [100 x i32], [100 x i32]* %2, i64 0, i64 0
%19 = call i32 @GREEDY_ACTIVITY_SELECTOR(i32* %17, i32* %18, i32 undef, i32* %9)
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0))
ret void
}