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

/* Variables and functions */
int /*<<< orphan*/ bzero(char *, int);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ initiate_connection_2_cloud();
int /*<<< orphan*/ kill_connection_2_cloud();
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ send_data_2_cloud(char *, int);
int /*<<< orphan*/ stdin;
int main(int argc, char *argv[]) {
  char buffer[256];
  printf("enter a message\n");
  bzero(buffer, 256);
  fgets(buffer, 255, stdin);
  initiate_connection_2_cloud();
  send_data_2_cloud(buffer, sizeof(buffer));
  kill_connection_2_cloud();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x110,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xe80(%rip),%rdi
call   1030 <printf@plt>
lea    -0x110(%rbp),%rdi
mov    $0x100,%esi
call   1080 <bzero@plt>
lea    -0x110(%rbp),%rdi
mov    0x2e44(%rip),%rax
mov    (%rax),%edx
mov    $0xff,%esi
call   1060 <fgets@plt>
mov    $0x0,%al
call   1050 <initiate_connection_2_cloud@plt>
lea    -0x110(%rbp),%rdi
mov    $0x100,%esi
call   1070 <send_data_2_cloud@plt>
mov    $0x0,%al
call   1040 <kill_connection_2_cloud@plt>
xor    %eax,%eax
add    $0x110,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x100,%rsp
lea    0xe91(%rip),%rdi
call   1030 <puts@plt>
mov    %rsp,%rbx
mov    %rbx,%rdi
mov    $0x100,%esi
call   1080 <bzero@plt>
mov    0x2e5d(%rip),%rax
mov    (%rax),%edx
mov    %rbx,%rdi
mov    $0xff,%esi
call   1060 <fgets@plt>
xor    %eax,%eax
call   1050 <initiate_connection_2_cloud@plt>
mov    %rbx,%rdi
mov    $0x100,%esi
call   1070 <send_data_2_cloud@plt>
xor    %eax,%eax
call   1040 <kill_connection_2_cloud@plt>
xor    %eax,%eax
add    $0x100,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [17 x i8] c"enter a message\0A\00"
@stdin = global i32 0
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [256 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%9 = call i32 @bzero(i8* %8, i32 256)
%10 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%11 = load i32, i32* @stdin
%12 = call i32 @fgets(i8* %10, i32 255, i32 %11)
%13 = call i32 (...) @initiate_connection_2_cloud()
%14 = getelementptr inbounds [256 x i8], [256 x i8]* %6, i64 0, i64 0
%15 = call i32 @send_data_2_cloud(i8* %14, i32 256)
%16 = call i32 (...) @kill_connection_2_cloud()
ret i32 0
}

LLVM IR (-O2):
@stdin = global i32 0
@str = [16 x i8] c"enter a message\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [256 x i8]
%4 = getelementptr inbounds [256 x i8], [256 x i8]* %3, i64 0, i64 0
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @str, i64 0, i64 0))
%6 = call i32 @bzero(i8* %4, i32 256)
%7 = load i32, i32* @stdin
%8 = call i32 @fgets(i8* %4, i32 255, i32 %7)
%9 = call i32 (...) @initiate_connection_2_cloud()
%10 = call i32 @send_data_2_cloud(i8* %4, i32 256)
%11 = call i32 (...) @kill_connection_2_cloud()
ret i32 0
}