#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 GetOutput_GS(int /*<<< orphan*/, int);
int /*<<< orphan*/ SetOutput_GS(int /*<<< orphan*/, int, int);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char **argv) {
  int tx, rx;
  printf("tx \t\t rx \t\t delta\n");
  for (int i = 0; i < 16; ++i) {
    tx = 4095 - i * 255;
    SetOutput_GS(0, i, tx);
    rx = GetOutput_GS(0, i);
    printf("%d \t\t %d \t\t %d\n", tx, rx, tx - rx);
  }
  for (int i = 0; i < 16; ++i) {
    tx = 4095 - i * 255;
    rx = GetOutput_GS(0, i);
    printf("%d \t\t %d \t\t %d\n", tx, rx, tx - rx);
  }
}


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)
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x0,-0x1c(%rbp)
cmpl   $0x10,-0x1c(%rbp)
jge    11b8 <main+0x88>
imul   $0xff,-0x1c(%rbp),%ecx
mov    $0xfff,%eax
sub    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x1c(%rbp),%esi
mov    -0x14(%rbp),%edx
xor    %edi,%edi
call   1050 <SetOutput_GS@plt>
mov    -0x1c(%rbp),%esi
xor    %edi,%edi
call   1030 <GetOutput_GS@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x14(%rbp),%ecx
sub    -0x18(%rbp),%ecx
lea    0xe70(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    115b <main+0x2b>
movl   $0x0,-0x20(%rbp)
cmpl   $0x10,-0x20(%rbp)
jge    120f <main+0xdf>
imul   $0xff,-0x20(%rbp),%ecx
mov    $0xfff,%eax
sub    %ecx,%eax
mov    %eax,-0x14(%rbp)
mov    -0x20(%rbp),%esi
xor    %edi,%edi
call   1030 <GetOutput_GS@plt>
mov    %eax,-0x18(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x14(%rbp),%ecx
sub    -0x18(%rbp),%ecx
lea    0xe19(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
jmp    11bf <main+0x8f>
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r14
push   %rbx
lea    0xec5(%rip),%rdi
call   1040 <puts@plt>
mov    $0xfff,%ebx
lea    0xea4(%rip),%r14
xor    %ebp,%ebp
xchg   %ax,%ax
xor    %edi,%edi
mov    %ebp,%esi
mov    %ebx,%edx
call   1060 <SetOutput_GS@plt>
xor    %edi,%edi
mov    %ebp,%esi
call   1030 <GetOutput_GS@plt>
mov    %ebx,%ecx
sub    %eax,%ecx
mov    %r14,%rdi
mov    %ebx,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
add    $0x1,%ebp
add    $0xffffff01,%ebx
cmp    $0xf,%ebx
jne    1160 <main+0x20>
xor    %edi,%edi
xor    %esi,%esi
call   1030 <GetOutput_GS@plt>
mov    $0xfff,%ecx
sub    %eax,%ecx
lea    0xe55(%rip),%rbx
mov    %rbx,%rdi
mov    $0xfff,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %edi,%edi
mov    $0x1,%esi
call   1030 <GetOutput_GS@plt>
mov    $0xf00,%ecx
sub    %eax,%ecx
mov    %rbx,%rdi
mov    $0xf00,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %edi,%edi
mov    $0x2,%esi
call   1030 <GetOutput_GS@plt>
mov    $0xe01,%ecx
sub    %eax,%ecx
mov    %rbx,%rdi
mov    $0xe01,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %edi,%edi
mov    $0x3,%esi
call   1030 <GetOutput_GS@plt>
mov    $0xd02,%ecx
sub    %eax,%ecx
mov    %rbx,%rdi
mov    $0xd02,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %edi,%edi
mov    $0x4,%esi
call   1030 <GetOutput_GS@plt>
mov    $0xc03,%ecx
sub    %eax,%ecx
mov    %rbx,%rdi
mov    $0xc03,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %edi,%edi
mov    $0x5,%esi
call   1030 <GetOutput_GS@plt>
mov    $0xb04,%ecx
sub    %eax,%ecx
mov    %rbx,%rdi
mov    $0xb04,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %edi,%edi
mov    $0x6,%esi
call   1030 <GetOutput_GS@plt>
mov    $0xa05,%ecx
sub    %eax,%ecx
mov    %rbx,%rdi
mov    $0xa05,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %edi,%edi
mov    $0x7,%esi
call   1030 <GetOutput_GS@plt>
mov    $0x906,%ecx
sub    %eax,%ecx
mov    %rbx,%rdi
mov    $0x906,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %edi,%edi
mov    $0x8,%esi
call   1030 <GetOutput_GS@plt>
mov    $0x807,%ecx
sub    %eax,%ecx
mov    %rbx,%rdi
mov    $0x807,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %edi,%edi
mov    $0x9,%esi
call   1030 <GetOutput_GS@plt>
mov    $0x708,%ecx
sub    %eax,%ecx
mov    %rbx,%rdi
mov    $0x708,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %edi,%edi
mov    $0xa,%esi
call   1030 <GetOutput_GS@plt>
mov    $0x609,%ecx
sub    %eax,%ecx
mov    %rbx,%rdi
mov    $0x609,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %edi,%edi
mov    $0xb,%esi
call   1030 <GetOutput_GS@plt>
mov    $0x50a,%ecx
sub    %eax,%ecx
mov    %rbx,%rdi
mov    $0x50a,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %edi,%edi
mov    $0xc,%esi
call   1030 <GetOutput_GS@plt>
mov    $0x40b,%ecx
sub    %eax,%ecx
mov    %rbx,%rdi
mov    $0x40b,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %edi,%edi
mov    $0xd,%esi
call   1030 <GetOutput_GS@plt>
mov    $0x30c,%ecx
sub    %eax,%ecx
mov    %rbx,%rdi
mov    $0x30c,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %edi,%edi
mov    $0xe,%esi
call   1030 <GetOutput_GS@plt>
mov    $0x20d,%ecx
sub    %eax,%ecx
mov    %rbx,%rdi
mov    $0x20d,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %edi,%edi
mov    $0xf,%esi
call   1030 <GetOutput_GS@plt>
mov    $0x10e,%ecx
sub    %eax,%ecx
mov    %rbx,%rdi
mov    $0x10e,%esi
mov    %eax,%edx
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [19 x i8] c"tx \09\09 rx \09\09 delta\0A\00"
@.str.1 = [16 x i8] c"%d \09\09 %d \09\09 %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str, i64 0, i64 0))
store i32 0, i32* %8
br label %11
11: ; preds = %29, %2
%12 = load i32, i32* %8
%13 = icmp slt i32 %12, 16
br i1 %13, label %14, label %32
14: ; preds = %11
%15 = load i32, i32* %8
%16 = mul nsw i32 %15, 255
%17 = sub nsw i32 4095, %16
store i32 %17, i32* %6
%18 = load i32, i32* %8
%19 = load i32, i32* %6
%20 = call i32 @SetOutput_GS(i32 0, i32 %18, i32 %19)
%21 = load i32, i32* %8
%22 = call i32 @GetOutput_GS(i32 0, i32 %21)
store i32 %22, i32* %7
%23 = load i32, i32* %6
%24 = load i32, i32* %7
%25 = load i32, i32* %6
%26 = load i32, i32* %7
%27 = sub nsw i32 %25, %26
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %23, i32 %24, i32 %27)
br label %29
29: ; preds = %14
%30 = load i32, i32* %8
%31 = add nsw i32 %30, 1
store i32 %31, i32* %8
br label %11
32: ; preds = %11
store i32 0, i32* %9
br label %33
33: ; preds = %48, %32
%34 = load i32, i32* %9
%35 = icmp slt i32 %34, 16
br i1 %35, label %36, label %51
36: ; preds = %33
%37 = load i32, i32* %9
%38 = mul nsw i32 %37, 255
%39 = sub nsw i32 4095, %38
store i32 %39, i32* %6
%40 = load i32, i32* %9
%41 = call i32 @GetOutput_GS(i32 0, i32 %40)
store i32 %41, i32* %7
%42 = load i32, i32* %6
%43 = load i32, i32* %7
%44 = load i32, i32* %6
%45 = load i32, i32* %7
%46 = sub nsw i32 %44, %45
%47 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %42, i32 %43, i32 %46)
br label %48
48: ; preds = %36
%49 = load i32, i32* %9
%50 = add nsw i32 %49, 1
store i32 %50, i32* %9
br label %33
51: ; preds = %33
%52 = load i32, i32* %3
ret i32 %52
}

