#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 uint8_t;
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/ *, char *, ...);
void pr_GNSS_diff(FILE *fp, bool sign, uint8_t val) {
  fprintf(fp, "GBD=%d,%d:", sign, val);
  if (val == 0)
    fprintf(fp, "No information\n");
  else if (val == 127)
    fprintf(fp, "GNSS > %'.1f ft %s barometric altitude\n", 3137.5,
            sign ? "below" : "above");
  else
    fprintf(fp, "GNSS = %d ± %.1f ft %s barometric altitude\n", 25 * (val - 1),
            12.5, sign ? "below" : "above");
}


x86 assembly (clang, -O0):
<pr_GNSS_diff>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xedd(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
cmpl   $0x0,-0x10(%rbp)
jne    115b <pr_GNSS_diff+0x4b>
mov    -0x8(%rbp),%rdi
lea    0xecc(%rip),%rsi
mov    $0x0,%al
call   1030 <fprintf@plt>
jmp    11dc <pr_GNSS_diff+0xcc>
cmpl   $0x7f,-0x10(%rbp)
jne    119c <pr_GNSS_diff+0x8c>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%ecx
lea    0xee6(%rip),%rdx
lea    0xed9(%rip),%rax
cmp    $0x0,%ecx
cmovne %rax,%rdx
lea    0xea3(%rip),%rsi
movsd  0xe78(%rip),%xmm0
mov    $0x1,%al
call   1030 <fprintf@plt>
jmp    11d7 <pr_GNSS_diff+0xc7>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%eax
sub    $0x1,%eax
imul   $0x19,%eax,%edx
mov    -0xc(%rbp),%esi
lea    0xea6(%rip),%rcx
lea    0xe99(%rip),%rax
cmp    $0x0,%esi
cmovne %rax,%rcx
lea    0xe97(%rip),%rsi
movsd  0xe30(%rip),%xmm0
mov    $0x1,%al
call   1030 <fprintf@plt>
jmp    11dc <pr_GNSS_diff+0xcc>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pr_GNSS_diff>:
push   %rbp
push   %r14
push   %rbx
mov    %edx,%ebx
mov    %esi,%ebp
mov    %rdi,%r14
lea    0xede(%rip),%rsi
mov    %ebp,%edx
mov    %ebx,%ecx
xor    %eax,%eax
call   1030 <fprintf@plt>
cmp    $0x7f,%ebx
je     1163 <pr_GNSS_diff+0x43>
test   %ebx,%ebx
jne    1194 <pr_GNSS_diff+0x74>
lea    0xece(%rip),%rdi
mov    $0xf,%esi
mov    $0x1,%edx
mov    %r14,%rcx
pop    %rbx
pop    %r14
pop    %rbp
jmp    1040 <fwrite@plt>
test   %ebp,%ebp
lea    0xeed(%rip),%rax
lea    0xee0(%rip),%rdx
cmove  %rax,%rdx
lea    0xead(%rip),%rsi
movsd  0xe7a(%rip),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <fprintf@plt>
lea    (%rbx,%rbx,4),%eax
test   %ebp,%ebp
lea    0xeb9(%rip),%rdx
lea    0xeac(%rip),%rcx
cmove  %rdx,%rcx
lea    (%rax,%rax,4),%edx
add    $0xffffffe7,%edx
lea    0xea7(%rip),%rsi
movsd  0xe48(%rip),%xmm0
mov    %r14,%rdi
mov    $0x1,%al
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@.str = [11 x i8] c"GBD=%d,%d:\00"
@.str.1 = [16 x i8] c"No information\0A\00"
@.str.2 = [40 x i8] c"GNSS > %'.1f ft %s barometric altitude\0A\00"
@.str.3 = [6 x i8] c"below\00"
@.str.4 = [6 x i8] c"above\00"
@.str.5 = [45 x i8] c"GNSS = %d \C2\B1 %.1f ft %s barometric altitude\0A\00"
define void @pr_GNSS_diff(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%7 = load i32*, i32** %4
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = call i32 (i32*, i8*, ...) @fprintf(i32* %7, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %9)
%11 = load i32, i32* %6
%12 = icmp eq i32 %11, 0
br i1 %12, label %13, label %16
13: ; preds = %3
%14 = load i32*, i32** %4
%15 = call i32 (i32*, i8*, ...) @fprintf(i32* %14, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0))
br label %37
16: ; preds = %3
%17 = load i32, i32* %6
%18 = icmp eq i32 %17, 127
br i1 %18, label %19, label %26
19: ; preds = %16
%20 = load i32*, i32** %4
%21 = load i32, i32* %5
%22 = icmp ne i32 %21, 0
%23 = zext i1 %22 to i64
%24 = select i1 %22, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0)
%25 = call i32 (i32*, i8*, ...) @fprintf(i32* %20, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), double 3.137500e+03, i8* %24)
br label %36
26: ; preds = %16
%27 = load i32*, i32** %4
%28 = load i32, i32* %6
%29 = sub nsw i32 %28, 1
%30 = mul nsw i32 25, %29
%31 = load i32, i32* %5
%32 = icmp ne i32 %31, 0
%33 = zext i1 %32 to i64
%34 = select i1 %32, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0)
%35 = call i32 (i32*, i8*, ...) @fprintf(i32* %27, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.5, i64 0, i64 0), i32 %30, double 1.250000e+01, i8* %34)
br label %36
36: ; preds = %26, %19
br label %37
37: ; preds = %36, %13
ret void
}

LLVM IR (-O2):
@.str = [11 x i8] c"GBD=%d,%d:\00"
@.str.1 = [16 x i8] c"No information\0A\00"
@.str.2 = [40 x i8] c"GNSS > %'.1f ft %s barometric altitude\0A\00"
@.str.3 = [6 x i8] c"below\00"
@.str.4 = [6 x i8] c"above\00"
@.str.5 = [45 x i8] c"GNSS = %d \C2\B1 %.1f ft %s barometric altitude\0A\00"
define void @pr_GNSS_diff(i32* nocapture %0, i32 %1, i32 %2) {
%4 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str, i64 0, i64 0), i32 %1, i32 %2)
switch i32 %2, label %11 [
i32 0, label %5
i32 127, label %7
]
5: ; preds = %3
%6 = tail call i64 @fwrite(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.1, i64 0, i64 0), i64 15, i64 1, i32* %0)
br label %17
7: ; preds = %3
%8 = icmp eq i32 %1, 0
%9 = select i1 %8, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0)
%10 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.2, i64 0, i64 0), double 3.137500e+03, i8* %9)
br label %17
11: ; preds = %3
%12 = mul i32 %2, 25
%13 = add i32 %12, -25
%14 = icmp eq i32 %1, 0
%15 = select i1 %14, i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.3, i64 0, i64 0)
%16 = tail call i32 (i32*, i8*, ...) @fprintf(i32* %0, i8* getelementptr inbounds ([45 x i8], [45 x i8]* @.str.5, i64 0, i64 0), i32 %13, double 1.250000e+01, i8* %15)
br label %17
17: ; preds = %7, %11, %5
ret void
}