#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 calc_size_for_unrolled_data(void *);
int calc_size_for_unrolled_lcd_data(void *);
int /*<<< orphan*/ dismiss_lcd_comm();
int /*<<< orphan*/ dismiss_wsn();
int /*<<< orphan*/ free(void *);
int /*<<< orphan*/ init_gps_stuff();
int /*<<< orphan*/ initiate_connection_2_cloud();
int /*<<< orphan*/ initiate_lcd_comm();
int /*<<< orphan*/ initiate_wsn();
int /*<<< orphan*/ kill_connection_2_cloud();
void *prep_a_set_of_wsn_data();
int /*<<< orphan*/ print_cloud_data(void *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ record_a_set_of_wsn_data(void *);
int /*<<< orphan*/ send_data_2_cloud(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ send_data_2_lcd(int /*<<< orphan*/ *, int);
int /*<<< orphan*/ sleep(int);
void *unroll_wsn_data(void *);
void *unroll_wsn_data_lcd(void *);
int main(int argc, char **argv) {
  void *wsn = NULL;
  void *wsn_flat_cloud = NULL;
  void *wsn_flat_lcd = NULL;
  int size = 0;
  sleep(5);
  init_gps_stuff();
  initiate_connection_2_cloud();
  initiate_wsn();
  initiate_lcd_comm();
  while (1) {
    printf("................\n");
    wsn = prep_a_set_of_wsn_data();
    record_a_set_of_wsn_data(wsn);
    wsn_flat_cloud = unroll_wsn_data(wsn);
    size = calc_size_for_unrolled_data(wsn);
    print_cloud_data(wsn_flat_cloud);
    send_data_2_cloud((uint8_t *)wsn_flat_cloud, size);
    wsn_flat_lcd = unroll_wsn_data_lcd(wsn);
    size = calc_size_for_unrolled_lcd_data(wsn);
    send_data_2_lcd((uint8_t *)wsn_flat_lcd, size);
    free(wsn_flat_cloud);
    free(wsn_flat_lcd);
    sleep(10);
  }
  dismiss_lcd_comm();
  dismiss_wsn();
  kill_connection_2_cloud();
  return 0;
}


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)
movq   $0x0,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
movq   $0x0,-0x28(%rbp)
movl   $0x0,-0x2c(%rbp)
mov    $0x5,%edi
call   1110 <sleep@plt>
mov    $0x0,%al
call   1070 <init_gps_stuff@plt>
mov    $0x0,%al
call   1090 <initiate_connection_2_cloud@plt>
mov    $0x0,%al
call   1120 <initiate_wsn@plt>
mov    $0x0,%al
call   10f0 <initiate_lcd_comm@plt>
lea    0xd9e(%rip),%rdi
call   1080 <printf@plt>
mov    $0x0,%al
call   1050 <prep_a_set_of_wsn_data@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1060 <record_a_set_of_wsn_data@plt>
mov    -0x18(%rbp),%rdi
call   1040 <unroll_wsn_data@plt>
mov    %rax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   10c0 <calc_size_for_unrolled_data@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x20(%rbp),%rdi
call   10a0 <print_cloud_data@plt>
mov    -0x20(%rbp),%rdi
mov    -0x2c(%rbp),%esi
call   10e0 <send_data_2_cloud@plt>
mov    -0x18(%rbp),%rdi
call   10d0 <unroll_wsn_data_lcd@plt>
mov    %rax,-0x28(%rbp)
mov    -0x18(%rbp),%rdi
call   1100 <calc_size_for_unrolled_lcd_data@plt>
mov    %eax,-0x2c(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x2c(%rbp),%esi
call   10b0 <send_data_2_lcd@plt>
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x28(%rbp),%rdi
call   1030 <free@plt>
mov    $0xa,%edi
call   1110 <sleep@plt>
jmp    125b <main+0x5b>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    $0x5,%edi
call   1110 <sleep@plt>
xor    %eax,%eax
call   1080 <init_gps_stuff@plt>
xor    %eax,%eax
call   1090 <initiate_connection_2_cloud@plt>
xor    %eax,%eax
call   1120 <initiate_wsn@plt>
xor    %eax,%eax
call   10f0 <initiate_lcd_comm@plt>
lea    0xdcc(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %r14,%rdi
call   1070 <puts@plt>
xor    %eax,%eax
call   1050 <prep_a_set_of_wsn_data@plt>
mov    %rax,%rbx
mov    %rax,%rdi
call   1060 <record_a_set_of_wsn_data@plt>
mov    %rbx,%rdi
call   1040 <unroll_wsn_data@plt>
mov    %rax,%r15
mov    %rbx,%rdi
call   10c0 <calc_size_for_unrolled_data@plt>
mov    %eax,%ebp
mov    %r15,%rdi
call   10a0 <print_cloud_data@plt>
mov    %r15,%rdi
mov    %ebp,%esi
call   10e0 <send_data_2_cloud@plt>
mov    %rbx,%rdi
call   10d0 <unroll_wsn_data_lcd@plt>
mov    %rax,%rbp
mov    %rbx,%rdi
call   1100 <calc_size_for_unrolled_lcd_data@plt>
mov    %rbp,%rdi
mov    %eax,%esi
call   10b0 <send_data_2_lcd@plt>
mov    %r15,%rdi
call   1030 <free@plt>
mov    %rbp,%rdi
call   1030 <free@plt>
mov    $0xa,%edi
call   1110 <sleep@plt>
jmp    1240 <main+0x40>

LLVM IR (-O0):
@.str = [18 x i8] c"................\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* null, i8** %6
store i8* null, i8** %7
store i8* null, i8** %8
store i32 0, i32* %9
%10 = call i32 @sleep(i32 5)
%11 = call i32 (...) @init_gps_stuff()
%12 = call i32 (...) @initiate_connection_2_cloud()
%13 = call i32 (...) @initiate_wsn()
%14 = call i32 (...) @initiate_lcd_comm()
br label %15
15: ; preds = %2, %15
%16 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0))
%17 = call i8* (...) @prep_a_set_of_wsn_data()
store i8* %17, i8** %6
%18 = load i8*, i8** %6
%19 = call i32 @record_a_set_of_wsn_data(i8* %18)
%20 = load i8*, i8** %6
%21 = call i8* @unroll_wsn_data(i8* %20)
store i8* %21, i8** %7
%22 = load i8*, i8** %6
%23 = call i32 @calc_size_for_unrolled_data(i8* %22)
store i32 %23, i32* %9
%24 = load i8*, i8** %7
%25 = call i32 @print_cloud_data(i8* %24)
%26 = load i8*, i8** %7
%27 = bitcast i8* %26 to i32*
%28 = load i32, i32* %9
%29 = call i32 @send_data_2_cloud(i32* %27, i32 %28)
%30 = load i8*, i8** %6
%31 = call i8* @unroll_wsn_data_lcd(i8* %30)
store i8* %31, i8** %8
%32 = load i8*, i8** %6
%33 = call i32 @calc_size_for_unrolled_lcd_data(i8* %32)
store i32 %33, i32* %9
%34 = load i8*, i8** %8
%35 = bitcast i8* %34 to i32*
%36 = load i32, i32* %9
%37 = call i32 @send_data_2_lcd(i32* %35, i32 %36)
%38 = load i8*, i8** %7
%39 = call i32 @free(i8* %38)
%40 = load i8*, i8** %8
%41 = call i32 @free(i8* %40)
%42 = call i32 @sleep(i32 10)
br label %15
}

