#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;

/* Variables and functions */
uint8_t digitalPinToTimer(uint8_t pin) {
  if (pin >= 3 && pin <= 6)
    return pin - 2;
  if (pin >= 9 && pin <= 10)
    return pin - 4;
  if (pin >= 20 && pin <= 23)
    return pin - 13;
  return 0;
}


x86 assembly (clang, -O0):
<digitalPinToTimer>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x3,-0x8(%rbp)
jl     1129 <digitalPinToTimer+0x29>
cmpl   $0x6,-0x8(%rbp)
jg     1129 <digitalPinToTimer+0x29>
mov    -0x8(%rbp),%eax
sub    $0x2,%eax
mov    %eax,-0x4(%rbp)
jmp    1174 <digitalPinToTimer+0x74>
cmpl   $0x9,-0x8(%rbp)
jl     114b <digitalPinToTimer+0x4b>
cmpl   $0xa,-0x8(%rbp)
jg     114b <digitalPinToTimer+0x4b>
mov    -0x8(%rbp),%eax
sub    $0x4,%eax
mov    %eax,-0x4(%rbp)
jmp    1174 <digitalPinToTimer+0x74>
cmpl   $0x14,-0x8(%rbp)
jl     116d <digitalPinToTimer+0x6d>
cmpl   $0x17,-0x8(%rbp)
jg     116d <digitalPinToTimer+0x6d>
mov    -0x8(%rbp),%eax
sub    $0xd,%eax
mov    %eax,-0x4(%rbp)
jmp    1174 <digitalPinToTimer+0x74>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<digitalPinToTimer>:
mov    %edi,%eax
lea    -0x3(%rax),%ecx
cmp    $0x3,%ecx
ja     110e <digitalPinToTimer+0xe>
add    $0xfffffffe,%eax
ret
lea    -0x9(%rax),%ecx
cmp    $0x1,%ecx
ja     111a <digitalPinToTimer+0x1a>
add    $0xfffffffc,%eax
ret
mov    %eax,%ecx
and    $0xfffffffc,%ecx
add    $0xfffffff3,%eax
xor    %edx,%edx
cmp    $0x14,%ecx
cmove  %eax,%edx
mov    %edx,%eax
ret

LLVM IR (-O0):
define i32 @digitalPinToTimer(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
%5 = icmp sge i32 %4, 3
br i1 %5, label %6, label %12
6: ; preds = %1
%7 = load i32, i32* %3
%8 = icmp sle i32 %7, 6
br i1 %8, label %9, label %12
9: ; preds = %6
%10 = load i32, i32* %3
%11 = sub nsw i32 %10, 2
store i32 %11, i32* %2
br label %31
12: ; preds = %6, %1
%13 = load i32, i32* %3
%14 = icmp sge i32 %13, 9
br i1 %14, label %15, label %21
15: ; preds = %12
%16 = load i32, i32* %3
%17 = icmp sle i32 %16, 10
br i1 %17, label %18, label %21
18: ; preds = %15
%19 = load i32, i32* %3
%20 = sub nsw i32 %19, 4
store i32 %20, i32* %2
br label %31
21: ; preds = %15, %12
%22 = load i32, i32* %3
%23 = icmp sge i32 %22, 20
br i1 %23, label %24, label %30
24: ; preds = %21
%25 = load i32, i32* %3
%26 = icmp sle i32 %25, 23
br i1 %26, label %27, label %30
27: ; preds = %24
%28 = load i32, i32* %3
%29 = sub nsw i32 %28, 13
store i32 %29, i32* %2
br label %31
30: ; preds = %24, %21
store i32 0, i32* %2
br label %31
31: ; preds = %30, %27, %18, %9
%32 = load i32, i32* %2
ret i32 %32
}

LLVM IR (-O2):
define i32 @digitalPinToTimer(i32 %0) {
%2 = add i32 %0, -3
%3 = icmp ult i32 %2, 4
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = add nsw i32 %0, -2
br label %16
6: ; preds = %1
%7 = add i32 %0, -9
%8 = icmp ult i32 %7, 2
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = add nsw i32 %0, -4
br label %16
11: ; preds = %6
%12 = and i32 %0, -4
%13 = icmp eq i32 %12, 20
%14 = add nsw i32 %0, -13
%15 = select i1 %13, i32 %14, i32 0
br label %16
16: ; preds = %11, %9, %4
%17 = phi i32 [ %5, %4 ], [ %10, %9 ], [ %15, %11 ]
ret i32 %17
}