#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*/ add_to_asmtab(int);
int /*<<< orphan*/ linenofail(char *);
unsigned char getmachine(char **pp) {
  char *p = *pp;
  unsigned char value;
  if (*p != ';')
    return 0;
  ++p;
  if (*p < '0' || *p > '6')
    linenofail("bad machine type");
  value = *p++ - '0';
  add_to_asmtab(0xed + value);
  *pp = p;
  return value;
}


x86 assembly (clang, -O0):
<getmachine>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x3b,%eax
je     1150 <getmachine+0x30>
movb   $0x0,-0x1(%rbp)
jmp    11c0 <getmachine+0xa0>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jl     117c <getmachine+0x5c>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x36,%eax
jle    1188 <getmachine+0x68>
lea    0xe7d(%rip),%rdi
call   1030 <linenofail@plt>
mov    -0x18(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x18(%rbp)
movsbl (%rax),%eax
sub    $0x30,%eax
mov    %al,-0x19(%rbp)
movzbl -0x19(%rbp),%edi
add    $0xed,%edi
call   1040 <add_to_asmtab@plt>
mov    -0x18(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x19(%rbp),%al
mov    %al,-0x1(%rbp)
movzbl -0x1(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getmachine>:
push   %r15
push   %r14
push   %rbx
mov    (%rdi),%r15
cmpb   $0x3b,(%r15)
jne    1166 <getmachine+0x46>
mov    %rdi,%r14
mov    0x1(%r15),%bl
lea    -0x37(%rbx),%eax
cmp    $0xf8,%al
ja     114c <getmachine+0x2c>
lea    0xebd(%rip),%rdi
call   1030 <linenofail@plt>
mov    0x1(%r15),%bl
add    $0x2,%r15
add    $0xd0,%bl
movzbl %bl,%edi
add    $0xed,%edi
call   1040 <add_to_asmtab@plt>
mov    %r15,(%r14)
jmp    1168 <getmachine+0x48>
xor    %ebx,%ebx
mov    %ebx,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [17 x i8] c"bad machine type\00"
define zeroext i8 @getmachine(i8** %0) {
%2 = alloca i8
%3 = alloca i8**
%4 = alloca i8*
%5 = alloca i8
store i8** %0, i8*** %3
%6 = load i8**, i8*** %3
%7 = load i8*, i8** %6
store i8* %7, i8** %4
%8 = load i8*, i8** %4
%9 = load i8, i8* %8
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 59
br i1 %11, label %12, label %13
12: ; preds = %1
store i8 0, i8* %2
br label %41
13: ; preds = %1
%14 = load i8*, i8** %4
%15 = getelementptr inbounds i8, i8* %14, i32 1
store i8* %15, i8** %4
%16 = load i8*, i8** %4
%17 = load i8, i8* %16
%18 = sext i8 %17 to i32
%19 = icmp slt i32 %18, 48
br i1 %19, label %25, label %20
20: ; preds = %13
%21 = load i8*, i8** %4
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp sgt i32 %23, 54
br i1 %24, label %25, label %27
25: ; preds = %20, %13
%26 = call i32 @linenofail(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
br label %27
27: ; preds = %25, %20
%28 = load i8*, i8** %4
%29 = getelementptr inbounds i8, i8* %28, i32 1
store i8* %29, i8** %4
%30 = load i8, i8* %28
%31 = sext i8 %30 to i32
%32 = sub nsw i32 %31, 48
%33 = trunc i32 %32 to i8
store i8 %33, i8* %5
%34 = load i8, i8* %5
%35 = zext i8 %34 to i32
%36 = add nsw i32 237, %35
%37 = call i32 @add_to_asmtab(i32 %36)
%38 = load i8*, i8** %4
%39 = load i8**, i8*** %3
store i8* %38, i8** %39
%40 = load i8, i8* %5
store i8 %40, i8* %2
br label %41
41: ; preds = %27, %12
%42 = load i8, i8* %2
ret i8 %42
}

LLVM IR (-O2):
@.str = [17 x i8] c"bad machine type\00"
define zeroext i8 @getmachine(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = load i8, i8* %2
%4 = icmp eq i8 %3, 59
br i1 %4, label %5, label %20
5: ; preds = %1
%6 = getelementptr inbounds i8, i8* %2, i64 1
%7 = load i8, i8* %6
%8 = add i8 %7, -55
%9 = icmp ult i8 %8, -7
br i1 %9, label %10, label %13
10: ; preds = %5
%11 = tail call i32 @linenofail(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
%12 = load i8, i8* %6
br label %13
13: ; preds = %5, %10
%14 = phi i8 [ %7, %5 ], [ %12, %10 ]
%15 = getelementptr inbounds i8, i8* %2, i64 2
%16 = add i8 %14, -48
%17 = zext i8 %16 to i32
%18 = add nuw nsw i32 %17, 237
%19 = tail call i32 @add_to_asmtab(i32 %18)
store i8* %15, i8** %0
br label %20
20: ; preds = %1, %13
%21 = phi i8 [ %16, %13 ], [ 0, %1 ]
ret i8 %21
}