#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 */
scalar_t__ cgihasversion(int, int);
int /*<<< orphan*/ cginocache();
int /*<<< orphan*/ printf(char *, ...);
void cgiredirect(const char *buf) {
  if (cgihasversion(1, 1))
    printf("Status: 303 Moved\n");
  cginocache();
  printf("URI: %s\n", buf);
  printf("Location: %s\n\n", buf);
}


x86 assembly (clang, -O0):
<cgiredirect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x1,%esi
mov    %esi,%edi
call   1050 <cgihasversion@plt>
cmp    $0x0,%rax
je     1160 <cgiredirect+0x30>
lea    0xea7(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1030 <cginocache@plt>
mov    -0x8(%rbp),%rsi
lea    0xea1(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%rsi
lea    0xe98(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cgiredirect>:
push   %rbx
mov    %rdi,%rbx
mov    $0x1,%edi
mov    $0x1,%esi
call   1060 <cgihasversion@plt>
test   %rax,%rax
je     1164 <cgiredirect+0x24>
lea    0xeb9(%rip),%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1030 <cginocache@plt>
lea    0xe8e(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
lea    0xe86(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
pop    %rbx
jmp    1050 <printf@plt>

LLVM IR (-O0):
@.str = [19 x i8] c"Status: 303 Moved\0A\00"
@.str.1 = [9 x i8] c"URI: %s\0A\00"
@.str.2 = [15 x i8] c"Location: %s\0A\0A\00"
define void @cgiredirect(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i64 @cgihasversion(i32 1, i32 1)
%4 = icmp ne i64 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %1
%8 = call i32 (...) @cginocache()
%9 = load i8*, i8** %2
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %9)
%11 = load i8*, i8** %2
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %11)
ret void
}

LLVM IR (-O2):
@.str.1 = [9 x i8] c"URI: %s\0A\00"
@.str.2 = [15 x i8] c"Location: %s\0A\0A\00"
@str = [18 x i8] c"Status: 303 Moved\00"
define void @cgiredirect(i8* %0) {
%2 = tail call i64 @cgihasversion(i32 1, i32 1)
%3 = icmp eq i64 %2, 0
br i1 %3, label %6, label %4
4: ; preds = %1
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
%7 = tail call i32 (...) @cginocache()
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([15 x i8], [15 x i8]* @.str.2, i64 0, i64 0), i8* %0)
ret void
}