#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 */
struct mg_connection {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ mg_printf_data(struct mg_connection *, char *, char *);
int /*<<< orphan*/ mg_send_header(struct mg_connection *, char *, char *);
void print_html_form(struct mg_connection *conn) {
  mg_send_header(conn, "Content-Type", "text/html");
  mg_send_header(conn, "Cache-Control",
                 "max-age=0, post-check=0, "
                 "pre-check=0, no-store, no-cache, must-revalidate");
  mg_printf_data(conn, "%s", "<html><head>");
  mg_printf_data(conn, "<script src=\"%s\"></script>",
                 "http://code.jquery.com/jquery-1.11.0.min.js");
  mg_printf_data(conn, "%s", "<script> jQuery(function() {\n");
  mg_printf_data(conn, "%s",
                 "$.ajax({ url: '/get_value', dataType: 'json', "
                 "success: function(d) { $('#val').val(d.value); }});\n");
  mg_printf_data(conn, "%s",
                 "$(document).on('click', '#button', function() {"
                 "  $.ajax({ url: '/set_value', dataType: 'json', "
                 "  data: { new_value: $('#val').val() } });\n"
                 "  return false; });\n");
  mg_printf_data(conn, "%s", "});</script>");
  mg_printf_data(conn, "%s", "</head><body>");
  mg_printf_data(conn, "%s", "<h1>Ajax form submission example</h1>");
  mg_printf_data(conn, "%s", "<form>");
  mg_printf_data(conn, "%s", "Device value: <input type=text id=val />");
  mg_printf_data(conn, "%s", "<input type=submit id=button />");
  mg_printf_data(conn, "%s", "</form>");
  mg_printf_data(conn, "%s", "</body></html>");
}


x86 assembly (clang, -O0):
<print_html_form>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
lea    0xec9(%rip),%rsi
lea    0xecf(%rip),%rdx
call   1030 <mg_send_header@plt>
mov    -0x8(%rbp),%rdi
lea    0xec9(%rip),%rsi
lea    0xed0(%rip),%rdx
call   1030 <mg_send_header@plt>
mov    -0x8(%rbp),%rdi
lea    0xf0a(%rip),%rsi
lea    0xf06(%rip),%rdx
call   1040 <mg_printf_data@plt>
mov    -0x8(%rbp),%rdi
lea    0xf03(%rip),%rsi
lea    0xf17(%rip),%rdx
call   1040 <mg_printf_data@plt>
mov    -0x8(%rbp),%rdi
lea    0xedc(%rip),%rsi
lea    0xf2c(%rip),%rdx
call   1040 <mg_printf_data@plt>
mov    -0x8(%rbp),%rdi
lea    0xec5(%rip),%rsi
lea    0xf33(%rip),%rdx
call   1040 <mg_printf_data@plt>
mov    -0x8(%rbp),%rdi
lea    0xeae(%rip),%rsi
lea    0xf7f(%rip),%rdx
call   1040 <mg_printf_data@plt>
mov    -0x8(%rbp),%rdi
lea    0xe97(%rip),%rsi
lea    0x1007(%rip),%rdx
call   1040 <mg_printf_data@plt>
mov    -0x8(%rbp),%rdi
lea    0xe80(%rip),%rsi
lea    0xffd(%rip),%rdx
call   1040 <mg_printf_data@plt>
mov    -0x8(%rbp),%rdi
lea    0xe69(%rip),%rsi
lea    0xff4(%rip),%rdx
call   1040 <mg_printf_data@plt>
mov    -0x8(%rbp),%rdi
lea    0xe52(%rip),%rsi
lea    0x1003(%rip),%rdx
call   1040 <mg_printf_data@plt>
mov    -0x8(%rbp),%rdi
lea    0xe3b(%rip),%rsi
lea    0xff3(%rip),%rdx
call   1040 <mg_printf_data@plt>
mov    -0x8(%rbp),%rdi
lea    0xe24(%rip),%rsi
lea    0x1005(%rip),%rdx
call   1040 <mg_printf_data@plt>
mov    -0x8(%rbp),%rdi
lea    0xe0d(%rip),%rsi
lea    0x100e(%rip),%rdx
call   1040 <mg_printf_data@plt>
mov    -0x8(%rbp),%rdi
lea    0xdf6(%rip),%rsi
lea    0xfff(%rip),%rdx
call   1040 <mg_printf_data@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_html_form>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
lea    0xed2(%rip),%rsi
lea    0xed8(%rip),%rdx
call   1030 <mg_send_header@plt>
lea    0xed6(%rip),%rsi
lea    0xedd(%rip),%rdx
mov    %rbx,%rdi
call   1030 <mg_send_header@plt>
lea    0xf18(%rip),%r14
lea    0xf14(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <mg_printf_data@plt>
lea    0xf0f(%rip),%rsi
lea    0xf23(%rip),%rdx
mov    %rbx,%rdi
call   1040 <mg_printf_data@plt>
lea    0xf40(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <mg_printf_data@plt>
lea    0xf4c(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <mg_printf_data@plt>
lea    0xf9d(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <mg_printf_data@plt>
lea    0x102a(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <mg_printf_data@plt>
lea    0x1025(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <mg_printf_data@plt>
lea    0x1021(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <mg_printf_data@plt>
lea    0x1035(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <mg_printf_data@plt>
lea    0x102a(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <mg_printf_data@plt>
lea    0x1041(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <mg_printf_data@plt>
lea    0x104f(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <mg_printf_data@plt>
lea    0x1045(%rip),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1040 <mg_printf_data@plt>

LLVM IR (-O0):
%struct.mg_connection = type { i32 }
@.str = [13 x i8] c"Content-Type\00"
@.str.1 = [10 x i8] c"text/html\00"
@.str.2 = [14 x i8] c"Cache-Control\00"
@.str.3 = [74 x i8] c"max-age=0, post-check=0, pre-check=0, no-store, no-cache, must-revalidate\00"
@.str.4 = [3 x i8] c"%s\00"
@.str.5 = [13 x i8] c"<html><head>\00"
@.str.6 = [27 x i8] c"<script src=\22%s\22></script>\00"
@.str.7 = [44 x i8] c"http://code.jquery.com/jquery-1.11.0.min.js\00"
@.str.8 = [30 x i8] c"<script> jQuery(function() {\0A\00"
@.str.9 = [99 x i8] c"$.ajax({ url: '/get_value', dataType: 'json', success: function(d) { $('#val').val(d.value); }});\0A\00"
@.str.10 = [159 x i8] c"$(document).on('click', '#button', function() { $.ajax({ url: '/set_value', dataType: 'json', data: { new_value: $('#val').val() } });\0A return false; });\0A\00"
@.str.11 = [13 x i8] c"});</script>\00"
@.str.12 = [14 x i8] c"</head><body>\00"
@.str.13 = [38 x i8] c"<h1>Ajax form submission example</h1>\00"
@.str.14 = [7 x i8] c"<form>\00"
@.str.15 = [41 x i8] c"Device value: <input type=text id=val />\00"
@.str.16 = [32 x i8] c"<input type=submit id=button />\00"
@.str.17 = [8 x i8] c"</form>\00"
@.str.18 = [15 x i8] c"</body></html>\00"
define void @print_html_form(%struct.mg_connection* %0) {
%2 = alloca %struct.mg_connection*
store %struct.mg_connection* %0, %struct.mg_connection** %2
%3 = load %struct.mg_connection*, %struct.mg_connection** %2
%4 = call i32 @mg_send_header(%struct.mg_connection* %3, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%5 = load %struct.mg_connection*, %struct.mg_connection** %2
%6 = call i32 @mg_send_header(%struct.mg_connection* %5, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.3, i64 0, i64 0))
%7 = load %struct.mg_connection*, %struct.mg_connection** %2
%8 = call i32 @mg_printf_data(%struct.mg_connection* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%9 = load %struct.mg_connection*, %struct.mg_connection** %2
%10 = call i32 @mg_printf_data(%struct.mg_connection* %9, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.7, i64 0, i64 0))
%11 = load %struct.mg_connection*, %struct.mg_connection** %2
%12 = call i32 @mg_printf_data(%struct.mg_connection* %11, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0))
%13 = load %struct.mg_connection*, %struct.mg_connection** %2
%14 = call i32 @mg_printf_data(%struct.mg_connection* %13, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([99 x i8], [99 x i8]* @.str.9, i64 0, i64 0))
%15 = load %struct.mg_connection*, %struct.mg_connection** %2
%16 = call i32 @mg_printf_data(%struct.mg_connection* %15, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([159 x i8], [159 x i8]* @.str.10, i64 0, i64 0))
%17 = load %struct.mg_connection*, %struct.mg_connection** %2
%18 = call i32 @mg_printf_data(%struct.mg_connection* %17, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i64 0, i64 0))
%19 = load %struct.mg_connection*, %struct.mg_connection** %2
%20 = call i32 @mg_printf_data(%struct.mg_connection* %19, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.12, i64 0, i64 0))
%21 = load %struct.mg_connection*, %struct.mg_connection** %2
%22 = call i32 @mg_printf_data(%struct.mg_connection* %21, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.13, i64 0, i64 0))
%23 = load %struct.mg_connection*, %struct.mg_connection** %2
%24 = call i32 @mg_printf_data(%struct.mg_connection* %23, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0))
%25 = load %struct.mg_connection*, %struct.mg_connection** %2
%26 = call i32 @mg_printf_data(%struct.mg_connection* %25, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.15, i64 0, i64 0))
%27 = load %struct.mg_connection*, %struct.mg_connection** %2
%28 = call i32 @mg_printf_data(%struct.mg_connection* %27, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.16, i64 0, i64 0))
%29 = load %struct.mg_connection*, %struct.mg_connection** %2
%30 = call i32 @mg_printf_data(%struct.mg_connection* %29, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.17, i64 0, i64 0))
%31 = load %struct.mg_connection*, %struct.mg_connection** %2
%32 = call i32 @mg_printf_data(%struct.mg_connection* %31, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.18, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.mg_connection = type { i32 }
@.str = [13 x i8] c"Content-Type\00"
@.str.1 = [10 x i8] c"text/html\00"
@.str.2 = [14 x i8] c"Cache-Control\00"
@.str.3 = [74 x i8] c"max-age=0, post-check=0, pre-check=0, no-store, no-cache, must-revalidate\00"
@.str.4 = [3 x i8] c"%s\00"
@.str.5 = [13 x i8] c"<html><head>\00"
@.str.6 = [27 x i8] c"<script src=\22%s\22></script>\00"
@.str.7 = [44 x i8] c"http://code.jquery.com/jquery-1.11.0.min.js\00"
@.str.8 = [30 x i8] c"<script> jQuery(function() {\0A\00"
@.str.9 = [99 x i8] c"$.ajax({ url: '/get_value', dataType: 'json', success: function(d) { $('#val').val(d.value); }});\0A\00"
@.str.10 = [159 x i8] c"$(document).on('click', '#button', function() { $.ajax({ url: '/set_value', dataType: 'json', data: { new_value: $('#val').val() } });\0A return false; });\0A\00"
@.str.11 = [13 x i8] c"});</script>\00"
@.str.12 = [14 x i8] c"</head><body>\00"
@.str.13 = [38 x i8] c"<h1>Ajax form submission example</h1>\00"
@.str.14 = [7 x i8] c"<form>\00"
@.str.15 = [41 x i8] c"Device value: <input type=text id=val />\00"
@.str.16 = [32 x i8] c"<input type=submit id=button />\00"
@.str.17 = [8 x i8] c"</form>\00"
@.str.18 = [15 x i8] c"</body></html>\00"
define void @print_html_form(%struct.mg_connection* %0) {
%2 = tail call i32 @mg_send_header(%struct.mg_connection* %0, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%3 = tail call i32 @mg_send_header(%struct.mg_connection* %0, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([74 x i8], [74 x i8]* @.str.3, i64 0, i64 0))
%4 = tail call i32 @mg_printf_data(%struct.mg_connection* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.5, i64 0, i64 0))
%5 = tail call i32 @mg_printf_data(%struct.mg_connection* %0, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0), i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str.7, i64 0, i64 0))
%6 = tail call i32 @mg_printf_data(%struct.mg_connection* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.8, i64 0, i64 0))
%7 = tail call i32 @mg_printf_data(%struct.mg_connection* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([99 x i8], [99 x i8]* @.str.9, i64 0, i64 0))
%8 = tail call i32 @mg_printf_data(%struct.mg_connection* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([159 x i8], [159 x i8]* @.str.10, i64 0, i64 0))
%9 = tail call i32 @mg_printf_data(%struct.mg_connection* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.11, i64 0, i64 0))
%10 = tail call i32 @mg_printf_data(%struct.mg_connection* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.12, i64 0, i64 0))
%11 = tail call i32 @mg_printf_data(%struct.mg_connection* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.13, i64 0, i64 0))
%12 = tail call i32 @mg_printf_data(%struct.mg_connection* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.14, i64 0, i64 0))
%13 = tail call i32 @mg_printf_data(%struct.mg_connection* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.15, i64 0, i64 0))
%14 = tail call i32 @mg_printf_data(%struct.mg_connection* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.16, i64 0, i64 0))
%15 = tail call i32 @mg_printf_data(%struct.mg_connection* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.17, i64 0, i64 0))
%16 = tail call i32 @mg_printf_data(%struct.mg_connection* %0, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.18, i64 0, i64 0))
ret void
}