#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*/ discardheaders(int);
int /*<<< orphan*/ headers(int, char *);
int /*<<< orphan*/ http_exit();
int /*<<< orphan*/ send(int, char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ strlen(char *);
int webapi_http_exit(void *arg, int s, char *method, char *url, char *query) {
  char *html = "<HTML><HEAD><TITLE>http exited\r\n "
               "</TITLE></HEAD>\r\n"
               "<BODY><P>the http server is shutdown.\r\n"
               "</BODY></HTML>\r\n";
  ;
  discardheaders(s);
  headers(s, "text/html");
  send(s, html, strlen(html), 0);
  http_exit();
  return 0;
}


x86 assembly (clang, -O0):
<webapi_http_exit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %r8,-0x28(%rbp)
lea    0xe8e(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    -0xc(%rbp),%edi
call   1060 <discardheaders@plt>
mov    -0xc(%rbp),%edi
lea    0xee2(%rip),%rsi
call   1050 <headers@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x3c(%rbp)
mov    -0x30(%rbp),%rax
mov    %rax,-0x38(%rbp)
mov    -0x30(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x3c(%rbp),%edi
mov    -0x38(%rbp),%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1040 <send@plt>
mov    $0x0,%al
call   1070 <http_exit@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<webapi_http_exit>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %esi,%edi
call   1060 <discardheaders@plt>
lea    0xf06(%rip),%rsi
mov    %ebx,%edi
call   1050 <headers@plt>
lea    0xe8e(%rip),%r14
mov    %r14,%rdi
call   1030 <strlen@plt>
mov    %ebx,%edi
mov    %r14,%rsi
mov    %eax,%edx
xor    %ecx,%ecx
call   1040 <send@plt>
xor    %eax,%eax
call   1070 <http_exit@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [106 x i8] c"<HTML><HEAD><TITLE>http exited\0D\0A </TITLE></HEAD>\0D\0A<BODY><P>the http server is shutdown.\0D\0A</BODY></HTML>\0D\0A\00"
@.str.1 = [10 x i8] c"text/html\00"
define i32 @webapi_http_exit(i8* %0, i32 %1, i8* %2, i8* %3, i8* %4) {
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca i8*
%11 = alloca i8*
store i8* %0, i8** %6
store i32 %1, i32* %7
store i8* %2, i8** %8
store i8* %3, i8** %9
store i8* %4, i8** %10
store i8* getelementptr inbounds ([106 x i8], [106 x i8]* @.str, i64 0, i64 0), i8** %11
%12 = load i32, i32* %7
%13 = call i32 @discardheaders(i32 %12)
%14 = load i32, i32* %7
%15 = call i32 @headers(i32 %14, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%16 = load i32, i32* %7
%17 = load i8*, i8** %11
%18 = load i8*, i8** %11
%19 = call i32 @strlen(i8* %18)
%20 = call i32 @send(i32 %16, i8* %17, i32 %19, i32 0)
%21 = call i32 (...) @http_exit()
ret i32 0
}

LLVM IR (-O2):
@.str = [106 x i8] c"<HTML><HEAD><TITLE>http exited\0D\0A </TITLE></HEAD>\0D\0A<BODY><P>the http server is shutdown.\0D\0A</BODY></HTML>\0D\0A\00"
@.str.1 = [10 x i8] c"text/html\00"
define i32 @webapi_http_exit(i8* nocapture readnone %0, i32 %1, i8* nocapture readnone %2, i8* nocapture readnone %3, i8* nocapture readnone %4) {
%6 = tail call i32 @discardheaders(i32 %1)
%7 = tail call i32 @headers(i32 %1, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0))
%8 = tail call i32 @strlen(i8* getelementptr inbounds ([106 x i8], [106 x i8]* @.str, i64 0, i64 0))
%9 = tail call i32 @send(i32 %1, i8* getelementptr inbounds ([106 x i8], [106 x i8]* @.str, i64 0, i64 0), i32 %8, i32 0)
%10 = tail call i32 (...) @http_exit()
ret i32 0
}