LLVM IR (-O2):
@.str.1 = [16 x i8] c"%d \09\09 %d \09\09 %d\0A\00"
@str = [18 x i8] c"tx \09\09 rx \09\09 delta\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @str, i64 0, i64 0))
br label %4
4: ; preds = %2, %4
%5 = phi i32 [ 0, %2 ], [ %12, %4 ]
%6 = mul nsw i32 %5, -255
%7 = add nsw i32 %6, 4095
%8 = tail call i32 @SetOutput_GS(i32 0, i32 %5, i32 %7)
%9 = tail call i32 @GetOutput_GS(i32 0, i32 %5)
%10 = sub nsw i32 %7, %9
%11 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 %7, i32 %9, i32 %10)
%12 = add nuw nsw i32 %5, 1
%13 = icmp eq i32 %12, 16
br i1 %13, label %14, label %4
14: ; preds = %4
%15 = tail call i32 @GetOutput_GS(i32 0, i32 0)
%16 = sub nsw i32 4095, %15
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 4095, i32 %15, i32 %16)
%18 = tail call i32 @GetOutput_GS(i32 0, i32 1)
%19 = sub nsw i32 3840, %18
%20 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 3840, i32 %18, i32 %19)
%21 = tail call i32 @GetOutput_GS(i32 0, i32 2)
%22 = sub nsw i32 3585, %21
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 3585, i32 %21, i32 %22)
%24 = tail call i32 @GetOutput_GS(i32 0, i32 3)
%25 = sub nsw i32 3330, %24
%26 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 3330, i32 %24, i32 %25)
%27 = tail call i32 @GetOutput_GS(i32 0, i32 4)
%28 = sub nsw i32 3075, %27
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 3075, i32 %27, i32 %28)
%30 = tail call i32 @GetOutput_GS(i32 0, i32 5)
%31 = sub nsw i32 2820, %30
%32 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 2820, i32 %30, i32 %31)
%33 = tail call i32 @GetOutput_GS(i32 0, i32 6)
%34 = sub nsw i32 2565, %33
%35 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 2565, i32 %33, i32 %34)
%36 = tail call i32 @GetOutput_GS(i32 0, i32 7)
%37 = sub nsw i32 2310, %36
%38 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 2310, i32 %36, i32 %37)
%39 = tail call i32 @GetOutput_GS(i32 0, i32 8)
%40 = sub nsw i32 2055, %39
%41 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 2055, i32 %39, i32 %40)
%42 = tail call i32 @GetOutput_GS(i32 0, i32 9)
%43 = sub nsw i32 1800, %42
%44 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 1800, i32 %42, i32 %43)
%45 = tail call i32 @GetOutput_GS(i32 0, i32 10)
%46 = sub nsw i32 1545, %45
%47 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 1545, i32 %45, i32 %46)
%48 = tail call i32 @GetOutput_GS(i32 0, i32 11)
%49 = sub nsw i32 1290, %48
%50 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 1290, i32 %48, i32 %49)
%51 = tail call i32 @GetOutput_GS(i32 0, i32 12)
%52 = sub nsw i32 1035, %51
%53 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 1035, i32 %51, i32 %52)
%54 = tail call i32 @GetOutput_GS(i32 0, i32 13)
%55 = sub nsw i32 780, %54
%56 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 780, i32 %54, i32 %55)
%57 = tail call i32 @GetOutput_GS(i32 0, i32 14)
%58 = sub nsw i32 525, %57
%59 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 525, i32 %57, i32 %58)
%60 = tail call i32 @GetOutput_GS(i32 0, i32 15)
%61 = sub nsw i32 270, %60
%62 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i32 270, i32 %60, i32 %61)
ret i32 0
}