#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 tolower(char);
int uint_arg(char *const, char *, int /*<<< orphan*/, int, int /*<<< orphan*/);
int /*<<< orphan*/ zz_log_err(char *, char *, char *const);
int uint_mute(char *const arg, char *name) {
  int c = tolower(*arg), mute;
  if (c >= 'a' && c <= 'd') {
    char *s = arg;
    mute = 0;
    do {
      mute |= 1 << (c - 'a');
    } while (c = tolower(*++s), (c >= 'a' && c <= 'd'));
    if (c) {
      zz_log_err(""
                 "invalid channels -- %s=%s\n",
                 name, arg);
      mute = -1;
    }
  } else {
    mute = uint_arg(arg, name, 0, 15, 0);
  }
  return mute;
}


x86 assembly (clang, -O0):
<uint_mute>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1040 <tolower@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x61,-0x14(%rbp)
jl     11ee <uint_mute+0xbe>
cmpl   $0x64,-0x14(%rbp)
jg     11ee <uint_mute+0xbe>
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x18(%rbp)
mov    -0x14(%rbp),%ecx
sub    $0x61,%ecx
mov    $0x1,%eax
shl    %cl,%eax
or     -0x18(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x20(%rbp)
movsbl 0x1(%rax),%edi
call   1040 <tolower@plt>
mov    %eax,-0x14(%rbp)
xor    %eax,%eax
cmpl   $0x61,-0x14(%rbp)
mov    %al,-0x21(%rbp)
jl     11b9 <uint_mute+0x89>
cmpl   $0x64,-0x14(%rbp)
setle  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    1172 <uint_mute+0x42>
cmpl   $0x0,-0x14(%rbp)
je     11e9 <uint_mute+0xb9>
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rdx
lea    0xe23(%rip),%rdi
call   1030 <zz_log_err@plt>
movl   $0xffffffff,-0x18(%rbp)
jmp    1209 <uint_mute+0xd9>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
xor    %r8d,%r8d
mov    $0xf,%ecx
mov    %r8d,%edx
call   1050 <uint_arg@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<uint_mute>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rsi,%r14
mov    %rdi,%r15
movsbl (%rdi),%edi
call   1040 <tolower@plt>
lea    -0x61(%rax),%ecx
cmp    $0x3,%ecx
ja     11a1 <uint_mute+0x71>
lea    0x1(%r15),%rbx
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
add    $0x9f,%al
bts    %eax,%ebp
movsbl (%rbx),%edi
call   1040 <tolower@plt>
lea    -0x61(%rax),%ecx
add    $0x1,%rbx
cmp    $0x4,%ecx
jb     1160 <uint_mute+0x30>
test   %eax,%eax
je     1194 <uint_mute+0x64>
lea    0xe7c(%rip),%rdi
mov    %r14,%rsi
mov    %r15,%rdx
call   1030 <zz_log_err@plt>
mov    $0xffffffff,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret
mov    %r15,%rdi
mov    %r14,%rsi
xor    %edx,%edx
mov    $0xf,%ecx
xor    %r8d,%r8d
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <uint_arg@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"invalid channels -- %s=%s\0A\00"
define i32 @uint_mute(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%8 = load i8*, i8** %3
%9 = load i8, i8* %8
%10 = call i32 @tolower(i8 signext %9)
store i32 %10, i32* %5
%11 = load i32, i32* %5
%12 = icmp sge i32 %11, 97
br i1 %12, label %13, label %44
13: ; preds = %2
%14 = load i32, i32* %5
%15 = icmp sle i32 %14, 100
br i1 %15, label %16, label %44
16: ; preds = %13
%17 = load i8*, i8** %3
store i8* %17, i8** %7
store i32 0, i32* %6
br label %18
18: ; preds = %34, %16
%19 = load i32, i32* %5
%20 = sub nsw i32 %19, 97
%21 = shl i32 1, %20
%22 = load i32, i32* %6
%23 = or i32 %22, %21
store i32 %23, i32* %6
br label %24
24: ; preds = %18
%25 = load i8*, i8** %7
%26 = getelementptr inbounds i8, i8* %25, i32 1
store i8* %26, i8** %7
%27 = load i8, i8* %26
%28 = call i32 @tolower(i8 signext %27)
store i32 %28, i32* %5
%29 = load i32, i32* %5
%30 = icmp sge i32 %29, 97
br i1 %30, label %31, label %34
31: ; preds = %24
%32 = load i32, i32* %5
%33 = icmp sle i32 %32, 100
br label %34
34: ; preds = %31, %24
%35 = phi i1 [ false, %24 ], [ %33, %31 ]
br i1 %35, label %18, label %36
36: ; preds = %34
%37 = load i32, i32* %5
%38 = icmp ne i32 %37, 0
br i1 %38, label %39, label %43
39: ; preds = %36
%40 = load i8*, i8** %4
%41 = load i8*, i8** %3
%42 = call i32 @zz_log_err(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %40, i8* %41)
store i32 -1, i32* %6
br label %43
43: ; preds = %39, %36
br label %48
44: ; preds = %13, %2
%45 = load i8*, i8** %3
%46 = load i8*, i8** %4
%47 = call i32 @uint_arg(i8* %45, i8* %46, i32 0, i32 15, i32 0)
store i32 %47, i32* %6
br label %48
48: ; preds = %44, %43
%49 = load i32, i32* %6
ret i32 %49
}

LLVM IR (-O2):
@.str = [27 x i8] c"invalid channels -- %s=%s\0A\00"
define i32 @uint_mute(i8* %0, i8* %1) {
%3 = load i8, i8* %0
%4 = tail call i32 @tolower(i8 signext %3)
%5 = add i32 %4, -97
%6 = icmp ult i32 %5, 4
br i1 %6, label %7, label %23
7: ; preds = %2, %7
%8 = phi i32 [ %16, %7 ], [ %4, %2 ]
%9 = phi i32 [ %13, %7 ], [ 0, %2 ]
%10 = phi i8* [ %14, %7 ], [ %0, %2 ]
%11 = add nsw i32 %8, -97
%12 = shl nuw nsw i32 1, %11
%13 = or i32 %12, %9
%14 = getelementptr inbounds i8, i8* %10, i64 1
%15 = load i8, i8* %14
%16 = tail call i32 @tolower(i8 signext %15)
%17 = add i32 %16, -97
%18 = icmp ult i32 %17, 4
br i1 %18, label %7, label %19
19: ; preds = %7
%20 = icmp eq i32 %16, 0
br i1 %20, label %25, label %21
21: ; preds = %19
%22 = tail call i32 @zz_log_err(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %0)
br label %25
23: ; preds = %2
%24 = tail call i32 @uint_arg(i8* %0, i8* %1, i32 0, i32 15, i32 0)
br label %25
25: ; preds = %19, %21, %23
%26 = phi i32 [ %24, %23 ], [ -1, %21 ], [ %13, %19 ]
ret i32 %26
}