#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 */
char *getLanIP();
int /*<<< orphan*/ printf(char *, ...);
void javascriptUpdate(int success) {
  printf("<script language=\"JavaScript\" type=\"text/javascript\">");
  if (success) {
    printf(" function refresh_all(){	  top.location.href = \"http://%s\"; } "
           "function update(){   self.setTimeout(\"refresh_all()\", %s);}",
           getLanIP(), "40000");
  } else {
    printf("function update(){ parent.menu.setUnderFirmwareUpload(0);}");
  }
  printf("</script>");
}


x86 assembly (clang, -O0):
<javascriptUpdate>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xece(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x0,-0x4(%rbp)
je     1167 <javascriptUpdate+0x47>
mov    $0x0,%al
call   1040 <getLanIP@plt>
mov    %rax,%rsi
lea    0xee2(%rip),%rdi
lea    0xf55(%rip),%rdx
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1175 <javascriptUpdate+0x55>
lea    0xf48(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf75(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<javascriptUpdate>:
push   %rbx
mov    %edi,%ebx
lea    0xed6(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
test   %ebx,%ebx
je     1156 <javascriptUpdate+0x36>
xor    %eax,%eax
call   1040 <getLanIP@plt>
lea    0xef3(%rip),%rdi
lea    0xf66(%rip),%rdx
mov    %rax,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
jmp    1164 <javascriptUpdate+0x44>
lea    0xf59(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xf86(%rip),%rdi
xor    %eax,%eax
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [54 x i8] c"<script language=\22JavaScript\22 type=\22text/javascript\22>\00"
@.str.1 = [122 x i8] c" function refresh_all(){\09 top.location.href = \22http://%s\22; } function update(){ self.setTimeout(\22refresh_all()\22, %s);}\00"
@.str.2 = [6 x i8] c"40000\00"
@.str.3 = [59 x i8] c"function update(){ parent.menu.setUnderFirmwareUpload(0);}\00"
@.str.4 = [10 x i8] c"</script>\00"
define void @javascriptUpdate(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* %2
%5 = icmp ne i32 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = call i8* (...) @getLanIP()
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([122 x i8], [122 x i8]* @.str.1, i64 0, i64 0), i8* %7, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %11
9: ; preds = %1
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str.3, i64 0, i64 0))
br label %11
11: ; preds = %9, %6
%12 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [54 x i8] c"<script language=\22JavaScript\22 type=\22text/javascript\22>\00"
@.str.1 = [122 x i8] c" function refresh_all(){\09 top.location.href = \22http://%s\22; } function update(){ self.setTimeout(\22refresh_all()\22, %s);}\00"
@.str.2 = [6 x i8] c"40000\00"
@.str.3 = [59 x i8] c"function update(){ parent.menu.setUnderFirmwareUpload(0);}\00"
@.str.4 = [10 x i8] c"</script>\00"
define void @javascriptUpdate(i32 %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([54 x i8], [54 x i8]* @.str, i64 0, i64 0))
%3 = icmp eq i32 %0, 0
br i1 %3, label %7, label %4
4: ; preds = %1
%5 = tail call i8* (...) @getLanIP()
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([122 x i8], [122 x i8]* @.str.1, i64 0, i64 0), i8* %5, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.2, i64 0, i64 0))
br label %9
7: ; preds = %1
%8 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([59 x i8], [59 x i8]* @.str.3, i64 0, i64 0))
br label %9
9: ; preds = %7, %4
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0))
ret void
}