#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 atoi(char *);
int /*<<< orphan*/ execve(char *, char **, int /*<<< orphan*/ *);
int fork();
int /*<<< orphan*/ nice(int);
int /*<<< orphan*/ wait(int /*<<< orphan*/);
int main(int argc, char *argv[]) {
  int pid, inc;
  char *new_arg[] = {NULL};
  pid = fork();
  if (pid == 0) {
    inc = atoi(argv[2]);
    nice(inc);
    new_arg[0] = argv[1];
    execve(argv[1], new_arg, NULL);
  } else
    wait(0);
  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)
lea    -0x20(%rbp),%rdi
xor    %esi,%esi
mov    $0x8,%edx
call   1030 <memset@plt>
mov    $0x0,%al
call   1080 <fork@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jne    11d8 <main+0x78>
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rdi
call   1060 <atoi@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%edi
call   1050 <nice@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x20(%rbp),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1040 <execve@plt>
jmp    11df <main+0x7f>
xor    %edi,%edi
call   1070 <wait@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%rbx
xor    %eax,%eax
call   1070 <fork@plt>
test   %eax,%eax
je     116c <main+0x1c>
xor    %edi,%edi
call   1060 <wait@plt>
jmp    1191 <main+0x41>
mov    0x10(%rbx),%rdi
call   1050 <atoi@plt>
mov    %eax,%edi
call   1040 <nice@plt>
mov    0x8(%rbx),%rdi
mov    %rdi,0x8(%rsp)
lea    0x8(%rsp),%rsi
xor    %edx,%edx
call   1030 <execve@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca [1 x i8*]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%9 = bitcast [1 x i8*]* %8 to i8*
%10 = call i32 (...) @fork()
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %29
13: ; preds = %2
%14 = load i8**, i8*** %5
%15 = getelementptr inbounds i8*, i8** %14, i64 2
%16 = load i8*, i8** %15
%17 = call i32 @atoi(i8* %16)
store i32 %17, i32* %7
%18 = load i32, i32* %7
%19 = call i32 @nice(i32 %18)
%20 = load i8**, i8*** %5
%21 = getelementptr inbounds i8*, i8** %20, i64 1
%22 = load i8*, i8** %21
%23 = getelementptr inbounds [1 x i8*], [1 x i8*]* %8, i64 0, i64 0
store i8* %22, i8** %23
%24 = load i8**, i8*** %5
%25 = getelementptr inbounds i8*, i8** %24, i64 1
%26 = load i8*, i8** %25
%27 = getelementptr inbounds [1 x i8*], [1 x i8*]* %8, i64 0, i64 0
%28 = call i32 @execve(i8* %26, i8** %27, i32* null)
br label %31
29: ; preds = %2
%30 = call i32 @wait(i32 0)
br label %31
31: ; preds = %29, %13
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [1 x i8*]
%4 = bitcast [1 x i8*]* %3 to i8*
%5 = tail call i32 (...) @fork()
%6 = icmp eq i32 %5, 0
br i1 %6, label %7, label %16
7: ; preds = %2
%8 = getelementptr inbounds i8*, i8** %1, i64 2
%9 = load i8*, i8** %8
%10 = tail call i32 @atoi(i8* %9)
%11 = tail call i32 @nice(i32 %10)
%12 = getelementptr inbounds i8*, i8** %1, i64 1
%13 = load i8*, i8** %12
%14 = getelementptr inbounds [1 x i8*], [1 x i8*]* %3, i64 0, i64 0
store i8* %13, i8** %14
%15 = call i32 @execve(i8* %13, i8** %14, i32* null)
br label %18
16: ; preds = %2
%17 = tail call i32 @wait(i32 0)
br label %18
18: ; preds = %16, %7
ret i32 0
}