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

/* Variables and functions */
char Get(int /*<<< orphan*/);
int /*<<< orphan*/ Send(int, char *, int, int /*<<< orphan*/,
                        int /*<<< orphan*/);
int /*<<< orphan*/ console_xy(int, int);
int /*<<< orphan*/ cprintf(char *, ...);
main() {
  int i;
  char data[11];
  char sendData = 's';
  data[10] = '\0';
  console_xy(0, 10);
  cprintf("Sensor Data : ");
  while (1) {
    Send(4, &sendData, sizeof(char), 0, 0);
    for (i = 0; i < 10; i++) {
      data[i] = Get(0);
    }
    if (data[3] == 1) {
      console_xy(19, 10);
      cprintf("*");
      Send(7, &sendData, sizeof(char), 0, 0);
    }
    for (i = 0; i < 10; i++) {
      console_xy(20 + i, 10);
      cprintf("%x", data[i]);
      console_xy(19, 10);
      cprintf(" ");
    }
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
movb   $0x73,-0x14(%rbp)
movb   $0x0,-0x9(%rbp)
xor    %edi,%edi
mov    $0xa,%esi
call   1050 <console_xy@plt>
lea    0xe96(%rip),%rdi
mov    $0x0,%al
call   1030 <cprintf@plt>
mov    $0x4,%edi
lea    -0x14(%rbp),%rsi
mov    $0x1,%edx
xor    %r8d,%r8d
mov    %r8d,%ecx
call   1060 <Send@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    11ba <main+0x7a>
xor    %edi,%edi
call   1040 <Get@plt>
mov    %al,%cl
movslq -0x8(%rbp),%rax
mov    %cl,-0x13(%rbp,%rax,1)
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1191 <main+0x51>
movsbl -0x10(%rbp),%eax
cmp    $0x1,%eax
jne    11fd <main+0xbd>
mov    $0x13,%edi
mov    $0xa,%esi
call   1050 <console_xy@plt>
lea    0xe32(%rip),%rdi
mov    $0x0,%al
call   1030 <cprintf@plt>
mov    $0x7,%edi
lea    -0x14(%rbp),%rsi
mov    $0x1,%edx
xor    %r8d,%r8d
mov    %r8d,%ecx
call   1060 <Send@plt>
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    1260 <main+0x120>
mov    -0x8(%rbp),%edi
add    $0x14,%edi
mov    $0xa,%esi
call   1050 <console_xy@plt>
movslq -0x8(%rbp),%rax
movsbl -0x13(%rbp,%rax,1),%esi
lea    0xde3(%rip),%rdi
mov    $0x0,%al
call   1030 <cprintf@plt>
mov    $0x13,%edi
mov    $0xa,%esi
call   1050 <console_xy@plt>
lea    0xdc2(%rip),%rdi
mov    $0x0,%al
call   1030 <cprintf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1204 <main+0xc4>
jmp    1171 <main+0x31>

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
movb   $0x73,0x1(%rsp)
xor    %edi,%edi
mov    $0xa,%esi
call   1050 <console_xy@plt>
lea    0xe9d(%rip),%rdi
xor    %eax,%eax
call   1030 <cprintf@plt>
lea    0xea0(%rip),%r12
lea    0xe95(%rip),%rbx
jmp    13a2 <main+0x262>
nopl   (%rax)
mov    $0x14,%edi
mov    $0xa,%esi
call   1050 <console_xy@plt>
movsbl %r13b,%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1030 <cprintf@plt>
mov    $0x13,%edi
mov    $0xa,%esi
call   1050 <console_xy@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <cprintf@plt>
mov    $0x15,%edi
mov    $0xa,%esi
call   1050 <console_xy@plt>
movsbl %bpl,%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1030 <cprintf@plt>
mov    $0x13,%edi
mov    $0xa,%esi
call   1050 <console_xy@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <cprintf@plt>
mov    $0x16,%edi
mov    $0xa,%esi
call   1050 <console_xy@plt>
movsbl %r15b,%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1030 <cprintf@plt>
mov    $0x13,%edi
mov    $0xa,%esi
call   1050 <console_xy@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <cprintf@plt>
mov    $0x17,%edi
mov    $0xa,%esi
call   1050 <console_xy@plt>
movsbl %r14b,%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1030 <cprintf@plt>
mov    $0x13,%edi
mov    $0xa,%esi
call   1050 <console_xy@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <cprintf@plt>
mov    $0x18,%edi
mov    $0xa,%esi
call   1050 <console_xy@plt>
movsbl 0x2(%rsp),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1030 <cprintf@plt>
mov    $0x13,%edi
mov    $0xa,%esi
call   1050 <console_xy@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <cprintf@plt>
mov    $0x19,%edi
mov    $0xa,%esi
call   1050 <console_xy@plt>
movsbl 0x3(%rsp),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1030 <cprintf@plt>
mov    $0x13,%edi
mov    $0xa,%esi
call   1050 <console_xy@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <cprintf@plt>
mov    $0x1a,%edi
mov    $0xa,%esi
call   1050 <console_xy@plt>
movsbl 0x4(%rsp),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1030 <cprintf@plt>
mov    $0x13,%edi
mov    $0xa,%esi
call   1050 <console_xy@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <cprintf@plt>
mov    $0x1b,%edi
mov    $0xa,%esi
call   1050 <console_xy@plt>
movsbl 0x5(%rsp),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1030 <cprintf@plt>
mov    $0x13,%edi
mov    $0xa,%esi
call   1050 <console_xy@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <cprintf@plt>
mov    $0x1c,%edi
mov    $0xa,%esi
call   1050 <console_xy@plt>
movsbl 0x6(%rsp),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1030 <cprintf@plt>
mov    $0x13,%edi
mov    $0xa,%esi
call   1050 <console_xy@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <cprintf@plt>
mov    $0x1d,%edi
mov    $0xa,%esi
call   1050 <console_xy@plt>
movsbl 0x7(%rsp),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1030 <cprintf@plt>
mov    $0x13,%edi
mov    $0xa,%esi
call   1050 <console_xy@plt>
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <cprintf@plt>
mov    $0x4,%edi
lea    0x1(%rsp),%rsi
mov    $0x1,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1060 <Send@plt>
xor    %edi,%edi
call   1040 <Get@plt>
mov    %eax,%r13d
xor    %edi,%edi
call   1040 <Get@plt>
mov    %eax,%ebp
xor    %edi,%edi
call   1040 <Get@plt>
mov    %eax,%r15d
xor    %edi,%edi
call   1040 <Get@plt>
mov    %eax,%r14d
xor    %edi,%edi
call   1040 <Get@plt>
mov    %al,0x2(%rsp)
xor    %edi,%edi
call   1040 <Get@plt>
mov    %al,0x3(%rsp)
xor    %edi,%edi
call   1040 <Get@plt>
mov    %al,0x4(%rsp)
xor    %edi,%edi
call   1040 <Get@plt>
mov    %al,0x5(%rsp)
xor    %edi,%edi
call   1040 <Get@plt>
mov    %al,0x6(%rsp)
xor    %edi,%edi
call   1040 <Get@plt>
mov    %al,0x7(%rsp)
cmp    $0x1,%r14b
jne    1180 <main+0x40>
mov    $0x13,%edi
mov    $0xa,%esi
call   1050 <console_xy@plt>
lea    0xbcb(%rip),%rdi
xor    %eax,%eax
call   1030 <cprintf@plt>
mov    $0x7,%edi
lea    0x1(%rsp),%rsi
mov    $0x1,%edx
xor    %ecx,%ecx
xor    %r8d,%r8d
call   1060 <Send@plt>
jmp    1180 <main+0x40>

LLVM IR (-O0):
@.str = [15 x i8] c"Sensor Data : \00"
@.str.1 = [2 x i8] c"*\00"
@.str.2 = [3 x i8] c"%x\00"
@.str.3 = [2 x i8] c" \00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [11 x i8]
%4 = alloca i8
store i32 0, i32* %1
store i8 115, i8* %4
%5 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 10
store i8 0, i8* %5
%6 = call i32 @console_xy(i32 0, i32 10)
%7 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %8
8: ; preds = %0, %49
%9 = call i32 @Send(i32 4, i8* %4, i32 1, i32 0, i32 0)
store i32 0, i32* %2
br label %10
10: ; preds = %18, %8
%11 = load i32, i32* %2
%12 = icmp slt i32 %11, 10
br i1 %12, label %13, label %21
13: ; preds = %10
%14 = call signext i8 @Get(i32 0)
%15 = load i32, i32* %2
%16 = sext i32 %15 to i64
%17 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 %16
store i8 %14, i8* %17
br label %18
18: ; preds = %13
%19 = load i32, i32* %2
%20 = add nsw i32 %19, 1
store i32 %20, i32* %2
br label %10
21: ; preds = %10
%22 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 3
%23 = load i8, i8* %22
%24 = sext i8 %23 to i32
%25 = icmp eq i32 %24, 1
br i1 %25, label %26, label %30
26: ; preds = %21
%27 = call i32 @console_xy(i32 19, i32 10)
%28 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%29 = call i32 @Send(i32 7, i8* %4, i32 1, i32 0, i32 0)
br label %30
30: ; preds = %26, %21
store i32 0, i32* %2
br label %31
31: ; preds = %46, %30
%32 = load i32, i32* %2
%33 = icmp slt i32 %32, 10
br i1 %33, label %34, label %49
34: ; preds = %31
%35 = load i32, i32* %2
%36 = add nsw i32 20, %35
%37 = call i32 @console_xy(i32 %36, i32 10)
%38 = load i32, i32* %2
%39 = sext i32 %38 to i64
%40 = getelementptr inbounds [11 x i8], [11 x i8]* %3, i64 0, i64 %39
%41 = load i8, i8* %40
%42 = sext i8 %41 to i32
%43 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %42)
%44 = call i32 @console_xy(i32 19, i32 10)
%45 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %46
46: ; preds = %34
%47 = load i32, i32* %2
%48 = add nsw i32 %47, 1
store i32 %48, i32* %2
br label %31
49: ; preds = %31
br label %8
}