LLVM IR (-O2):
@str = [17 x i8] c"................\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @sleep(i32 5)
%4 = tail call i32 (...) @init_gps_stuff()
%5 = tail call i32 (...) @initiate_connection_2_cloud()
%6 = tail call i32 (...) @initiate_wsn()
%7 = tail call i32 (...) @initiate_lcd_comm()
br label %8
8: ; preds = %8, %2
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @str, i64 0, i64 0))
%10 = tail call i8* (...) @prep_a_set_of_wsn_data()
%11 = tail call i32 @record_a_set_of_wsn_data(i8* %10)
%12 = tail call i8* @unroll_wsn_data(i8* %10)
%13 = tail call i32 @calc_size_for_unrolled_data(i8* %10)
%14 = tail call i32 @print_cloud_data(i8* %12)
%15 = bitcast i8* %12 to i32*
%16 = tail call i32 @send_data_2_cloud(i32* %15, i32 %13)
%17 = tail call i8* @unroll_wsn_data_lcd(i8* %10)
%18 = tail call i32 @calc_size_for_unrolled_lcd_data(i8* %10)
%19 = bitcast i8* %17 to i32*
%20 = tail call i32 @send_data_2_lcd(i32* %19, i32 %18)
%21 = tail call i32 @free(i8* %12)
%22 = tail call i32 @free(i8* %17)
%23 = tail call i32 @sleep(i32 10)
br label %8
}