#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 */
typedef int /*<<< orphan*/ pid_t;

/* Variables and functions */
int /*<<< orphan*/ atol(char *);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
long syscall(int, int /*<<< orphan*/, int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  if (argc < 3) {
    printf("Please include the target and the victim as command line "
           "parameters.\n");
    return 1;
  }
  pid_t target = atol(argv[1]), victim = atol(argv[2]);
  long success = syscall(288, target, victim);
  if (success < 0) {
    perror("Failure in swipe");
    return 2;
  }
  printf("Success! Stolen time: %ld\n", success);
  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)
jge    117a <main+0x3a>
lea    0xe99(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11ea <main+0xaa>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1050 <atol@plt>
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1050 <atol@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    $0x120,%edi
call   1040 <syscall@plt>
mov    %rax,-0x20(%rbp)
cmpq   $0x0,-0x20(%rbp)
jge    11d1 <main+0x91>
lea    0xe86(%rip),%rdi
call   1060 <perror@plt>
movl   $0x2,-0x4(%rbp)
jmp    11ea <main+0xaa>
mov    -0x20(%rbp),%rsi
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@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    $0x2,%edi
jg     116b <main+0x1b>
lea    0xecd(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebx
jmp    11a8 <main+0x58>
mov    %rsi,%rbx
mov    0x8(%rsi),%rdi
call   1060 <atol@plt>
mov    %eax,%ebp
mov    0x10(%rbx),%rdi
call   1060 <atol@plt>
mov    $0x120,%edi
mov    %ebp,%esi
mov    %eax,%edx
call   1050 <syscall@plt>
test   %rax,%rax
js     11b1 <main+0x61>
lea    0xe75(%rip),%rdi
xor    %ebx,%ebx
mov    %rax,%rsi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret
lea    0xe48(%rip),%rdi
call   1070 <perror@plt>
mov    $0x2,%ebx
jmp    11a8 <main+0x58>

LLVM IR (-O0):
@.str = [70 x i8] c"Please include the target and the victim as command line parameters.\0A\00"
@.str.1 = [17 x i8] c"Failure in swipe\00"
@.str.2 = [27 x i8] c"Success! Stolen time: %ld\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = load i32, i32* %4
%10 = icmp slt i32 %9, 3
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([70 x i8], [70 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %32
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @atol(i8* %16)
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 @atol(i8* %20)
store i32 %21, i32* %7
%22 = load i32, i32* %6
%23 = load i32, i32* %7
%24 = call i64 @syscall(i32 288, i32 %22, i32 %23)
store i64 %24, i64* %8
%25 = load i64, i64* %8
%26 = icmp slt i64 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %13
%28 = call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
store i32 2, i32* %3
br label %32
29: ; preds = %13
%30 = load i64, i64* %8
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i64 %30)
store i32 0, i32* %3
br label %32
32: ; preds = %29, %27, %11
%33 = load i32, i32* %3
ret i32 %33
}

LLVM IR (-O2):
@.str.1 = [17 x i8] c"Failure in swipe\00"
@.str.2 = [27 x i8] c"Success! Stolen time: %ld\0A\00"
@str = [69 x i8] c"Please include the target and the victim as command line parameters.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp slt i32 %0, 3
br i1 %3, label %4, label %6
4: ; preds = %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([69 x i8], [69 x i8]* @str, i64 0, i64 0))
br label %19
6: ; preds = %2
%7 = getelementptr inbounds i8*, i8** %1, i64 1
%8 = load i8*, i8** %7
%9 = tail call i32 @atol(i8* %8)
%10 = getelementptr inbounds i8*, i8** %1, i64 2
%11 = load i8*, i8** %10
%12 = tail call i32 @atol(i8* %11)
%13 = tail call i64 @syscall(i32 288, i32 %9, i32 %12)
%14 = icmp slt i64 %13, 0
br i1 %14, label %15, label %17
15: ; preds = %6
%16 = tail call i32 @perror(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0))
br label %19
17: ; preds = %6
%18 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i64 %13)
br label %19
19: ; preds = %15, %17, %4
%20 = phi i32 [ 1, %4 ], [ 2, %15 ], [ 0, %17 ]
ret i32 %20
}