#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 */
char *extract_unit_from_file_name(const char *name, unsigned int *unit_return) {
  if (name[0] == '@' && name[2] == ':' && (name[1] == '8' || name[1] == '9')) {
    *unit_return = (unsigned int)(name[1] - '8');
    return (char *)name + 3;
  } else {
    return NULL;
  }
}


x86 assembly (clang, -O0):
<extract_unit_from_file_name>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x40,%eax
jne    1171 <extract_unit_from_file_name+0x71>
mov    -0x10(%rbp),%rax
movsbl 0x2(%rax),%eax
cmp    $0x3a,%eax
jne    1171 <extract_unit_from_file_name+0x71>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x38,%eax
je     114f <extract_unit_from_file_name+0x4f>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x39,%eax
jne    1171 <extract_unit_from_file_name+0x71>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%ecx
sub    $0x38,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
add    $0x3,%rax
mov    %rax,-0x8(%rbp)
jmp    1179 <extract_unit_from_file_name+0x79>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<extract_unit_from_file_name>:
cmpb   $0x40,(%rdi)
jne    1126 <extract_unit_from_file_name+0x26>
mov    %rdi,%rax
cmpb   $0x3a,0x2(%rdi)
jne    1126 <extract_unit_from_file_name+0x26>
movzbl 0x1(%rax),%ecx
mov    %ecx,%edx
and    $0xfe,%dl
cmp    $0x38,%dl
jne    1126 <extract_unit_from_file_name+0x26>
add    $0xffffffc8,%ecx
mov    %ecx,(%rsi)
add    $0x3,%rax
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i8* @extract_unit_from_file_name(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32*
store i8* %0, i8** %4
store i32* %1, i32** %5
%6 = load i8*, i8** %4
%7 = getelementptr inbounds i8, i8* %6, i64 0
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 64
br i1 %10, label %11, label %38
11: ; preds = %2
%12 = load i8*, i8** %4
%13 = getelementptr inbounds i8, i8* %12, i64 2
%14 = load i8, i8* %13
%15 = sext i8 %14 to i32
%16 = icmp eq i32 %15, 58
br i1 %16, label %17, label %38
17: ; preds = %11
%18 = load i8*, i8** %4
%19 = getelementptr inbounds i8, i8* %18, i64 1
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 56
br i1 %22, label %29, label %23
23: ; preds = %17
%24 = load i8*, i8** %4
%25 = getelementptr inbounds i8, i8* %24, i64 1
%26 = load i8, i8* %25
%27 = sext i8 %26 to i32
%28 = icmp eq i32 %27, 57
br i1 %28, label %29, label %38
29: ; preds = %23, %17
%30 = load i8*, i8** %4
%31 = getelementptr inbounds i8, i8* %30, i64 1
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = sub nsw i32 %33, 56
%35 = load i32*, i32** %5
store i32 %34, i32* %35
%36 = load i8*, i8** %4
%37 = getelementptr inbounds i8, i8* %36, i64 3
store i8* %37, i8** %3
br label %39
38: ; preds = %23, %11, %2
store i8* null, i8** %3
br label %39
39: ; preds = %38, %29
%40 = load i8*, i8** %3
ret i8* %40
}

LLVM IR (-O2):
define i8* @extract_unit_from_file_name(i8* %0, i32* nocapture writeonly %1) {
%3 = load i8, i8* %0
%4 = icmp eq i8 %3, 64
br i1 %4, label %5, label %18
5: ; preds = %2
%6 = getelementptr inbounds i8, i8* %0, i64 2
%7 = load i8, i8* %6
%8 = icmp eq i8 %7, 58
br i1 %8, label %9, label %18
9: ; preds = %5
%10 = getelementptr inbounds i8, i8* %0, i64 1
%11 = load i8, i8* %10
%12 = and i8 %11, -2
%13 = icmp eq i8 %12, 56
br i1 %13, label %14, label %18
14: ; preds = %9
%15 = zext i8 %11 to i32
%16 = add nsw i32 %15, -56
store i32 %16, i32* %1
%17 = getelementptr inbounds i8, i8* %0, i64 3
br label %18
18: ; preds = %9, %2, %5, %14
%19 = phi i8* [ %17, %14 ], [ null, %9 ], [ null, %5 ], [ null, %2 ]
ret i8* %19
}