#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*/ uint8_t;

/* Variables and functions */
int get_payload_size(int /*<<< orphan*/ *);
int /*<<< orphan*/ initiate_connection_2_cloud();
int /*<<< orphan*/ kill_connection_2_cloud();
int /*<<< orphan*/ *prep_uart_data();
int /*<<< orphan*/ print_uart_data(int /*<<< orphan*/ *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ send_data_2_cloud(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ sleep(int);
int main(int argc, char *argv[]) {
  int len = 0;
  uint8_t *buffer = NULL;
  initiate_connection_2_cloud();
  while (1) {
    printf("hello testing\n");
    buffer = prep_uart_data();
    len = get_payload_size(buffer);
    print_uart_data(buffer);
    send_data_2_cloud(buffer, len);
    sleep(5);
  }
  kill_connection_2_cloud();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movq   $0x0,-0x20(%rbp)
mov    $0x0,%al
call   1050 <initiate_connection_2_cloud@plt>
lea    0xe5d(%rip),%rdi
call   1040 <printf@plt>
mov    $0x0,%al
call   1060 <prep_uart_data@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <get_payload_size@plt>
mov    %eax,-0x14(%rbp)
mov    -0x20(%rbp),%rdi
call   1080 <print_uart_data@plt>
mov    -0x20(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1070 <send_data_2_cloud@plt>
mov    $0x5,%edi
call   1090 <sleep@plt>
jmp    119c <main+0x2c>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
xor    %eax,%eax
call   1050 <initiate_connection_2_cloud@plt>
lea    0xe7e(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
call   1040 <puts@plt>
xor    %eax,%eax
call   1060 <prep_uart_data@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1030 <get_payload_size@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1080 <print_uart_data@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
call   1070 <send_data_2_cloud@plt>
mov    $0x5,%edi
call   1090 <sleep@plt>
jmp    1190 <main+0x20>

LLVM IR (-O0):
@.str = [15 x i8] c"hello testing\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32*
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 0, i32* %6
store i32* null, i32** %7
%8 = call i32 (...) @initiate_connection_2_cloud()
br label %9
9: ; preds = %2, %9
%10 = call i32 @printf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
%11 = call i32* (...) @prep_uart_data()
store i32* %11, i32** %7
%12 = load i32*, i32** %7
%13 = call i32 @get_payload_size(i32* %12)
store i32 %13, i32* %6
%14 = load i32*, i32** %7
%15 = call i32 @print_uart_data(i32* %14)
%16 = load i32*, i32** %7
%17 = load i32, i32* %6
%18 = call i32 @send_data_2_cloud(i32* %16, i32 %17)
%19 = call i32 @sleep(i32 5)
br label %9
}

LLVM IR (-O2):
@str = [14 x i8] c"hello testing\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @initiate_connection_2_cloud()
br label %4
4: ; preds = %4, %2
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @str, i64 0, i64 0))
%6 = tail call i32* (...) @prep_uart_data()
%7 = tail call i32 @get_payload_size(i32* %6)
%8 = tail call i32 @print_uart_data(i32* %6)
%9 = tail call i32 @send_data_2_cloud(i32* %6, i32 %7)
%10 = tail call i32 @sleep(i32 5)
br label %4
}