LLVM IR (-O2):
@.str = [15 x i8] c"Sensor Data : \00"
@.str.1 = [2 x i8] c"*\00"
@.str.2 = [3 x i8] c"%x\00"
@.str.3 = [2 x i8] c" \00"
define i32 @main() {
%1 = alloca i8
store i8 115, i8* %1
%2 = tail call i32 @console_xy(i32 0, i32 10)
%3 = tail call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
br label %4
4: ; preds = %21, %0
%5 = call i32 @Send(i32 4, i8* %1, i32 1, i32 0, i32 0)
%6 = call signext i8 @Get(i32 0)
%7 = call signext i8 @Get(i32 0)
%8 = call signext i8 @Get(i32 0)
%9 = call signext i8 @Get(i32 0)
%10 = call signext i8 @Get(i32 0)
%11 = call signext i8 @Get(i32 0)
%12 = call signext i8 @Get(i32 0)
%13 = call signext i8 @Get(i32 0)
%14 = call signext i8 @Get(i32 0)
%15 = call signext i8 @Get(i32 0)
%16 = icmp eq i8 %9, 1
br i1 %16, label %17, label %21
17: ; preds = %4
%18 = call i32 @console_xy(i32 19, i32 10)
%19 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0))
%20 = call i32 @Send(i32 7, i8* %1, i32 1, i32 0, i32 0)
br label %21
21: ; preds = %17, %4
%22 = call i32 @console_xy(i32 20, i32 10)
%23 = sext i8 %6 to i32
%24 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %23)
%25 = call i32 @console_xy(i32 19, i32 10)
%26 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%27 = call i32 @console_xy(i32 21, i32 10)
%28 = sext i8 %7 to i32
%29 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %28)
%30 = call i32 @console_xy(i32 19, i32 10)
%31 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%32 = call i32 @console_xy(i32 22, i32 10)
%33 = sext i8 %8 to i32
%34 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %33)
%35 = call i32 @console_xy(i32 19, i32 10)
%36 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%37 = call i32 @console_xy(i32 23, i32 10)
%38 = sext i8 %9 to i32
%39 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %38)
%40 = call i32 @console_xy(i32 19, i32 10)
%41 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%42 = call i32 @console_xy(i32 24, i32 10)
%43 = sext i8 %10 to i32
%44 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %43)
%45 = call i32 @console_xy(i32 19, i32 10)
%46 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%47 = call i32 @console_xy(i32 25, i32 10)
%48 = sext i8 %11 to i32
%49 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %48)
%50 = call i32 @console_xy(i32 19, i32 10)
%51 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%52 = call i32 @console_xy(i32 26, i32 10)
%53 = sext i8 %12 to i32
%54 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %53)
%55 = call i32 @console_xy(i32 19, i32 10)
%56 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%57 = call i32 @console_xy(i32 27, i32 10)
%58 = sext i8 %13 to i32
%59 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %58)
%60 = call i32 @console_xy(i32 19, i32 10)
%61 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%62 = call i32 @console_xy(i32 28, i32 10)
%63 = sext i8 %14 to i32
%64 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %63)
%65 = call i32 @console_xy(i32 19, i32 10)
%66 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%67 = call i32 @console_xy(i32 29, i32 10)
%68 = sext i8 %15 to i32
%69 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32 %68)
%70 = call i32 @console_xy(i32 19, i32 10)
%71 = call i32 (i8*, ...) @cprintf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
br label %4
}