#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);
int dec2bin(char c) {
  if ((c >= '0') && (c <= '9')) {
    return c - '0';
  }
  roadmap_log(4,
              "/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",
              85, "invalid decimal character '%c'", c);
  return 0;
}


x86 assembly (clang, -O0):
<dec2bin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %dil,%al
mov    %al,-0x5(%rbp)
movsbl -0x5(%rbp),%eax
cmp    $0x30,%eax
jl     1147 <dec2bin+0x37>
movsbl -0x5(%rbp),%eax
cmp    $0x39,%eax
jg     1147 <dec2bin+0x37>
movsbl -0x5(%rbp),%eax
sub    $0x30,%eax
mov    %eax,-0x4(%rbp)
jmp    1170 <dec2bin+0x60>
mov    $0x4,%edi
lea    0xead(%rip),%rsi
mov    $0x55,%edx
lea    0xf33(%rip),%rcx
movsbl -0x5(%rbp),%r8d
call   1030 <roadmap_log@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dec2bin>:
lea    -0x30(%rdi),%eax
cmp    $0x9,%al
ja     111f <dec2bin+0xf>
movzbl %dil,%eax
add    $0xffffffd0,%eax
ret
push   %rax
movsbl %dil,%r8d
lea    0xed5(%rip),%rsi
lea    0xf60(%rip),%rcx
mov    $0x4,%edi
mov    $0x55,%edx
call   1030 <roadmap_log@plt>
xor    %eax,%eax
add    $0x8,%rsp
ret

LLVM IR (-O0):
@.str = [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.1 = [31 x i8] c"invalid decimal character '%c'\00"
define i32 @dec2bin(i8 signext %0) {
%2 = alloca i32
%3 = alloca i8
store i8 %0, i8* %3
%4 = load i8, i8* %3
%5 = sext i8 %4 to i32
%6 = icmp sge i32 %5, 48
br i1 %6, label %7, label %15
7: ; preds = %1
%8 = load i8, i8* %3
%9 = sext i8 %8 to i32
%10 = icmp sle i32 %9, 57
br i1 %10, label %11, label %15
11: ; preds = %7
%12 = load i8, i8* %3
%13 = sext i8 %12 to i32
%14 = sub nsw i32 %13, 48
store i32 %14, i32* %2
br label %18
15: ; preds = %7, %1
%16 = load i8, i8* %3
%17 = call i32 @roadmap_log(i32 4, i8* getelementptr inbounds ([146 x i8], [146 x i8]* @.str, i64 0, i64 0), i32 85, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8 signext %16)
store i32 0, i32* %2
br label %18
18: ; preds = %15, %11
%19 = load i32, i32* %2
ret i32 %19
}

LLVM IR (-O2):
@.str = [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.1 = [31 x i8] c"invalid decimal character '%c'\00"
define i32 @dec2bin(i8 signext %0) {
%2 = add i8 %0, -48
%3 = icmp ult i8 %2, 10
br i1 %3, label %4, label %7
4: ; preds = %1
%5 = zext i8 %0 to i32
%6 = add nsw i32 %5, -48
br label %9
7: ; preds = %1
%8 = tail call i32 @roadmap_log(i32 4, i8* getelementptr inbounds ([146 x i8], [146 x i8]* @.str, i64 0, i64 0), i32 85, i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8 signext %0)
br label %9
9: ; preds = %7, %4
%10 = phi i32 [ %6, %4 ], [ 0, %7 ]
ret i32 %10
}