#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*/ execvp(char *, char **);
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
int /*<<< orphan*/ strcmp(char *, char *);
void jump(char **argv, char *flag, char *name) {
  char **arg;
  argv[0] = name;
  for (arg = argv + 1; *arg; ++arg)
    if (!strcmp(*arg, flag))
      break;
  for (; *arg; ++arg)
    arg[0] = arg[1];
  execvp(name, argv);
  (void)fprintf(stderr, "%s: Command not found.\n", name);
  exit(1);
}


x86 assembly (clang, -O0):
<jump>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x18(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmpq   $0x0,(%rax)
je     11ad <jump+0x6d>
mov    -0x20(%rbp),%rax
mov    (%rax),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%eax
jne    1197 <jump+0x57>
jmp    11ad <jump+0x6d>
jmp    119c <jump+0x5c>
mov    -0x20(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x20(%rbp)
jmp    116b <jump+0x2b>
jmp    11b2 <jump+0x72>
mov    -0x20(%rbp),%rax
cmpq   $0x0,(%rax)
je     11e0 <jump+0xa0>
mov    -0x20(%rbp),%rax
mov    0x8(%rax),%rcx
mov    -0x20(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
add    $0x8,%rax
mov    %rax,-0x20(%rbp)
jmp    11b2 <jump+0x72>
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1050 <execvp@plt>
mov    0x2dec(%rip),%rax
mov    (%rax),%edi
mov    -0x18(%rbp),%rdx
lea    0xdff(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

x86 assembly (clang, -O2):
<jump>:
push   %r15
push   %r14
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r14
mov    %rsi,%r12
mov    %rdi,%r15
mov    %rdx,(%rdi)
lea    0x8(%rdi),%rbx
nopl   0x0(%rax,%rax,1)
mov    (%rbx),%rdi
test   %rdi,%rdi
je     1190 <jump+0x50>
mov    %r12,%rsi
call   1030 <strcmp@plt>
add    $0x8,%rbx
test   %eax,%eax
jne    1160 <jump+0x20>
nopl   0x0(%rax,%rax,1)
mov    (%rbx),%rax
mov    %rax,-0x8(%rbx)
add    $0x8,%rbx
test   %rax,%rax
jne    1180 <jump+0x40>
mov    %r14,%rdi
mov    %r15,%rsi
call   1050 <execvp@plt>
mov    0x2e3e(%rip),%rax
mov    (%rax),%edi
lea    0xe55(%rip),%rsi
mov    %r14,%rdx
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [24 x i8] c"%s: Command not found.\0A\00"
define void @jump(i8** %0, i8* %1, i8* %2) {
%4 = alloca i8**
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8**
store i8** %0, i8*** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = load i8*, i8** %6
%9 = load i8**, i8*** %4
%10 = getelementptr inbounds i8*, i8** %9, i64 0
store i8* %8, i8** %10
%11 = load i8**, i8*** %4
%12 = getelementptr inbounds i8*, i8** %11, i64 1
store i8** %12, i8*** %7
br label %13
13: ; preds = %25, %3
%14 = load i8**, i8*** %7
%15 = load i8*, i8** %14
%16 = icmp ne i8* %15, null
br i1 %16, label %17, label %28
17: ; preds = %13
%18 = load i8**, i8*** %7
%19 = load i8*, i8** %18
%20 = load i8*, i8** %5
%21 = call i32 @strcmp(i8* %19, i8* %20)
%22 = icmp ne i32 %21, 0
br i1 %22, label %24, label %23
23: ; preds = %17
br label %28
24: ; preds = %17
br label %25
25: ; preds = %24
%26 = load i8**, i8*** %7
%27 = getelementptr inbounds i8*, i8** %26, i32 1
store i8** %27, i8*** %7
br label %13
28: ; preds = %23, %13
br label %29
29: ; preds = %39, %28
%30 = load i8**, i8*** %7
%31 = load i8*, i8** %30
%32 = icmp ne i8* %31, null
br i1 %32, label %33, label %42
33: ; preds = %29
%34 = load i8**, i8*** %7
%35 = getelementptr inbounds i8*, i8** %34, i64 1
%36 = load i8*, i8** %35
%37 = load i8**, i8*** %7
%38 = getelementptr inbounds i8*, i8** %37, i64 0
store i8* %36, i8** %38
br label %39
39: ; preds = %33
%40 = load i8**, i8*** %7
%41 = getelementptr inbounds i8*, i8** %40, i32 1
store i8** %41, i8*** %7
br label %29
42: ; preds = %29
%43 = load i8*, i8** %6
%44 = load i8**, i8*** %4
%45 = call i32 @execvp(i8* %43, i8** %44)
%46 = load i32, i32* @stderr
%47 = load i8*, i8** %6
%48 = call i32 @fprintf(i32 %46, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %47)
%49 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [24 x i8] c"%s: Command not found.\0A\00"
define void @jump(i8** %0, i8* nocapture %1, i8* %2) {
store i8* %2, i8** %0
br label %4
4: ; preds = %9, %3
%5 = phi i8** [ %0, %3 ], [ %6, %9 ]
%6 = getelementptr inbounds i8*, i8** %5, i64 1
%7 = load i8*, i8** %6
%8 = icmp eq i8* %7, null
br i1 %8, label %17, label %9
9: ; preds = %4
%10 = tail call i32 @strcmp(i8* %7, i8* dereferenceable(1) %1)
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %4
12: ; preds = %9, %12
%13 = phi i8** [ %14, %12 ], [ %6, %9 ]
%14 = getelementptr inbounds i8*, i8** %13, i64 1
%15 = load i8*, i8** %14
store i8* %15, i8** %13
%16 = icmp eq i8* %15, null
br i1 %16, label %17, label %12
17: ; preds = %4, %12
%18 = tail call i32 @execvp(i8* %2, i8** %0)
%19 = load i32, i32* @stderr
%20 = tail call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0), i8* %2)
%21 = tail call i32 @exit(i32 1)
unreachable
}