gocsh(t, cp, xecenv) register char **t, *cp, **xecenv;
{
  char *newt[1000];
  register char **p;
  register int i;
  for (i = 0; t[i]; i++)
    newt[i + 1] = t[i];
  newt[i + 1] = 0;
  newt[0] = "/bin/csh";
  newt[1] = cp;
  execve("/bin/csh", newt, xecenv);
  exit(33);
}


x86 assembly (clang, -O0):
<gocsh>:
push   %rbp
mov    %rsp,%rbp
sub    $0x1f70,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1f6c(%rbp)
mov    -0x8(%rbp),%rax
movslq -0x1f6c(%rbp),%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     118d <gocsh+0x6d>
mov    -0x8(%rbp),%rax
movslq -0x1f6c(%rbp),%rcx
mov    (%rax,%rcx,8),%rcx
mov    -0x1f6c(%rbp),%eax
add    $0x1,%eax
cltq
mov    %rcx,-0x1f60(%rbp,%rax,8)
ff
mov    -0x1f6c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1f6c(%rbp)
jmp    1141 <gocsh+0x21>
mov    -0x1f6c(%rbp),%eax
add    $0x1,%eax
cltq
movq   $0x0,-0x1f60(%rbp,%rax,8)
lea    0xe55(%rip),%rax
mov    %rax,-0x1f60(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x1f58(%rbp)
lea    -0x1f60(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xe31(%rip),%rdi
mov    $0x0,%al
call   1030 <execve@plt>
mov    $0x21,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<gocsh>:
sub    $0x1f48,%rsp
mov    (%rdi),%rax
mov    $0x1,%ecx
test   %rax,%rax
je     1153 <gocsh+0x33>
mov    $0x1,%ecx
nopl   0x0(%rax)
mov    %rax,(%rsp,%rcx,8)
mov    (%rdi,%rcx,8),%rax
add    $0x1,%rcx
test   %rax,%rax
jne    1140 <gocsh+0x20>
mov    %ecx,%ecx
movq   $0x0,(%rsp,%rcx,8)
lea    0xe9e(%rip),%rdi
mov    %rdi,(%rsp)
mov    %rsi,0x8(%rsp)
mov    %rsp,%rsi
xor    %eax,%eax
call   1030 <execve@plt>
mov    $0x21,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"/bin/csh\00"
define i32 @gocsh(i8** %0, i8* %1, i8** %2) {
%4 = alloca i8**
%5 = alloca i8*
%6 = alloca i8**
%7 = alloca [1000 x i8*]
%8 = alloca i8**
%9 = alloca i32
store i8** %0, i8*** %4
store i8* %1, i8** %5
store i8** %2, i8*** %6
store i32 0, i32* %9
br label %10
10: ; preds = %27, %3
%11 = load i8**, i8*** %4
%12 = load i32, i32* %9
%13 = sext i32 %12 to i64
%14 = getelementptr inbounds i8*, i8** %11, i64 %13
%15 = load i8*, i8** %14
%16 = icmp ne i8* %15, null
br i1 %16, label %17, label %30
17: ; preds = %10
%18 = load i8**, i8*** %4
%19 = load i32, i32* %9
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds i8*, i8** %18, i64 %20
%22 = load i8*, i8** %21
%23 = load i32, i32* %9
%24 = add nsw i32 %23, 1
%25 = sext i32 %24 to i64
%26 = getelementptr inbounds [1000 x i8*], [1000 x i8*]* %7, i64 0, i64 %25
store i8* %22, i8** %26
br label %27
27: ; preds = %17
%28 = load i32, i32* %9
%29 = add nsw i32 %28, 1
store i32 %29, i32* %9
br label %10
30: ; preds = %10
%31 = load i32, i32* %9
%32 = add nsw i32 %31, 1
%33 = sext i32 %32 to i64
%34 = getelementptr inbounds [1000 x i8*], [1000 x i8*]* %7, i64 0, i64 %33
store i8* null, i8** %34
%35 = getelementptr inbounds [1000 x i8*], [1000 x i8*]* %7, i64 0, i64 0
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %35
%36 = load i8*, i8** %5
%37 = getelementptr inbounds [1000 x i8*], [1000 x i8*]* %7, i64 0, i64 1
store i8* %36, i8** %37
%38 = getelementptr inbounds [1000 x i8*], [1000 x i8*]* %7, i64 0, i64 0
%39 = load i8**, i8*** %6
%40 = call i32 (i8*, i8**, i8**, ...) bitcast (i32 (...)* @execve to i32 (i8*, i8**, i8**, ...)*)(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %38, i8** %39)
unreachable
}

LLVM IR (-O2):
@.str = [9 x i8] c"/bin/csh\00"
define i32 @gocsh(i8** nocapture %0, i8* %1, i8** %2) {
%4 = alloca [1000 x i8*]
%5 = bitcast [1000 x i8*]* %4 to i8*
%6 = load i8*, i8** %0
%7 = icmp eq i8* %6, null
br i1 %7, label %19, label %8
8: ; preds = %3, %8
%9 = phi i64 [ %11, %8 ], [ 0, %3 ]
%10 = phi i8* [ %14, %8 ], [ %6, %3 ]
%11 = add nuw nsw i64 %9, 1
%12 = getelementptr inbounds [1000 x i8*], [1000 x i8*]* %4, i64 0, i64 %11
store i8* %10, i8** %12
%13 = getelementptr inbounds i8*, i8** %0, i64 %11
%14 = load i8*, i8** %13
%15 = icmp eq i8* %14, null
br i1 %15, label %16, label %8
16: ; preds = %8
%17 = add nuw i64 %9, 2
%18 = and i64 %17, 4294967295
br label %19
19: ; preds = %16, %3
%20 = phi i64 [ 1, %3 ], [ %18, %16 ]
%21 = getelementptr inbounds [1000 x i8*], [1000 x i8*]* %4, i64 0, i64 %20
store i8* null, i8** %21
%22 = getelementptr inbounds [1000 x i8*], [1000 x i8*]* %4, i64 0, i64 0
store i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %22
%23 = getelementptr inbounds [1000 x i8*], [1000 x i8*]* %4, i64 0, i64 1
store i8* %1, i8** %23
%24 = call i32 (i8*, i8**, i8**, ...) bitcast (i32 (...)* @execve to i32 (i8*, i8**, i8**, ...)*)(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8** %22, i8** %2)
unreachable
}