#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*/ execl(char *, char *, char *, char *, char *, char *,
                         char *);
int fork();
int /*<<< orphan*/ sys_error(char *, char *, int);
int fork_realtime(char **args) {
  int pid;
  char *results_file = args[2];
  char *priority = args[3];
  pid = fork();
  switch (pid) {
  case -1:
    sys_error("fork failed",
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/CentOS/sig-core-t_ltp/refs/heads/"
              "master/testcases/kernel/sched/sched_stress/sched_tc6.c",
              287);
  case 0:
    if (execl(*args, *args, "1", results_file, priority, "0", (char *)NULL) < 0)
      sys_error("execl failed",
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/CentOS/sig-core-t_ltp/refs/"
                "heads/master/testcases/kernel/sched/sched_stress/sched_tc6.c",
                293);
  default:
    break;
  }
  return (pid);
}


x86 assembly (clang, -O0):
<fork_realtime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    0x10(%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    0x18(%rax),%rax
mov    %rax,-0x20(%rbp)
xor    %eax,%eax
call   1050 <fork@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x24(%rbp)
sub    $0xffffffff,%eax
je     1182 <fork_realtime+0x52>
jmp    1172 <fork_realtime+0x42>
mov    -0x24(%rbp),%eax
test   %eax,%eax
je     119a <fork_realtime+0x6a>
jmp    11f3 <fork_realtime+0xc3>
lea    0xe77(%rip),%rdi
lea    0xe7c(%rip),%rsi
mov    $0x11f,%edx
call   1030 <sys_error@plt>
mov    -0x8(%rbp),%rax
mov    (%rax),%rdi
mov    -0x8(%rbp),%rax
mov    (%rax),%rsi
mov    -0x18(%rbp),%rcx
mov    -0x20(%rbp),%r8
lea    0xf07(%rip),%rdx
lea    0xf02(%rip),%r9
xor    %eax,%eax
movq   $0x0,(%rsp)
call   1040 <execl@plt>
cmp    $0x0,%eax
jge    11ee <fork_realtime+0xbe>
lea    0xee5(%rip),%rdi
lea    0xe28(%rip),%rsi
mov    $0x125,%edx
call   1030 <sys_error@plt>
jmp    11f3 <fork_realtime+0xc3>
jmp    11f8 <fork_realtime+0xc8>
mov    -0xc(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fork_realtime>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    0x10(%rdi),%r14
mov    0x18(%rdi),%r15
xor    %eax,%eax
call   1050 <fork@plt>
mov    %eax,%ebp
test   %eax,%eax
je     116c <fork_realtime+0x3c>
cmp    $0xffffffff,%ebp
jne    11af <fork_realtime+0x7f>
lea    0xea5(%rip),%rdi
lea    0xeaa(%rip),%rsi
mov    $0x11f,%edx
call   1030 <sys_error@plt>
mov    (%rbx),%rdi
movq   $0x0,(%rsp)
lea    0xf40(%rip),%rdx
lea    0xf3b(%rip),%r9
mov    %rdi,%rsi
mov    %r14,%rcx
mov    %r15,%r8
call   1040 <execl@plt>
test   %eax,%eax
jns    11af <fork_realtime+0x7f>
lea    0xf24(%rip),%rdi
lea    0xe67(%rip),%rsi
mov    $0x125,%edx
call   1030 <sys_error@plt>
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"fork failed\00"
@.str.1 = [178 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/CentOS/sig-core-t_ltp/refs/heads/master/testcases/kernel/sched/sched_stress/sched_tc6.c\00"
@.str.2 = [2 x i8] c"1\00"
@.str.3 = [2 x i8] c"0\00"
@.str.4 = [13 x i8] c"execl failed\00"
define i32 @fork_realtime(i8** %0) {
%2 = alloca i8**
%3 = alloca i32
%4 = alloca i8*
%5 = alloca i8*
store i8** %0, i8*** %2
%6 = load i8**, i8*** %2
%7 = getelementptr inbounds i8*, i8** %6, i64 2
%8 = load i8*, i8** %7
store i8* %8, i8** %4
%9 = load i8**, i8*** %2
%10 = getelementptr inbounds i8*, i8** %9, i64 3
%11 = load i8*, i8** %10
store i8* %11, i8** %5
%12 = call i32 (...) @fork()
store i32 %12, i32* %3
%13 = load i32, i32* %3
switch i32 %13, label %28 [
i32 -1, label %14
i32 0, label %16
]
14: ; preds = %1
%15 = call i32 @sys_error(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([178 x i8], [178 x i8]* @.str.1, i64 0, i64 0), i32 287)
br label %16
16: ; preds = %1, %14
%17 = load i8**, i8*** %2
%18 = load i8*, i8** %17
%19 = load i8**, i8*** %2
%20 = load i8*, i8** %19
%21 = load i8*, i8** %4
%22 = load i8*, i8** %5
%23 = call i32 @execl(i8* %18, i8* %20, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* %21, i8* %22, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* null)
%24 = icmp slt i32 %23, 0
br i1 %24, label %25, label %27
25: ; preds = %16
%26 = call i32 @sys_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([178 x i8], [178 x i8]* @.str.1, i64 0, i64 0), i32 293)
br label %27
27: ; preds = %25, %16
br label %28
28: ; preds = %1, %27
br label %29
29: ; preds = %28
%30 = load i32, i32* %3
ret i32 %30
}

LLVM IR (-O2):
@.str = [12 x i8] c"fork failed\00"
@.str.1 = [178 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/CentOS/sig-core-t_ltp/refs/heads/master/testcases/kernel/sched/sched_stress/sched_tc6.c\00"
@.str.2 = [2 x i8] c"1\00"
@.str.3 = [2 x i8] c"0\00"
@.str.4 = [13 x i8] c"execl failed\00"
define i32 @fork_realtime(i8** nocapture %0) {
%2 = getelementptr inbounds i8*, i8** %0, i64 2
%3 = load i8*, i8** %2
%4 = getelementptr inbounds i8*, i8** %0, i64 3
%5 = load i8*, i8** %4
%6 = tail call i32 (...) @fork()
switch i32 %6, label %15 [
i32 -1, label %7
i32 0, label %9
]
7: ; preds = %1
%8 = tail call i32 @sys_error(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([178 x i8], [178 x i8]* @.str.1, i64 0, i64 0), i32 287)
br label %9
9: ; preds = %1, %7
%10 = load i8*, i8** %0
%11 = tail call i32 @execl(i8* %10, i8* %10, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0), i8* %3, i8* %5, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8* null)
%12 = icmp slt i32 %11, 0
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = tail call i32 @sys_error(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([178 x i8], [178 x i8]* @.str.1, i64 0, i64 0), i32 293)
br label %15
15: ; preds = %1, %13, %9
ret i32 %6
}