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

/* Variables and functions */
int /*<<< orphan*/ *fopen(char *, char *);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, char *);
int /*<<< orphan*/ sleep(int);
int main(void) {
  FILE *xbee;
  xbee = fopen("/dev/ttyUSB0", "w+");
  char xbeebuffer[7];
  xbeebuffer[0] = ' ';
  xbeebuffer[1] = ' ';
  while (1) {
    xbeebuffer[2] = 100;
    xbeebuffer[3] = 57;
    xbeebuffer[4] = -25;
    xbeebuffer[5] = 77;
    xbeebuffer[6] = ' ';
    fprintf(xbee, "%s\n\r", xbeebuffer);
    sleep(1);
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
lea    0xec0(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,-0x10(%rbp)
movb   $0x20,-0x17(%rbp)
movb   $0x20,-0x16(%rbp)
movb   $0x64,-0x15(%rbp)
movb   $0x39,-0x14(%rbp)
movb   $0xe7,-0x13(%rbp)
movb   $0x4d,-0x12(%rbp)
movb   $0x20,-0x11(%rbp)
mov    -0x10(%rbp),%rdi
lea    -0x17(%rbp),%rdx
lea    0xe8f(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
jmp    115e <main+0x2e>

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x10,%rsp
lea    0xec0(%rip),%rdi
lea    0xec6(%rip),%rsi
call   1040 <fopen@plt>
mov    %rax,%rbx
movw   $0x2020,0x9(%rsp)
lea    0xeb3(%rip),%r14
lea    0x9(%rsp),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
movl   $0x4de73964,0xb(%rsp)
4d
movb   $0x20,0xf(%rsp)
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <sleep@plt>
jmp    1170 <main+0x40>

LLVM IR (-O0):
@.str = [13 x i8] c"/dev/ttyUSB0\00"
@.str.1 = [3 x i8] c"w+\00"
@.str.2 = [5 x i8] c"%s\0A\0D\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32*
%3 = alloca [7 x i8]
store i32 0, i32* %1
%4 = call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
store i32* %4, i32** %2
%5 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
store i8 32, i8* %5
%6 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 1
store i8 32, i8* %6
br label %7
7: ; preds = %0, %7
%8 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 2
store i8 100, i8* %8
%9 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 3
store i8 57, i8* %9
%10 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 4
store i8 -25, i8* %10
%11 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 5
store i8 77, i8* %11
%12 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 6
store i8 32, i8* %12
%13 = load i32*, i32** %2
%14 = getelementptr inbounds [7 x i8], [7 x i8]* %3, i64 0, i64 0
%15 = call i32 @fprintf(i32* %13, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %14)
%16 = call i32 @sleep(i32 1)
br label %7
}

LLVM IR (-O2):
@.str = [13 x i8] c"/dev/ttyUSB0\00"
@.str.1 = [3 x i8] c"w+\00"
@.str.2 = [5 x i8] c"%s\0A\0D\00"
define i32 @main() {
%1 = alloca [7 x i8]
%2 = tail call i32* @fopen(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%3 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 0
store i8 32, i8* %3
%4 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 1
store i8 32, i8* %4
%5 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 2
%6 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 3
%7 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 4
%8 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 5
%9 = getelementptr inbounds [7 x i8], [7 x i8]* %1, i64 0, i64 6
br label %10
10: ; preds = %10, %0
store i8 100, i8* %5
store i8 57, i8* %6
store i8 -25, i8* %7
store i8 77, i8* %8
store i8 32, i8* %9
%11 = call i32 @fprintf(i32* %2, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i8* %3)
%12 = call i32 @sleep(i32 1)
br label %10
}