void Downing(char *url) {
  if (strchr(url, ':'))
    printf("Location: ");
  else
    printf("Location: http://%s:%s", getenv("SERVER_NAME"),
           getenv("SERVER_PORT"));
  printf("%s%c%c", url, 10, 10);
  printf("This document has moved <A HREF=\"%s\">here</A>%c", url, 10);
}


x86 assembly (clang, -O0):
<Downing>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x3a,%esi
call   1040 <strchr@plt>
cmp    $0x0,%rax
je     1167 <Downing+0x37>
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
jmp    1199 <Downing+0x69>
lea    0xeb4(%rip),%rdi
mov    $0x0,%al
call   1030 <getenv@plt>
mov    %eax,-0xc(%rbp)
lea    0xeaf(%rip),%rdi
mov    $0x0,%al
call   1030 <getenv@plt>
mov    -0xc(%rbp),%esi
mov    %eax,%edx
lea    0xe79(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xe96(%rip),%rdi
mov    $0xa,%ecx
mov    %ecx,%edx
mov    $0x0,%al
call   1050 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xe84(%rip),%rdi
mov    $0xa,%edx
mov    $0x0,%al
call   1050 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Downing>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    $0x3a,%esi
call   1040 <strchr@plt>
test   %rax,%rax
je     1155 <Downing+0x25>
lea    0xeb4(%rip),%rdi
xor    %eax,%eax
call   1050 <printf@plt>
jmp    1185 <Downing+0x55>
lea    0xec6(%rip),%rdi
xor    %eax,%eax
call   1030 <getenv@plt>
mov    %eax,%ebp
lea    0xec2(%rip),%rdi
xor    %eax,%eax
call   1030 <getenv@plt>
lea    0xe91(%rip),%rdi
mov    %ebp,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xeae(%rip),%rdi
mov    %rbx,%rsi
mov    $0xa,%edx
mov    $0xa,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe9a(%rip),%rdi
mov    %rbx,%rsi
mov    $0xa,%edx
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <printf@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"Location: \00"
@.str.1 = [23 x i8] c"Location: http://%s:%s\00"
@.str.2 = [12 x i8] c"SERVER_NAME\00"
@.str.3 = [12 x i8] c"SERVER_PORT\00"
@.str.4 = [7 x i8] c"%s%c%c\00"
@.str.5 = [48 x i8] c"This document has moved <A HREF=\22%s\22>here</A>%c\00"
define void @Downing(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i8* @strchr(i8* %3, i32 58)
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %12
8: ; preds = %1
%9 = call i32 (i8*, ...) bitcast (i32 (...)* @getenv to i32 (i8*, ...)*)(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%10 = call i32 (i8*, ...) bitcast (i32 (...)* @getenv to i32 (i8*, ...)*)(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %9, i32 %10)
br label %12
12: ; preds = %8, %6
%13 = load i8*, i8** %2
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* %13, i32 10, i32 10)
%15 = load i8*, i8** %2
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.5, i64 0, i64 0), i8* %15, i32 10)
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"Location: \00"
@.str.1 = [23 x i8] c"Location: http://%s:%s\00"
@.str.2 = [12 x i8] c"SERVER_NAME\00"
@.str.3 = [12 x i8] c"SERVER_PORT\00"
@.str.4 = [7 x i8] c"%s%c%c\00"
@.str.5 = [48 x i8] c"This document has moved <A HREF=\22%s\22>here</A>%c\00"
define void @Downing(i8* %0) {
%2 = tail call i8* @strchr(i8* dereferenceable(1) %0, i32 58)
%3 = icmp eq i8* %2, null
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0))
br label %10
6: ; preds = %1
%7 = tail call i32 (i8*, ...) bitcast (i32 (...)* @getenv to i32 (i8*, ...)*)(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0))
%8 = tail call i32 (i8*, ...) bitcast (i32 (...)* @getenv to i32 (i8*, ...)*)(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.3, i64 0, i64 0))
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.1, i64 0, i64 0), i32 %7, i32 %8)
br label %10
10: ; preds = %6, %4
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([7 x i8], [7 x i8]* @.str.4, i64 0, i64 0), i8* %0, i32 10, i32 10)
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.5, i64 0, i64 0), i8* %0, i32 10)
ret void
}