#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*/ roadmap_log(int, char *, int, char *, char const *);
scalar_t__ strcasecmp(char const *, char *);
char *roadmap_nmea_decode_unit(const char *original) {
  if (original && (*original) && (strcasecmp(original, "M") == 0)) {
    return "cm";
  }
  if (original && *original)
    roadmap_log(1,
                "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
                "outputs/2022-01-22/02-19-57/repos/maximuska/Freemap-waze/refs/"
                "heads/master/roadmap_nmea.c",
                225, "unknown distance unit (%s)", original);
  return "??";
}


x86 assembly (clang, -O0):
<roadmap_nmea_decode_unit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     1171 <roadmap_nmea_decode_unit+0x51>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     1171 <roadmap_nmea_decode_unit+0x51>
mov    -0x10(%rbp),%rdi
lea    0xeae(%rip),%rsi
call   1030 <strcasecmp@plt>
cmp    $0x0,%rax
jne    1171 <roadmap_nmea_decode_unit+0x51>
lea    0xe9a(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    11b8 <roadmap_nmea_decode_unit+0x98>
cmpq   $0x0,-0x10(%rbp)
je     11ad <roadmap_nmea_decode_unit+0x8d>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
je     11ad <roadmap_nmea_decode_unit+0x8d>
mov    -0x10(%rbp),%r8
mov    $0x1,%edi
lea    0xe69(%rip),%rsi
mov    $0xe1,%edx
lea    0xeef(%rip),%rcx
call   1040 <roadmap_log@plt>
lea    0xefe(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<roadmap_nmea_decode_unit>:
push   %r14
push   %rbx
push   %rax
lea    0xf87(%rip),%r14
test   %rdi,%rdi
je     1175 <roadmap_nmea_decode_unit+0x55>
mov    %rdi,%rbx
cmpb   $0x0,(%rdi)
je     1175 <roadmap_nmea_decode_unit+0x55>
lea    0xec1(%rip),%rsi
mov    %rbx,%rdi
call   1030 <strcasecmp@plt>
test   %rax,%rax
je     116e <roadmap_nmea_decode_unit+0x4e>
lea    0xeb2(%rip),%rsi
lea    0xf3d(%rip),%rcx
mov    $0x1,%edi
mov    $0xe1,%edx
mov    %rbx,%r8
call   1040 <roadmap_log@plt>
jmp    1175 <roadmap_nmea_decode_unit+0x55>
lea    0xe8d(%rip),%r14
mov    %r14,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [2 x i8] c"M\00"
@.str.1 = [3 x i8] c"cm\00"
@.str.2 = [146 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/maximuska/Freemap-waze/refs/heads/master/roadmap_nmea.c\00"
@.str.3 = [27 x i8] c"unknown distance unit (%s)\00"
@.str.4 = [3 x i8] c"??\00"
define i8* @roadmap_nmea_decode_unit(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = icmp ne i8* %4, null
br i1 %5, label %6, label %16
6: ; preds = %1
%7 = load i8*, i8** %3
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp ne i32 %9, 0
br i1 %10, label %11, label %16
11: ; preds = %6
%12 = load i8*, i8** %3
%13 = call i64 @strcasecmp(i8* %12, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%14 = icmp eq i64 %13, 0
br i1 %14, label %15, label %16
15: ; preds = %11
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %28
16: ; preds = %11, %6, %1
%17 = load i8*, i8** %3
%18 = icmp ne i8* %17, null
br i1 %18, label %19, label %27
19: ; preds = %16
%20 = load i8*, i8** %3
%21 = load i8, i8* %20
%22 = sext i8 %21 to i32
%23 = icmp ne i32 %22, 0
br i1 %23, label %24, label %27
24: ; preds = %19
%25 = load i8*, i8** %3
%26 = call i32 @roadmap_log(i32 1, i8* getelementptr inbounds ([146 x i8], [146 x i8]* @.str.2, i64 0, i64 0), i32 225, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* %25)
br label %27
27: ; preds = %24, %19, %16
store i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8** %2
br label %28
28: ; preds = %27, %15
%29 = load i8*, i8** %2
ret i8* %29
}

LLVM IR (-O2):
@.str = [2 x i8] c"M\00"
@.str.1 = [3 x i8] c"cm\00"
@.str.2 = [146 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/maximuska/Freemap-waze/refs/heads/master/roadmap_nmea.c\00"
@.str.3 = [27 x i8] c"unknown distance unit (%s)\00"
@.str.4 = [3 x i8] c"??\00"
define i8* @roadmap_nmea_decode_unit(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %11, label %3
3: ; preds = %1
%4 = load i8, i8* %0
%5 = icmp eq i8 %4, 0
br i1 %5, label %11, label %6
6: ; preds = %3
%7 = tail call i64 @strcasecmp(i8* %0, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%8 = icmp eq i64 %7, 0
br i1 %8, label %11, label %9
9: ; preds = %6
%10 = tail call i32 @roadmap_log(i32 1, i8* getelementptr inbounds ([146 x i8], [146 x i8]* @.str.2, i64 0, i64 0), i32 225, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.3, i64 0, i64 0), i8* %0)
br label %11
11: ; preds = %3, %6, %9, %1
%12 = phi i8* [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), %6 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), %1 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), %9 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), %3 ]
ret i8* %12
}