#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 sched_param {
  int sched_priority;
};

/* Variables and functions */
int /*<<< orphan*/ SCHED_RR;
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ sched_setscheduler(int /*<<< orphan*/, int /*<<< orphan*/,
                                      struct sched_param *);
int /*<<< orphan*/ schedule(int, int);
int strtol(char *, int /*<<< orphan*/ *, int);
int main(int argc, char **argv) {
  int n, m;
  if (argc != 3) {
    printf("call: ./server N M\n");
    return 0;
  }
  n = strtol(argv[1], NULL, 10);
  m = strtol(argv[2], NULL, 10);
  struct sched_param param;
  param.sched_priority = 60;
  sched_setscheduler(0, SCHED_RR, &param);
  schedule(n, m);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     1178 <main+0x38>
lea    0xe99(%rip),%rdi
call   1040 <printf@plt>
movl   $0x0,-0x4(%rbp)
jmp    11d7 <main+0x97>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1060 <strtol@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1060 <strtol@plt>
mov    %eax,-0x18(%rbp)
movl   $0x3c,-0x20(%rbp)
mov    0x2e20(%rip),%rax
mov    (%rax),%esi
xor    %edi,%edi
lea    -0x20(%rbp),%rdx
call   1050 <sched_setscheduler@plt>
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1030 <schedule@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %rbx
push   %rax
cmp    $0x3,%edi
jne    1194 <main+0x54>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1060 <strtol@plt>
mov    %eax,%ebp
mov    0x10(%rbx),%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1060 <strtol@plt>
mov    %eax,%ebx
movl   $0x3c,(%rsp)
mov    0x2e5b(%rip),%rax
mov    (%rax),%esi
mov    %rsp,%rdx
xor    %edi,%edi
call   1050 <sched_setscheduler@plt>
mov    %ebp,%edi
mov    %ebx,%esi
call   1030 <schedule@plt>
jmp    11a0 <main+0x60>
lea    0xe65(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
%struct.sched_param = type { i32 }
@.str = [20 x i8] c"call: ./server N M\0A\00"
@SCHED_RR = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca %struct.sched_param
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp ne i32 %9, 3
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = call i32 @printf(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %3
br label %28
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @strtol(i8* %16, i32* null, i32 10)
store i32 %17, i32* %6
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 2
%20 = load i8*, i8** %19
%21 = call i32 @strtol(i8* %20, i32* null, i32 10)
store i32 %21, i32* %7
%22 = getelementptr inbounds %struct.sched_param, %struct.sched_param* %8, i32 0, i32 0
store i32 60, i32* %22
%23 = load i32, i32* @SCHED_RR
%24 = call i32 @sched_setscheduler(i32 0, i32 %23, %struct.sched_param* %8)
%25 = load i32, i32* %6
%26 = load i32, i32* %7
%27 = call i32 @schedule(i32 %25, i32 %26)
store i32 0, i32* %3
br label %28
28: ; preds = %13, %11
%29 = load i32, i32* %3
ret i32 %29
}

LLVM IR (-O2):
%struct.sched_param = type { i32 }
@SCHED_RR = global i32 0
@str = [19 x i8] c"call: ./server N M\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca %struct.sched_param
%4 = icmp eq i32 %0, 3
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
br label %19
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 1
%9 = load i8*, i8** %8
%10 = tail call i32 @strtol(i8* nocapture %9, i32* null, i32 10)
%11 = getelementptr inbounds i8*, i8** %1, i64 2
%12 = load i8*, i8** %11
%13 = tail call i32 @strtol(i8* nocapture %12, i32* null, i32 10)
%14 = bitcast %struct.sched_param* %3 to i8*
%15 = getelementptr inbounds %struct.sched_param, %struct.sched_param* %3, i64 0, i32 0
store i32 60, i32* %15
%16 = load i32, i32* @SCHED_RR
%17 = call i32 @sched_setscheduler(i32 0, i32 %16, %struct.sched_param* %3)
%18 = call i32 @schedule(i32 %10, i32 %13)
br label %19
19: ; preds = %7, %5
ret i32 0
}