#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 */
struct courseintb {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ deletemultiple(int, int *, int, struct courseintb **);
int /*<<< orphan*/ free(int *);
scalar_t__ malloc(int);
int /*<<< orphan*/ positioninwhichtoalloc(int, int **, int,
                                          struct courseintb **);
int scanttb(int, int *, int, struct courseintb **);
void repearcourse(int coursetorepear, struct courseintb **timetable,
                  int timeslots, int **conflictmatrix) {
  int *deletiontb = (int *)malloc(sizeof(int) * 60), k;
  for (k = 0; k < 60; k++) {
    deletiontb[k] = -1;
  }
  int count = scanttb(coursetorepear, deletiontb, timeslots, timetable);
  switch (count) {
  case 0:
    positioninwhichtoalloc(coursetorepear - 1, conflictmatrix, timeslots,
                           timetable);
    break;
  case 1:;
    break;
  default:
    deletemultiple(coursetorepear, deletiontb, count, timetable);
    break;
  }
  free(deletiontb);
}


x86 assembly (clang, -O0):
<repearcourse>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    $0xf0,%edi
call   1050 <malloc@plt>
mov    %rax,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
cmpl   $0x3c,-0x2c(%rbp)
jge    11a2 <repearcourse+0x52>
mov    -0x28(%rbp),%rax
movslq -0x2c(%rbp),%rcx
movl   $0xffffffff,(%rax,%rcx,4)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    117b <repearcourse+0x2b>
mov    -0x4(%rbp),%edi
mov    -0x28(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%rcx
call   1040 <scanttb@plt>
mov    %eax,-0x30(%rbp)
mov    -0x30(%rbp),%eax
mov    %eax,-0x34(%rbp)
test   %eax,%eax
je     11dc <repearcourse+0x8c>
jmp    11cb <repearcourse+0x7b>
mov    -0x34(%rbp),%eax
sub    $0x1,%eax
je     11f7 <repearcourse+0xa7>
jmp    11fc <repearcourse+0xac>
mov    -0x4(%rbp),%edi
sub    $0x1,%edi
mov    -0x20(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x10(%rbp),%rcx
call   1060 <positioninwhichtoalloc@plt>
jmp    120f <repearcourse+0xbf>
jmp    120f <repearcourse+0xbf>
mov    -0x4(%rbp),%edi
mov    -0x28(%rbp),%rsi
mov    -0x30(%rbp),%edx
mov    -0x10(%rbp),%rcx
call   1070 <deletemultiple@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<repearcourse>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
mov    %rcx,%r15
mov    %edx,%r12d
mov    %rsi,%r14
mov    %edi,%ebp
mov    $0xf0,%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
pcmpeqd %xmm0,%xmm0
movdqu %xmm0,(%rax)
movdqu %xmm0,0x10(%rax)
movdqu %xmm0,0x20(%rax)
movdqu %xmm0,0x30(%rax)
movdqu %xmm0,0x40(%rax)
movdqu %xmm0,0x50(%rax)
movdqu %xmm0,0x60(%rax)
movdqu %xmm0,0x70(%rax)
movdqu %xmm0,0x80(%rax)
movdqu %xmm0,0x90(%rax)
movdqu %xmm0,0xa0(%rax)
movdqu %xmm0,0xb0(%rax)
movdqu %xmm0,0xc0(%rax)
movdqu %xmm0,0xd0(%rax)
movdqu %xmm0,0xe0(%rax)
mov    %ebp,%edi
mov    %rax,%rsi
mov    %r12d,%edx
mov    %r14,%rcx
call   1040 <scanttb@plt>
cmp    $0x1,%eax
je     1210 <repearcourse+0xc0>
test   %eax,%eax
jne    1201 <repearcourse+0xb1>
add    $0xffffffff,%ebp
mov    %ebp,%edi
mov    %r15,%rsi
mov    %r12d,%edx
mov    %r14,%rcx
call   1060 <positioninwhichtoalloc@plt>
jmp    1210 <repearcourse+0xc0>
mov    %ebp,%edi
mov    %rbx,%rsi
mov    %eax,%edx
mov    %r14,%rcx
call   1070 <deletemultiple@plt>
mov    %rbx,%rdi
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.courseintb = type { i32 }
define void @repearcourse(i32 %0, %struct.courseintb** %1, i32 %2, i32** %3) {
%5 = alloca i32
%6 = alloca %struct.courseintb**
%7 = alloca i32
%8 = alloca i32**
%9 = alloca i32*
%10 = alloca i32
%11 = alloca i32
store i32 %0, i32* %5
store %struct.courseintb** %1, %struct.courseintb*** %6
store i32 %2, i32* %7
store i32** %3, i32*** %8
%12 = call i64 @malloc(i32 240)
%13 = inttoptr i64 %12 to i32*
store i32* %13, i32** %9
store i32 0, i32* %10
br label %14
14: ; preds = %22, %4
%15 = load i32, i32* %10
%16 = icmp slt i32 %15, 60
br i1 %16, label %17, label %25
17: ; preds = %14
%18 = load i32*, i32** %9
%19 = load i32, i32* %10
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i32, i32* %18, i64 %20
store i32 -1, i32* %21
br label %22
22: ; preds = %17
%23 = load i32, i32* %10
%24 = add nsw i32 %23, 1
store i32 %24, i32* %10
br label %14
25: ; preds = %14
%26 = load i32, i32* %5
%27 = load i32*, i32** %9
%28 = load i32, i32* %7
%29 = load %struct.courseintb**, %struct.courseintb*** %6
%30 = call i32 @scanttb(i32 %26, i32* %27, i32 %28, %struct.courseintb** %29)
store i32 %30, i32* %11
%31 = load i32, i32* %11
switch i32 %31, label %40 [
i32 0, label %32
i32 1, label %39
]
32: ; preds = %25
%33 = load i32, i32* %5
%34 = sub nsw i32 %33, 1
%35 = load i32**, i32*** %8
%36 = load i32, i32* %7
%37 = load %struct.courseintb**, %struct.courseintb*** %6
%38 = call i32 @positioninwhichtoalloc(i32 %34, i32** %35, i32 %36, %struct.courseintb** %37)
br label %46
39: ; preds = %25
br label %46
40: ; preds = %25
%41 = load i32, i32* %5
%42 = load i32*, i32** %9
%43 = load i32, i32* %11
%44 = load %struct.courseintb**, %struct.courseintb*** %6
%45 = call i32 @deletemultiple(i32 %41, i32* %42, i32 %43, %struct.courseintb** %44)
br label %46
46: ; preds = %40, %39, %32
%47 = load i32*, i32** %9
%48 = call i32 @free(i32* %47)
ret void
}

LLVM IR (-O2):
%struct.courseintb = type { i32 }
define void @repearcourse(i32 %0, %struct.courseintb** %1, i32 %2, i32** %3) {
%5 = tail call i64 @malloc(i32 240)
%6 = inttoptr i64 %5 to i32*
%7 = inttoptr i64 %5 to i8*
%8 = tail call i32 @scanttb(i32 %0, i32* %6, i32 %2, %struct.courseintb** %1)
switch i32 %8, label %12 [
i32 0, label %9
i32 1, label %14
]
9: ; preds = %4
%10 = add nsw i32 %0, -1
%11 = tail call i32 @positioninwhichtoalloc(i32 %10, i32** %3, i32 %2, %struct.courseintb** %1)
br label %14
12: ; preds = %4
%13 = tail call i32 @deletemultiple(i32 %0, i32* %6, i32 %8, %struct.courseintb** %1)
br label %14
14: ; preds = %4, %12, %9
%15 = tail call i32 @free(i32* %6)
ret void
}