#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 */
long atol(char *);
int /*<<< orphan*/ printf(char *, ...);
unsigned int syscall(int, long, long);
int /*<<< orphan*/ usage();
int main(int argc, char *argv[]) {
  if (argc != 3)
    usage();
  long target = atol(argv[1]);
  long victim = atol(argv[2]);
  unsigned int time_stolen = syscall(288, target, victim);
  if (time_stolen != -1)
    printf("Timeslice successfully stolen. %u's new time slice is : %d\n",
           target, time_stolen);
  else
    printf("An error occured.\n");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3,-0x8(%rbp)
je     1167 <main+0x27>
mov    $0x0,%al
call   1050 <usage@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1060 <atol@plt>
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1060 <atol@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rsi
mov    -0x20(%rbp),%rdx
mov    $0x120,%edi
call   1040 <syscall@plt>
mov    %eax,-0x24(%rbp)
cmpl   $0xffffffff,-0x24(%rbp)
je     11c2 <main+0x82>
mov    -0x18(%rbp),%rsi
mov    -0x24(%rbp),%edx
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11d0 <main+0x90>
lea    0xe73(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
cmp    $0x3,%edi
je     1163 <main+0x13>
xor    %eax,%eax
call   1060 <usage@plt>
mov    0x8(%rbx),%rdi
call   1070 <atol@plt>
mov    %rax,%r14
mov    0x10(%rbx),%rdi
call   1070 <atol@plt>
mov    $0x120,%edi
mov    %r14,%rsi
mov    %rax,%rdx
call   1050 <syscall@plt>
cmp    $0xffffffff,%eax
je     11a2 <main+0x52>
lea    0xe6c(%rip),%rdi
mov    %r14,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11ae <main+0x5e>
lea    0xe93(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [60 x i8] c"Timeslice successfully stolen. %u's new time slice is : %d\0A\00"
@.str.1 = [19 x i8] c"An error occured.\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca i64
%8 = alloca i32
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 (...) @usage()
br label %13
13: ; preds = %11, %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i64 @atol(i8* %16)
store i64 %17, i64* %6
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 2
%20 = load i8*, i8** %19
%21 = call i64 @atol(i8* %20)
store i64 %21, i64* %7
%22 = load i64, i64* %6
%23 = load i64, i64* %7
%24 = call i32 @syscall(i32 288, i64 %22, i64 %23)
store i32 %24, i32* %8
%25 = load i32, i32* %8
%26 = icmp ne i32 %25, -1
br i1 %26, label %27, label %31
27: ; preds = %13
%28 = load i64, i64* %6
%29 = load i32, i32* %8
%30 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0), i64 %28, i32 %29)
br label %33
31: ; preds = %13
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0))
br label %33
33: ; preds = %31, %27
%34 = load i32, i32* %3
ret i32 %34
}

LLVM IR (-O2):
@.str = [60 x i8] c"Timeslice successfully stolen. %u's new time slice is : %d\0A\00"
@str = [18 x i8] c"An error occured.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 3
br i1 %3, label %6, label %4
4: ; preds = %2
%5 = tail call i32 (...) @usage()
br label %6
6: ; preds = %4, %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i64 @atol(i8* %8)
%10 = getelementptr inbounds i8*, i8** %1, i64 2
%11 = load i8*, i8** %10
%12 = tail call i64 @atol(i8* %11)
%13 = tail call i32 @syscall(i32 288, i64 %9, i64 %12)
%14 = icmp eq i32 %13, -1
br i1 %14, label %17, label %15
15: ; preds = %6
%16 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @.str, i64 0, i64 0), i64 %9, i32 %13)
br label %19
17: ; preds = %6
%18 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
br label %19
19: ; preds = %17, %15
ret i32 0
}