#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*/ postToServer(char const *, int, char *);
int /*<<< orphan*/ sprintf(char *, char const *, float, ...);
int /*<<< orphan*/ strlen(char *);
void postWeather(float temperature, float pressure, char const *uuid) {
  int portno = 80;
  char const *host = "192.168.1.20";
  char const *message_fmt =
      "POST /weather/newmeasurement.php HTTP/1.0\r\nContent-Type: "
      "application/x-www-form-urlencoded\r\nContent-Length: %d\r\n\r\n%s\r\n";
  char message[1024];
  char data[255];
  sprintf(data, "temperature=%.2f&pressure=%.2f&uuid=%s", temperature, pressure,
          uuid);
  sprintf(message, message_fmt, strlen(data), data);
  postToServer(host, portno, message);
}


x86 assembly (clang, -O0):
<postWeather>:
push   %rbp
mov    %rsp,%rbp
sub    $0x540,%rsp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
mov    %rdi,-0x10(%rbp)
movl   $0x50,-0x14(%rbp)
lea    0xea9(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    0xeab(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    -0x530(%rbp),%rdi
movss  -0x4(%rbp),%xmm0
movss  -0x8(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
mov    -0x10(%rbp),%rdx
lea    0xefe(%rip),%rsi
mov    $0x2,%al
call   1040 <sprintf@plt>
lea    -0x430(%rbp),%rax
mov    %rax,-0x540(%rbp)
mov    -0x28(%rbp),%rax
mov    %rax,-0x538(%rbp)
lea    -0x530(%rbp),%rdi
call   1030 <strlen@plt>
mov    -0x540(%rbp),%rdi
mov    -0x538(%rbp),%rsi
cvtsi2ss %eax,%xmm0
lea    -0x530(%rbp),%rdx
mov    $0x1,%al
call   1040 <sprintf@plt>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
lea    -0x430(%rbp),%rdx
call   1050 <postToServer@plt>
add    $0x540,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<postWeather>:
push   %r14
push   %rbx
sub    $0x508,%rsp
mov    %rdi,%rdx
cvtss2sd %xmm1,%xmm1
lea    0xf3c(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x2,%al
call   1040 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <strlen@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
lea    0xea2(%rip),%rsi
lea    0x100(%rsp),%r14
mov    %r14,%rdi
mov    %rbx,%rdx
mov    $0x1,%al
call   1040 <sprintf@plt>
lea    0xe79(%rip),%rdi
mov    $0x50,%esi
mov    %r14,%rdx
call   1050 <postToServer@plt>
add    $0x508,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [13 x i8] c"192.168.1.20\00"
@.str.1 = [119 x i8] c"POST /weather/newmeasurement.php HTTP/1.0\0D\0AContent-Type: application/x-www-form-urlencoded\0D\0AContent-Length: %d\0D\0A\0D\0A%s\0D\0A\00"
@.str.2 = [39 x i8] c"temperature=%.2f&pressure=%.2f&uuid=%s\00"
define void @postWeather(float %0, float %1, i8* %2) {
%4 = alloca float
%5 = alloca float
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i8*
%9 = alloca i8*
%10 = alloca [1024 x i8]
%11 = alloca [255 x i8]
store float %0, float* %4
store float %1, float* %5
store i8* %2, i8** %6
store i32 80, i32* %7
store i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8** %8
store i8* getelementptr inbounds ([119 x i8], [119 x i8]* @.str.1, i64 0, i64 0), i8** %9
%12 = getelementptr inbounds [255 x i8], [255 x i8]* %11, i64 0, i64 0
%13 = load float, float* %4
%14 = load float, float* %5
%15 = fpext float %14 to double
%16 = load i8*, i8** %6
%17 = call i32 (i8*, i8*, float, ...) @sprintf(i8* %12, i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), float %13, double %15, i8* %16)
%18 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%19 = load i8*, i8** %9
%20 = getelementptr inbounds [255 x i8], [255 x i8]* %11, i64 0, i64 0
%21 = call i32 @strlen(i8* %20)
%22 = sitofp i32 %21 to float
%23 = getelementptr inbounds [255 x i8], [255 x i8]* %11, i64 0, i64 0
%24 = call i32 (i8*, i8*, float, ...) @sprintf(i8* %18, i8* %19, float %22, i8* %23)
%25 = load i8*, i8** %8
%26 = load i32, i32* %7
%27 = getelementptr inbounds [1024 x i8], [1024 x i8]* %10, i64 0, i64 0
%28 = call i32 @postToServer(i8* %25, i32 %26, i8* %27)
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"192.168.1.20\00"
@.str.1 = [119 x i8] c"POST /weather/newmeasurement.php HTTP/1.0\0D\0AContent-Type: application/x-www-form-urlencoded\0D\0AContent-Length: %d\0D\0A\0D\0A%s\0D\0A\00"
@.str.2 = [39 x i8] c"temperature=%.2f&pressure=%.2f&uuid=%s\00"
define void @postWeather(float %0, float %1, i8* %2) {
%4 = alloca [1024 x i8]
%5 = alloca [255 x i8]
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %4, i64 0, i64 0
%7 = getelementptr inbounds [255 x i8], [255 x i8]* %5, i64 0, i64 0
%8 = fpext float %1 to double
%9 = call i32 (i8*, i8*, float, ...) @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str.2, i64 0, i64 0), float %0, double %8, i8* %2)
%10 = call i32 @strlen(i8* %7)
%11 = sitofp i32 %10 to float
%12 = call i32 (i8*, i8*, float, ...) @sprintf(i8* %6, i8* dereferenceable(1) getelementptr inbounds ([119 x i8], [119 x i8]* @.str.1, i64 0, i64 0), float %11, i8* %7)
%13 = call i32 @postToServer(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 80, i8* %6)
ret void
}