#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 **);
void launch_pppd(char *ttydev, int argc, char **argv) {
  char *new_argv[argc + 4];
  int i;
  new_argv[0] = "pppd";
  new_argv[1] = ttydev;
  new_argv[2] = "38400";
  for (i = 0; i < argc; i++)
    new_argv[i + 3] = argv[i];
  new_argv[i + 3] = NULL;
  execvp(new_argv[0], new_argv);
}


x86 assembly (clang, -O0):
<launch_pppd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0xc(%rbp),%eax
add    $0x4,%eax
mov    %eax,%ecx
mov    %rsp,%rax
mov    %rax,-0x20(%rbp)
lea    0xf(,%rcx,8),%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rax
sub    %rdx,%rax
mov    %rax,-0x38(%rbp)
mov    %rax,%rsp
mov    %rcx,-0x28(%rbp)
lea    0xeaa(%rip),%rcx
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rcx
mov    %rcx,0x8(%rax)
lea    0xe9d(%rip),%rcx
mov    %rcx,0x10(%rax)
movl   $0x0,-0x2c(%rbp)
mov    -0x2c(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    11aa <launch_pppd+0x9a>
mov    -0x38(%rbp),%rax
mov    -0x18(%rbp),%rcx
movslq -0x2c(%rbp),%rdx
mov    (%rcx,%rdx,8),%rdx
mov    -0x2c(%rbp),%ecx
add    $0x3,%ecx
movslq %ecx,%rcx
mov    %rdx,(%rax,%rcx,8)
mov    -0x2c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x2c(%rbp)
jmp    1173 <launch_pppd+0x63>
mov    -0x38(%rbp),%rsi
mov    -0x2c(%rbp),%eax
add    $0x3,%eax
cltq
movq   $0x0,(%rsi,%rax,8)
mov    (%rsi),%rdi
call   1030 <execvp@plt>
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<launch_pppd>:
push   %rbp
mov    %rsp,%rbp
push   %r14
push   %rbx
mov    %esi,%r14d
lea    0x4(%r14),%eax
mov    %rsp,%rcx
lea    0xf(,%rax,8),%rax
and    $0xfffffffffffffff0,%rax
mov    %rcx,%rbx
sub    %rax,%rbx
mov    %rbx,%rsp
neg    %rax
lea    0xeb0(%rip),%rsi
mov    %rsi,(%rcx,%rax,1)
mov    %rdi,0x8(%rbx)
lea    0xea6(%rip),%rax
mov    %rax,0x10(%rbx)
test   %r14d,%r14d
jle    1184 <launch_pppd+0x64>
lea    0x18(%rbx),%rdi
mov    %r14d,%eax
shl    $0x3,%rax
mov    %rdx,%rsi
mov    %rax,%rdx
call   1030 <memcpy@plt>
add    $0x3,%r14d
jmp    118a <launch_pppd+0x6a>
mov    $0x3,%r14d
movq   $0x0,(%rbx,%r14,8)
lea    0xe67(%rip),%rdi
mov    %rbx,%rsi
call   1040 <execvp@plt>
lea    -0x10(%rbp),%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"pppd\00"
@.str.1 = [6 x i8] c"38400\00"
define void @launch_pppd(i8* %0, i32 %1, i8** %2) {
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i8**
%7 = alloca i8*
%8 = alloca i64
%9 = alloca i32
store i8* %0, i8** %4
store i32 %1, i32* %5
store i8** %2, i8*** %6
%10 = load i32, i32* %5
%11 = add nsw i32 %10, 4
%12 = zext i32 %11 to i64
%13 = call i8* @llvm.stacksave()
store i8* %13, i8** %7
%14 = alloca i8*, i64 %12
store i64 %12, i64* %8
%15 = getelementptr inbounds i8*, i8** %14, i64 0
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %15
%16 = load i8*, i8** %4
%17 = getelementptr inbounds i8*, i8** %14, i64 1
store i8* %16, i8** %17
%18 = getelementptr inbounds i8*, i8** %14, i64 2
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %18
store i32 0, i32* %9
br label %19
19: ; preds = %33, %3
%20 = load i32, i32* %9
%21 = load i32, i32* %5
%22 = icmp slt i32 %20, %21
br i1 %22, label %23, label %36
23: ; preds = %19
%24 = load i8**, i8*** %6
%25 = load i32, i32* %9
%26 = sext i32 %25 to i64
%27 = getelementptr inbounds i8*, i8** %24, i64 %26
%28 = load i8*, i8** %27
%29 = load i32, i32* %9
%30 = add nsw i32 %29, 3
%31 = sext i32 %30 to i64
%32 = getelementptr inbounds i8*, i8** %14, i64 %31
store i8* %28, i8** %32
br label %33
33: ; preds = %23
%34 = load i32, i32* %9
%35 = add nsw i32 %34, 1
store i32 %35, i32* %9
br label %19
36: ; preds = %19
%37 = load i32, i32* %9
%38 = add nsw i32 %37, 3
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds i8*, i8** %14, i64 %39
store i8* null, i8** %40
%41 = getelementptr inbounds i8*, i8** %14, i64 0
%42 = load i8*, i8** %41
%43 = call i32 @execvp(i8* %42, i8** %14)
%44 = load i8*, i8** %7
ret void
}

LLVM IR (-O2):
@.str = [5 x i8] c"pppd\00"
@.str.1 = [6 x i8] c"38400\00"
define void @launch_pppd(i8* %0, i32 %1, i8** nocapture %2) {
%4 = add nsw i32 %1, 4
%5 = zext i32 %4 to i64
%6 = alloca i8*, i64 %5
store i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %6
%7 = getelementptr inbounds i8*, i8** %6, i64 1
store i8* %0, i8** %7
%8 = getelementptr inbounds i8*, i8** %6, i64 2
store i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i8** %8
%9 = icmp sgt i32 %1, 0
br i1 %9, label %10, label %18
10: ; preds = %3
%11 = bitcast i8** %2 to i8*
%12 = getelementptr i8*, i8** %6, i64 3
%13 = bitcast i8** %12 to i8*
%14 = zext i32 %1 to i64
%15 = shl nuw nsw i64 %14, 3
%16 = add nuw i32 %1, 3
%17 = zext i32 %16 to i64
br label %18
18: ; preds = %10, %3
%19 = phi i64 [ 3, %3 ], [ %17, %10 ]
%20 = getelementptr inbounds i8*, i8** %6, i64 %19
store i8* null, i8** %20
%21 = call i32 @execvp(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8** %6)
ret void
}