#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 */
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int EXIT_FAILURE;
int EXIT_SUCCESS;
int /*<<< orphan*/ humConvert(int /*<<< orphan*/, int /*<<< orphan*/, float *,
                              float *);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ strcat(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
int /*<<< orphan*/ strtol(char *, int /*<<< orphan*/ *, int);
int main(int argc, char *argv[]) {
  if (argc != 5) {
    printf("Incorrect arguments. Expected something like 'e0 08 48 0c'.\n");
    return EXIT_FAILURE;
  }
  char buf[5];
  strcpy(buf, argv[2]);
  strcat(buf, argv[1]);
  uint16_t rawTemp = strtol(buf, NULL, 16);
  strcpy(buf, argv[4]);
  strcat(buf, argv[3]);
  uint16_t rawHum = strtol(buf, NULL, 16);
  float temp, hum;
  humConvert(rawTemp, rawHum, &temp, &hum);
  printf("Temperature: %.1f\nHumidity: %.1f\n", temp, hum);
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x5,-0x8(%rbp)
je     118f <main+0x3f>
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
mov    0x2e5b(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    123c <main+0xec>
lea    -0x15(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x10(%rax),%rsi
call   1030 <strcpy@plt>
lea    -0x15(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rsi
call   1070 <strcat@plt>
lea    -0x15(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x10,%edx
call   1060 <strtol@plt>
mov    %eax,-0x1c(%rbp)
lea    -0x15(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x20(%rax),%rsi
call   1030 <strcpy@plt>
lea    -0x15(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    0x18(%rax),%rsi
call   1070 <strcat@plt>
lea    -0x15(%rbp),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0x10,%edx
call   1060 <strtol@plt>
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%edi
mov    -0x20(%rbp),%esi
lea    -0x24(%rbp),%rdx
lea    -0x28(%rbp),%rcx
call   1040 <humConvert@plt>
movss  -0x24(%rbp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  -0x28(%rbp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe14(%rip),%rdi
mov    $0x2,%al
call   1050 <printf@plt>
mov    0x2da1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
cmp    $0x5,%edi
jne    1204 <main+0xa4>
mov    %rsi,%rbx
mov    0x10(%rsi),%rsi
lea    0xb(%rsp),%r14
mov    %r14,%rdi
call   1030 <strcpy@plt>
mov    0x8(%rbx),%rsi
mov    %r14,%rdi
call   1080 <strcat@plt>
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1070 <strtol@plt>
mov    %eax,%ebp
mov    0x20(%rbx),%rsi
mov    %r14,%rdi
call   1030 <strcpy@plt>
mov    0x18(%rbx),%rsi
mov    %r14,%rdi
call   1080 <strcat@plt>
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x10,%edx
call   1070 <strtol@plt>
lea    0x4(%rsp),%rdx
mov    %rsp,%rcx
mov    %ebp,%edi
mov    %eax,%esi
call   1050 <humConvert@plt>
movss  0x4(%rsp),%xmm0
cvtss2sd %xmm0,%xmm0
movss  (%rsp),%xmm1
cvtss2sd %xmm1,%xmm1
lea    0xe0c(%rip),%rdi
mov    $0x2,%al
call   1060 <printf@plt>
mov    0x2dd6(%rip),%rax
jmp    1217 <main+0xb7>
lea    0xe17(%rip),%rdi
call   1040 <puts@plt>
mov    0x2dc9(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [61 x i8] c"Incorrect arguments. Expected something like 'e0 08 48 0c'.\0A\00"
@EXIT_FAILURE = global i32 0
@.str.1 = [34 x i8] c"Temperature: %.1f\0AHumidity: %.1f\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [5 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = alloca float
%10 = alloca float
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 5
br i1 %12, label %13, label %16
13: ; preds = %2
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([61 x i8], [61 x i8]* @.str, i64 0, i64 0))
%15 = load i32, i32* @EXIT_FAILURE
store i32 %15, i32* %3
br label %50
16: ; preds = %2
%17 = getelementptr inbounds [5 x i8], [5 x i8]* %6, i64 0, i64 0
%18 = load i8**, i8*** %5
%19 = getelementptr inbounds i8*, i8** %18, i64 2
%20 = load i8*, i8** %19
%21 = call i32 @strcpy(i8* %17, i8* %20)
%22 = getelementptr inbounds [5 x i8], [5 x i8]* %6, i64 0, i64 0
%23 = load i8**, i8*** %5
%24 = getelementptr inbounds i8*, i8** %23, i64 1
%25 = load i8*, i8** %24
%26 = call i32 @strcat(i8* %22, i8* %25)
%27 = getelementptr inbounds [5 x i8], [5 x i8]* %6, i64 0, i64 0
%28 = call i32 @strtol(i8* %27, i32* null, i32 16)
store i32 %28, i32* %7
%29 = getelementptr inbounds [5 x i8], [5 x i8]* %6, i64 0, i64 0
%30 = load i8**, i8*** %5
%31 = getelementptr inbounds i8*, i8** %30, i64 4
%32 = load i8*, i8** %31
%33 = call i32 @strcpy(i8* %29, i8* %32)
%34 = getelementptr inbounds [5 x i8], [5 x i8]* %6, i64 0, i64 0
%35 = load i8**, i8*** %5
%36 = getelementptr inbounds i8*, i8** %35, i64 3
%37 = load i8*, i8** %36
%38 = call i32 @strcat(i8* %34, i8* %37)
%39 = getelementptr inbounds [5 x i8], [5 x i8]* %6, i64 0, i64 0
%40 = call i32 @strtol(i8* %39, i32* null, i32 16)
store i32 %40, i32* %8
%41 = load i32, i32* %7
%42 = load i32, i32* %8
%43 = call i32 @humConvert(i32 %41, i32 %42, float* %9, float* %10)
%44 = load float, float* %9
%45 = fpext float %44 to double
%46 = load float, float* %10
%47 = fpext float %46 to double
%48 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), double %45, double %47)
%49 = load i32, i32* @EXIT_SUCCESS
store i32 %49, i32* %3
br label %50
50: ; preds = %16, %13
%51 = load i32, i32* %3
ret i32 %51
}

LLVM IR (-O2):
@EXIT_FAILURE = global i32 0
@.str.1 = [34 x i8] c"Temperature: %.1f\0AHumidity: %.1f\0A\00"
@EXIT_SUCCESS = global i32 0
@str = [60 x i8] c"Incorrect arguments. Expected something like 'e0 08 48 0c'.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [5 x i8]
%4 = alloca float
%5 = alloca float
%6 = icmp eq i32 %0, 5
br i1 %6, label %10, label %7
7: ; preds = %2
%8 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([60 x i8], [60 x i8]* @str, i64 0, i64 0))
%9 = load i32, i32* @EXIT_FAILURE
br label %35
10: ; preds = %2
%11 = getelementptr inbounds [5 x i8], [5 x i8]* %3, i64 0, i64 0
%12 = getelementptr inbounds i8*, i8** %1, i64 2
%13 = load i8*, i8** %12
%14 = call i32 @strcpy(i8* %11, i8* %13)
%15 = getelementptr inbounds i8*, i8** %1, i64 1
%16 = load i8*, i8** %15
%17 = call i32 @strcat(i8* %11, i8* %16)
%18 = call i32 @strtol(i8* nocapture %11, i32* null, i32 16)
%19 = getelementptr inbounds i8*, i8** %1, i64 4
%20 = load i8*, i8** %19
%21 = call i32 @strcpy(i8* %11, i8* %20)
%22 = getelementptr inbounds i8*, i8** %1, i64 3
%23 = load i8*, i8** %22
%24 = call i32 @strcat(i8* %11, i8* %23)
%25 = call i32 @strtol(i8* nocapture %11, i32* null, i32 16)
%26 = bitcast float* %4 to i8*
%27 = bitcast float* %5 to i8*
%28 = call i32 @humConvert(i32 %18, i32 %25, float* %4, float* %5)
%29 = load float, float* %4
%30 = fpext float %29 to double
%31 = load float, float* %5
%32 = fpext float %31 to double
%33 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), double %30, double %32)
%34 = load i32, i32* @EXIT_SUCCESS
br label %35
35: ; preds = %10, %7
%36 = phi i32 [ %9, %7 ], [ %34, %10 ]
ret i32 %36
}