exportpath(val) char **val;
{
  char exppath[1024];
  exppath[0] = 0;
  if (val)
    while (*val) {
      if (strlen(*val) + strlen(exppath) + 2 > 1024) {
        shprintf("Warning: ridiculously long PATH truncated\n");
        break;
      }
      (void)strcat(exppath, *val++);
      if (*val == 0 || (strcmp(*val, ")") == 0))
        break;
      (void)strcat(exppath, ":");
    }
  setenvv("PATH", exppath);
}


x86 assembly (clang, -O0):
<exportpath>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %rdi,-0x10(%rbp)
movb   $0x0,-0x410(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     123d <exportpath+0xed>
jmp    1176 <exportpath+0x26>
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     1238 <exportpath+0xe8>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x418(%rbp)
lea    -0x410(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,%rcx
mov    -0x418(%rbp),%rax
add    %rcx,%rax
add    $0x2,%rax
cmp    $0x400,%rax
jbe    11d3 <exportpath+0x83>
lea    0xe39(%rip),%rdi
mov    $0x0,%al
call   1040 <shprintf@plt>
jmp    1238 <exportpath+0xe8>
lea    -0x410(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x8,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%rsi
call   1070 <strcat@plt>
mov    -0x10(%rbp),%rax
cmpq   $0x0,(%rax)
je     121b <exportpath+0xcb>
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
lea    0xe1e(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%eax
jne    1220 <exportpath+0xd0>
jmp    1238 <exportpath+0xe8>
lea    -0x410(%rbp),%rdi
lea    0xdff(%rip),%rsi
call   1070 <strcat@plt>
jmp    1176 <exportpath+0x26>
jmp    123d <exportpath+0xed>
lea    -0x410(%rbp),%rsi
lea    0xde4(%rip),%rdi
mov    $0x0,%al
call   1060 <setenvv@plt>
mov    -0x4(%rbp),%eax
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<exportpath>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x400,%rsp
movb   $0x0,(%rsp)
test   %rdi,%rdi
je     1216 <exportpath+0xc6>
mov    %rdi,%r14
mov    (%rdi),%rbx
test   %rbx,%rbx
je     1216 <exportpath+0xc6>
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %rax,%r15
mov    %rsp,%rdi
call   1030 <strlen@plt>
add    %r15,%rax
add    $0xfffffffffffffc01,%rax
cmp    $0xfffffffffffffbff,%rax
jb     1208 <exportpath+0xb8>
add    $0x8,%r14
mov    %rsp,%r15
lea    0xe7d(%rip),%r12
xchg   %ax,%ax
mov    %r15,%rdi
mov    %rbx,%rsi
call   1070 <strcat@plt>
mov    (%r14),%rbx
test   %rbx,%rbx
je     1216 <exportpath+0xc6>
mov    %rbx,%rdi
mov    %r12,%rsi
call   1050 <strcmp@plt>
test   %eax,%eax
je     1216 <exportpath+0xc6>
mov    %r15,%rdi
call   1030 <strlen@plt>
movw   $0x3a,(%rsp,%rax,1)
mov    %rbx,%rdi
call   1030 <strlen@plt>
mov    %rax,%r13
mov    %r15,%rdi
call   1030 <strlen@plt>
add    %r13,%rax
add    $0xfffffffffffffc01,%rax
add    $0x8,%r14
cmp    $0xfffffffffffffbff,%rax
jae    11b0 <exportpath+0x60>
lea    0xdf1(%rip),%rdi
xor    %eax,%eax
call   1040 <shprintf@plt>
lea    0xe10(%rip),%rdi
mov    %rsp,%rsi
xor    %eax,%eax
call   1060 <setenvv@plt>
add    $0x400,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [43 x i8] c"Warning: ridiculously long PATH truncated\0A\00"
@.str.1 = [2 x i8] c")\00"
@.str.2 = [2 x i8] c":\00"
@.str.3 = [5 x i8] c"PATH\00"
define i32 @exportpath(i8** %0) {
%2 = alloca i32
%3 = alloca i8**
%4 = alloca [1024 x i8]
store i8** %0, i8*** %3
%5 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
store i8 0, i8* %5
%6 = load i8**, i8*** %3
%7 = icmp ne i8** %6, null
br i1 %7, label %8, label %43
8: ; preds = %1
br label %9
9: ; preds = %39, %8
%10 = load i8**, i8*** %3
%11 = load i8*, i8** %10
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %42
13: ; preds = %9
%14 = load i8**, i8*** %3
%15 = load i8*, i8** %14
%16 = call i64 @strlen(i8* %15)
%17 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%18 = call i64 @strlen(i8* %17)
%19 = add i64 %16, %18
%20 = add i64 %19, 2
%21 = icmp ugt i64 %20, 1024
br i1 %21, label %22, label %24
22: ; preds = %13
%23 = call i32 (i8*, ...) bitcast (i32 (...)* @shprintf to i32 (i8*, ...)*)(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
br label %42
24: ; preds = %13
%25 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%26 = load i8**, i8*** %3
%27 = getelementptr inbounds i8*, i8** %26, i32 1
store i8** %27, i8*** %3
%28 = load i8*, i8** %26
%29 = call i8* @strcat(i8* %25, i8* %28)
%30 = load i8**, i8*** %3
%31 = load i8*, i8** %30
%32 = icmp eq i8* %31, null
br i1 %32, label %38, label %33
33: ; preds = %24
%34 = load i8**, i8*** %3
%35 = load i8*, i8** %34
%36 = call i32 @strcmp(i8* %35, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%37 = icmp eq i32 %36, 0
br i1 %37, label %38, label %39
38: ; preds = %33, %24
br label %42
39: ; preds = %33
%40 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%41 = call i8* @strcat(i8* %40, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
br label %9
42: ; preds = %38, %22, %9
br label %43
43: ; preds = %42, %1
%44 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%45 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @setenvv to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %44)
%46 = load i32, i32* %2
ret i32 %46
}

LLVM IR (-O2):
@.str = [43 x i8] c"Warning: ridiculously long PATH truncated\0A\00"
@.str.1 = [2 x i8] c")\00"
@.str.3 = [5 x i8] c"PATH\00"
define i32 @exportpath(i8** %0) {
%2 = alloca [1024 x i8]
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
store i8 0, i8* %3
%4 = icmp eq i8** %0, null
br i1 %4, label %35, label %5
5: ; preds = %1
%6 = load i8*, i8** %0
%7 = icmp eq i8* %6, null
br i1 %7, label %35, label %8
8: ; preds = %5
%9 = call i64 @strlen(i8* %6)
%10 = call i64 @strlen(i8* %3)
%11 = add i64 %9, -1023
%12 = add i64 %11, %10
%13 = icmp ult i64 %12, -1025
br i1 %13, label %14, label %16
14: ; preds = %26, %8
%15 = call i32 (i8*, ...) bitcast (i32 (...)* @shprintf to i32 (i8*, ...)*)(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
br label %35
16: ; preds = %8, %26
%17 = phi i8** [ %19, %26 ], [ %0, %8 ]
%18 = phi i8* [ %21, %26 ], [ %6, %8 ]
%19 = getelementptr inbounds i8*, i8** %17, i64 1
%20 = call i8* @strcat(i8* %3, i8* %18)
%21 = load i8*, i8** %19
%22 = icmp eq i8* %21, null
br i1 %22, label %35, label %23
23: ; preds = %16
%24 = call i32 @strcmp(i8* %21, i8* dereferenceable(2) getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%25 = icmp eq i32 %24, 0
br i1 %25, label %35, label %26
26: ; preds = %23
%27 = call i64 @strlen(i8* %3)
%28 = getelementptr [1024 x i8], [1024 x i8]* %2, i64 0, i64 %27
%29 = bitcast i8* %28 to i16*
store i16 58, i16* %29
%30 = call i64 @strlen(i8* %21)
%31 = call i64 @strlen(i8* %3)
%32 = add i64 %30, -1023
%33 = add i64 %32, %31
%34 = icmp ult i64 %33, -1025
br i1 %34, label %14, label %16
35: ; preds = %16, %23, %5, %14, %1
%36 = call i32 (i8*, i8*, ...) bitcast (i32 (...)* @setenvv to i32 (i8*, i8*, ...)*)(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.3, i64 0, i64 0), i8* %3)
ret i32 undef
}