#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*/ linenofail(char *);
int getslash(char **pp) {
  char *p = *pp;
  int answer;
  if (*p != '/')
    linenofail("`/' expected");
  ++p;
  if (*p < '0' || *p > '7')
    linenofail("Octal digit expected");
  answer = *p - '0';
  ++p;
  *pp = p;
  return answer;
}


x86 assembly (clang, -O0):
<getslash>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2f,%eax
je     1143 <getslash+0x33>
lea    0xec2(%rip),%rdi
call   1030 <linenofail@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jl     116f <getslash+0x5f>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x37,%eax
jle    117b <getslash+0x6b>
lea    0xe97(%rip),%rdi
call   1030 <linenofail@plt>
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
sub    $0x30,%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rcx
mov    -0x8(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x14(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getslash>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
mov    (%rdi),%rbx
cmpb   $0x2f,(%rbx)
je     112b <getslash+0x1b>
lea    0xeda(%rip),%rdi
call   1030 <linenofail@plt>
mov    0x1(%rbx),%al
lea    -0x38(%rax),%ecx
cmp    $0xf7,%cl
ja     1145 <getslash+0x35>
lea    0xed0(%rip),%rdi
call   1030 <linenofail@plt>
mov    0x1(%rbx),%al
movsbl %al,%eax
add    $0xffffffd0,%eax
add    $0x2,%rbx
mov    %rbx,(%r14)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [13 x i8] c"`/' expected\00"
@.str.1 = [21 x i8] c"Octal digit expected\00"
define i32 @getslash(i8** %0) {
%2 = alloca i8**
%3 = alloca i8*
%4 = alloca i32
store i8** %0, i8*** %2
%5 = load i8**, i8*** %2
%6 = load i8*, i8** %5
store i8* %6, i8** %3
%7 = load i8*, i8** %3
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp ne i32 %9, 47
br i1 %10, label %11, label %13
11: ; preds = %1
%12 = call i32 @linenofail(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %13
13: ; preds = %11, %1
%14 = load i8*, i8** %3
%15 = getelementptr inbounds i8, i8* %14, i32 1
store i8* %15, i8** %3
%16 = load i8*, i8** %3
%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** %3
%22 = load i8, i8* %21
%23 = sext i8 %22 to i32
%24 = icmp sgt i32 %23, 55
br i1 %24, label %25, label %27
25: ; preds = %20, %13
%26 = call i32 @linenofail(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
br label %27
27: ; preds = %25, %20
%28 = load i8*, i8** %3
%29 = load i8, i8* %28
%30 = sext i8 %29 to i32
%31 = sub nsw i32 %30, 48
store i32 %31, i32* %4
%32 = load i8*, i8** %3
%33 = getelementptr inbounds i8, i8* %32, i32 1
store i8* %33, i8** %3
%34 = load i8*, i8** %3
%35 = load i8**, i8*** %2
store i8* %34, i8** %35
%36 = load i32, i32* %4
ret i32 %36
}

LLVM IR (-O2):
@.str = [13 x i8] c"`/' expected\00"
@.str.1 = [21 x i8] c"Octal digit expected\00"
define i32 @getslash(i8** nocapture %0) {
%2 = load i8*, i8** %0
%3 = load i8, i8* %2
%4 = icmp eq i8 %3, 47
br i1 %4, label %7, label %5
5: ; preds = %1
%6 = tail call i32 @linenofail(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %1
%8 = getelementptr inbounds i8, i8* %2, i64 1
%9 = load i8, i8* %8
%10 = add i8 %9, -56
%11 = icmp ult i8 %10, -8
br i1 %11, label %12, label %15
12: ; preds = %7
%13 = tail call i32 @linenofail(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.1, i64 0, i64 0))
%14 = load i8, i8* %8
br label %15
15: ; preds = %7, %12
%16 = phi i8 [ %9, %7 ], [ %14, %12 ]
%17 = sext i8 %16 to i32
%18 = add nsw i32 %17, -48
%19 = getelementptr inbounds i8, i8* %2, i64 2
store i8* %19, i8** %0
ret i32 %18
}