#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 */
int /*<<< orphan*/ SerialClose(unsigned int);
int /*<<< orphan*/ SerialFlush(unsigned int);
unsigned int SerialOpen(int);
int /*<<< orphan*/ SerialPrintf(unsigned int, char *, ...);
int /*<<< orphan*/ SerialPuts(unsigned int, char *);
int main(int argc, char *argv[]) {
  unsigned int ser = SerialOpen(115200);
  SerialFlush(ser);
  SerialPuts(ser, "Serial communication over using the Sensorian Shield.\r\n");
  SerialPrintf(ser, "You are using device number %d.\r\n", ser);
  SerialPrintf(ser, "Closing serial port ...");
  SerialClose(ser);
  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)
mov    $0x1c200,%edi
call   1030 <SerialOpen@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1060 <SerialFlush@plt>
mov    -0x14(%rbp),%edi
lea    0xe7b(%rip),%rsi
call   1070 <SerialPuts@plt>
mov    -0x14(%rbp),%edi
mov    -0x14(%rbp),%edx
lea    0xea1(%rip),%rsi
mov    $0x0,%al
call   1040 <SerialPrintf@plt>
mov    -0x14(%rbp),%edi
lea    0xeb2(%rip),%rsi
mov    $0x0,%al
call   1040 <SerialPrintf@plt>
mov    -0x14(%rbp),%edi
call   1050 <SerialClose@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0x1c200,%edi
call   1030 <SerialOpen@plt>
mov    %eax,%ebx
mov    %eax,%edi
call   1060 <SerialFlush@plt>
lea    0xe95(%rip),%rsi
mov    %ebx,%edi
call   1070 <SerialPuts@plt>
lea    0xebf(%rip),%rsi
mov    %ebx,%edi
mov    %ebx,%edx
xor    %eax,%eax
call   1040 <SerialPrintf@plt>
lea    0xecf(%rip),%rsi
mov    %ebx,%edi
xor    %eax,%eax
call   1040 <SerialPrintf@plt>
mov    %ebx,%edi
call   1050 <SerialClose@plt>
xor    %eax,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [56 x i8] c"Serial communication over using the Sensorian Shield.\0D\0A\00"
@.str.1 = [34 x i8] c"You are using device number %d.\0D\0A\00"
@.str.2 = [24 x i8] c"Closing serial port ...\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%7 = call i32 @SerialOpen(i32 115200)
store i32 %7, i32* %6
%8 = load i32, i32* %6
%9 = call i32 @SerialFlush(i32 %8)
%10 = load i32, i32* %6
%11 = call i32 @SerialPuts(i32 %10, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0))
%12 = load i32, i32* %6
%13 = load i32, i32* %6
%14 = call i32 (i32, i8*, ...) @SerialPrintf(i32 %12, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 %13)
%15 = load i32, i32* %6
%16 = call i32 (i32, i8*, ...) @SerialPrintf(i32 %15, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%17 = load i32, i32* %6
%18 = call i32 @SerialClose(i32 %17)
ret i32 0
}

LLVM IR (-O2):
@.str = [56 x i8] c"Serial communication over using the Sensorian Shield.\0D\0A\00"
@.str.1 = [34 x i8] c"You are using device number %d.\0D\0A\00"
@.str.2 = [24 x i8] c"Closing serial port ...\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @SerialOpen(i32 115200)
%4 = tail call i32 @SerialFlush(i32 %3)
%5 = tail call i32 @SerialPuts(i32 %3, i8* getelementptr inbounds ([56 x i8], [56 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 (i32, i8*, ...) @SerialPrintf(i32 %3, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i32 %3)
%7 = tail call i32 (i32, i8*, ...) @SerialPrintf(i32 %3, i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0))
%8 = tail call i32 @SerialClose(i32 %3)
ret i32 0
}