#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*/ sprintf(char *, char *, char *, ...);
int /*<<< orphan*/ strlen(char *);
int /*<<< orphan*/ write(int, char *, int /*<<< orphan*/);
int returnErro(int client_socket, char *mensagem, int request_check) {
  char buffer[100];
  sprintf(buffer, "<html>\n<head>\n<title>%s Erro %d</title>\n</head>\n\n",
          "Fernando & Audemar WebServer", request_check);
  write(client_socket, buffer, strlen(buffer));
  sprintf(buffer, "<body>\n<h1>%s Erro %d</h1>\n",
          "Fernando & Audemar WebServer", request_check);
  write(client_socket, buffer, strlen(buffer));
  sprintf(buffer, "<p>%s</p>\n</body>\n</html>\n", mensagem);
  write(client_socket, buffer, strlen(buffer));
  return 0;
}


x86 assembly (clang, -O0):
<returnErro>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
lea    -0x80(%rbp),%rdi
mov    -0x14(%rbp),%ecx
lea    0xead(%rip),%rsi
lea    0xed8(%rip),%rdx
mov    $0x0,%al
call   1050 <sprintf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0xac(%rbp)
lea    -0x80(%rbp),%rax
mov    %rax,-0xa8(%rbp)
lea    -0x80(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0xac(%rbp),%edi
mov    -0xa8(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
lea    -0x80(%rbp),%rdi
mov    -0x14(%rbp),%ecx
lea    0xeaf(%rip),%rsi
lea    0xe8b(%rip),%rdx
mov    $0x0,%al
call   1050 <sprintf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x9c(%rbp)
lea    -0x80(%rbp),%rax
mov    %rax,-0x98(%rbp)
lea    -0x80(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x9c(%rbp),%edi
mov    -0x98(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
lea    -0x80(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xe7d(%rip),%rsi
mov    $0x0,%al
call   1050 <sprintf@plt>
mov    -0x4(%rbp),%eax
mov    %eax,-0x8c(%rbp)
lea    -0x80(%rbp),%rax
mov    %rax,-0x88(%rbp)
lea    -0x80(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x8c(%rbp),%edi
mov    -0x88(%rbp),%rsi
mov    %eax,%edx
call   1030 <write@plt>
xor    %eax,%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<returnErro>:
push   %rbp
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x70,%rsp
mov    %edx,%ebp
mov    %rsi,%r14
mov    %edi,%r15d
lea    0xeb5(%rip),%rsi
lea    0xee0(%rip),%r12
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    %r12,%rdx
mov    %ebp,%ecx
xor    %eax,%eax
call   1050 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
lea    0xecf(%rip),%rsi
mov    %rbx,%rdi
mov    %r12,%rdx
mov    %ebp,%ecx
xor    %eax,%eax
call   1050 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
lea    0xec0(%rip),%rsi
mov    %rbx,%rdi
mov    %r14,%rdx
xor    %eax,%eax
call   1050 <sprintf@plt>
mov    %rbx,%rdi
call   1040 <strlen@plt>
mov    %r15d,%edi
mov    %rbx,%rsi
mov    %eax,%edx
call   1030 <write@plt>
xor    %eax,%eax
add    $0x70,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [50 x i8] c"<html>\0A<head>\0A<title>%s Erro %d</title>\0A</head>\0A\0A\00"
@.str.1 = [29 x i8] c"Fernando & Audemar WebServer\00"
@.str.2 = [28 x i8] c"<body>\0A<h1>%s Erro %d</h1>\0A\00"
@.str.3 = [27 x i8] c"<p>%s</p>\0A</body>\0A</html>\0A\00"
define i32 @returnErro(i32 %0, i8* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca [100 x i8]
store i32 %0, i32* %4
store i8* %1, i8** %5
store i32 %2, i32* %6
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%9 = load i32, i32* %6
%10 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %8, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %9)
%11 = load i32, i32* %4
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%13 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%14 = call i32 @strlen(i8* %13)
%15 = call i32 @write(i32 %11, i8* %12, i32 %14)
%16 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%17 = load i32, i32* %6
%18 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %16, i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %17)
%19 = load i32, i32* %4
%20 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%21 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%22 = call i32 @strlen(i8* %21)
%23 = call i32 @write(i32 %19, i8* %20, i32 %22)
%24 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%25 = load i8*, i8** %5
%26 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %24, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* %25)
%27 = load i32, i32* %4
%28 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%29 = getelementptr inbounds [100 x i8], [100 x i8]* %7, i64 0, i64 0
%30 = call i32 @strlen(i8* %29)
%31 = call i32 @write(i32 %27, i8* %28, i32 %30)
ret i32 0
}

LLVM IR (-O2):
@.str = [50 x i8] c"<html>\0A<head>\0A<title>%s Erro %d</title>\0A</head>\0A\0A\00"
@.str.1 = [29 x i8] c"Fernando & Audemar WebServer\00"
@.str.2 = [28 x i8] c"<body>\0A<h1>%s Erro %d</h1>\0A\00"
@.str.3 = [27 x i8] c"<p>%s</p>\0A</body>\0A</html>\0A\00"
define i32 @returnErro(i32 %0, i8* %1, i32 %2) {
%4 = alloca [100 x i8]
%5 = getelementptr inbounds [100 x i8], [100 x i8]* %4, i64 0, i64 0
%6 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %2)
%7 = call i32 @strlen(i8* %5)
%8 = call i32 @write(i32 %0, i8* %5, i32 %7)
%9 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str.1, i64 0, i64 0), i32 %2)
%10 = call i32 @strlen(i8* %5)
%11 = call i32 @write(i32 %0, i8* %5, i32 %10)
%12 = call i32 (i8*, i8*, i8*, ...) @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* %1)
%13 = call i32 @strlen(i8* %5)
%14 = call i32 @write(i32 %0, i8* %5, i32 %13)
ret i32 0
}