#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*/ printf(char *, char *);
int /*<<< orphan*/ sprintf(char *, char *, char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
void post_login_redraw_index_screen(char *application_name, char *location,
                                    char *message) {
  char local_location[128];
  if (location) {
    strcpy(local_location, location);
    sprintf(local_location, "%s?%s", location, message);
  } else {
    sprintf(local_location, "/appaserver/%s/index.php?%s", application_name,
            message);
  }
  printf(
      "Content-type: text/html						\n"
      "\n"
      "<html>								"
      "	\n"
      "<script type=\"text/javascript\">				"
      "	\n"
      "window.location = \"%s\"						\n"
      "</script>							"
      "	\n"
      "</html>								\n",
      local_location);
}


x86 assembly (clang, -O0):
<post_login_redraw_index_screen>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1182 <post_login_redraw_index_screen+0x52>
lea    -0xa0(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1030 <strcpy@plt>
lea    -0xa0(%rbp),%rdi
mov    -0x10(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xe88(%rip),%rsi
call   1050 <sprintf@plt>
jmp    119d <post_login_redraw_index_screen+0x6d>
lea    -0xa0(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x18(%rbp),%rcx
lea    0xe6e(%rip),%rsi
call   1050 <sprintf@plt>
lea    -0xa0(%rbp),%rsi
lea    0xe77(%rip),%rdi
call   1040 <printf@plt>
add    $0xa0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<post_login_redraw_index_screen>:
push   %r15
push   %r14
push   %rbx
sub    $0x80,%rsp
mov    %rdx,%r14
test   %rsi,%rsi
je     1161 <post_login_redraw_index_screen+0x31>
mov    %rsi,%rbx
mov    %rsp,%r15
mov    %r15,%rdi
call   1030 <strcpy@plt>
lea    0xea7(%rip),%rsi
mov    %r15,%rdi
mov    %rbx,%rdx
jmp    116e <post_login_redraw_index_screen+0x3e>
mov    %rdi,%rdx
lea    0xe9b(%rip),%rsi
mov    %rsp,%rdi
mov    %r14,%rcx
call   1050 <sprintf@plt>
lea    0xea5(%rip),%rdi
mov    %rsp,%rsi
call   1040 <printf@plt>
add    $0x80,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"%s?%s\00"
@.str.1 = [28 x i8] c"/appaserver/%s/index.php?%s\00"
@.str.2 = [148 x i8] c"Content-type: text/html\09\09\09\09\09\09\0A\0A<html>\09\09\09\09\09\09\09\09\09\0A<script type=\22text/javascript\22>\09\09\09\09\09\0Awindow.location = \22%s\22\09\09\09\09\09\09\0A</script>\09\09\09\09\09\09\09\09\0A</html>\09\09\09\09\09\09\09\09\0A\00"
define void @post_login_redraw_index_screen(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca [128 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = load i8*, i8** %5
%9 = icmp ne i8* %8, null
br i1 %9, label %10, label %18
10: ; preds = %3
%11 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%12 = load i8*, i8** %5
%13 = call i32 @strcpy(i8* %11, i8* %12)
%14 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%15 = load i8*, i8** %5
%16 = load i8*, i8** %6
%17 = call i32 @sprintf(i8* %14, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %15, i8* %16)
br label %23
18: ; preds = %3
%19 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%20 = load i8*, i8** %4
%21 = load i8*, i8** %6
%22 = call i32 @sprintf(i8* %19, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %20, i8* %21)
br label %23
23: ; preds = %18, %10
%24 = getelementptr inbounds [128 x i8], [128 x i8]* %7, i64 0, i64 0
%25 = call i32 @printf(i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.2, i64 0, i64 0), i8* %24)
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"%s?%s\00"
@.str.1 = [28 x i8] c"/appaserver/%s/index.php?%s\00"
@.str.2 = [148 x i8] c"Content-type: text/html\09\09\09\09\09\09\0A\0A<html>\09\09\09\09\09\09\09\09\09\0A<script type=\22text/javascript\22>\09\09\09\09\09\0Awindow.location = \22%s\22\09\09\09\09\09\09\0A</script>\09\09\09\09\09\09\09\09\0A</html>\09\09\09\09\09\09\09\09\0A\00"
define void @post_login_redraw_index_screen(i8* %0, i8* %1, i8* %2) {
%4 = alloca [128 x i8]
%5 = getelementptr inbounds [128 x i8], [128 x i8]* %4, i64 0, i64 0
%6 = icmp eq i8* %1, null
br i1 %6, label %10, label %7
7: ; preds = %3
%8 = call i32 @strcpy(i8* %5, i8* %1)
%9 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %2)
br label %12
10: ; preds = %3
%11 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.1, i64 0, i64 0), i8* %0, i8* %2)
br label %12
12: ; preds = %10, %7
%13 = call i32 @printf(i8* getelementptr inbounds ([148 x i8], [148 x i8]* @.str.2, i64 0, i64 0), i8* %5)
ret void
}