#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 send(int, char *, int /*<<< orphan*/, int /*<<< orphan*/);
int /*<<< orphan*/ sprintf(char *, char *);
int /*<<< orphan*/ strlen(char *);
int http_close(int connection, const char *host) {
  static char http_buffer[255];
  sprintf(http_buffer, "Connection: close\r\n\r\n");
  if (send(connection, http_buffer, strlen(http_buffer), 0) == -1) {
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<http_close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0x2f0a(%rip),%rdi
lea    0xeb3(%rip),%rsi
call   1050 <sprintf@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
lea    0x2ef1(%rip),%rdi
call   1030 <strlen@plt>
mov    -0x14(%rbp),%edi
mov    %eax,%edx
lea    0x2ee0(%rip),%rsi
xor    %ecx,%ecx
call   1040 <send@plt>
cmp    $0xffffffff,%eax
jne    118c <http_close+0x5c>
movl   $0xffffffff,-0x4(%rbp)
jmp    1193 <http_close+0x63>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<http_close>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
movups 0xed3(%rip),%xmm0
movaps %xmm0,0x2f0c(%rip)
movabs $0xa0d0a0d65736f,%rax
mov    %rax,0x2f09(%rip)
lea    0x2ef4(%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    %ecx,%ecx
cmp    $0xffffffff,%eax
sete   %cl
neg    %ecx
mov    %ecx,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@http_close.http_buffer = internal global [255 x i8] zeroinitializer
@.str = [22 x i8] c"Connection: close\0D\0A\0D\0A\00"
define i32 @http_close(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8*
store i32 %0, i32* %4
store i8* %1, i8** %5
%6 = call i32 @sprintf(i8* getelementptr inbounds ([255 x i8], [255 x i8]* @http_close.http_buffer, i64 0, i64 0), i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0))
%7 = load i32, i32* %4
%8 = call i32 @strlen(i8* getelementptr inbounds ([255 x i8], [255 x i8]* @http_close.http_buffer, i64 0, i64 0))
%9 = call i32 @send(i32 %7, i8* getelementptr inbounds ([255 x i8], [255 x i8]* @http_close.http_buffer, i64 0, i64 0), i32 %8, i32 0)
%10 = icmp eq i32 %9, -1
br i1 %10, label %11, label %12
11: ; preds = %2
store i32 -1, i32* %3
br label %13
12: ; preds = %2
store i32 0, i32* %3
br label %13
13: ; preds = %12, %11
%14 = load i32, i32* %3
ret i32 %14
}

LLVM IR (-O2):
@http_close.http_buffer = internal global [255 x i8] zeroinitializer
@.str = [22 x i8] c"Connection: close\0D\0A\0D\0A\00"
define i32 @http_close(i32 %0, i8* nocapture readnone %1) {
tail call void @llvm.memcpy.p0i8.p0i8.i64(i8* align 16 dereferenceable(22) getelementptr inbounds ([255 x i8], [255 x i8]* @http_close.http_buffer, i64 0, i64 0), i8* align 1 dereferenceable(22) getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i64 22, i1 false)
%3 = tail call i32 @strlen(i8* getelementptr inbounds ([255 x i8], [255 x i8]* @http_close.http_buffer, i64 0, i64 0))
%4 = tail call i32 @send(i32 %0, i8* getelementptr inbounds ([255 x i8], [255 x i8]* @http_close.http_buffer, i64 0, i64 0), i32 %3, i32 0)
%5 = icmp eq i32 %4, -1
%6 = sext i1 %5 to i32
ret i32 %6
}