#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 */
scalar_t__ isdigit(char const);
int /*<<< orphan*/ yyerror(char *);
const char *getInt(const char *cp, int *ip) {
  *ip = 0;
  if (*cp == '\0')
    return cp;
  if (*cp++ != '_')
    yyerror("An underscore must separate the parts of a SIP version number");
  while (isdigit(*cp)) {
    *ip *= 10;
    *ip += *cp - '0';
    ++cp;
  }
  return cp;
}


x86 assembly (clang, -O0):
<getInt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1157 <getInt+0x37>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
jmp    11cd <getInt+0xad>
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
movsbl (%rax),%eax
cmp    $0x5f,%eax
je     117e <getInt+0x5e>
lea    0xe87(%rip),%rdi
call   1040 <yyerror@plt>
jmp    1183 <getInt+0x63>
mov    -0x10(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     11c5 <getInt+0xa5>
mov    -0x18(%rbp),%rax
imul   $0xa,(%rax),%ecx
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
movsbl (%rax),%ecx
sub    $0x30,%ecx
mov    -0x18(%rbp),%rax
add    (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
jmp    1183 <getInt+0x63>
mov    -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getInt>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
movl   $0x0,(%rsi)
mov    (%rdi),%al
test   %al,%al
je     1178 <getInt+0x58>
mov    %rsi,%r14
cmp    $0x5f,%al
je     1166 <getInt+0x46>
lea    0xebf(%rip),%rdi
call   1040 <yyerror@plt>
jmp    1166 <getInt+0x46>
nopl   0x0(%rax,%rax,1)
mov    (%r14),%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
mov    %eax,(%r14)
movsbl (%rbx),%ecx
add    %ecx,%eax
add    $0xffffffd0,%eax
mov    %eax,(%r14)
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
call   1030 <isdigit@plt>
test   %rax,%rax
jne    1150 <getInt+0x30>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [62 x i8] c"An underscore must separate the parts of a SIP version number\00"
define i8* @getInt(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 i32*, i32** %5
store i32 0, i32* %6
%7 = load i8*, i8** %4
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %13
11: ; preds = %2
%12 = load i8*, i8** %4
store i8* %12, i8** %3
br label %42
13: ; preds = %2
%14 = load i8*, i8** %4
%15 = getelementptr inbounds i8, i8* %14, i32 1
store i8* %15, i8** %4
%16 = load i8, i8* %14
%17 = sext i8 %16 to i32
%18 = icmp ne i32 %17, 95
br i1 %18, label %19, label %21
19: ; preds = %13
%20 = call i32 @yyerror(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0))
br label %21
21: ; preds = %19, %13
br label %22
22: ; preds = %27, %21
%23 = load i8*, i8** %4
%24 = load i8, i8* %23
%25 = call i64 @isdigit(i8 signext %24)
%26 = icmp ne i64 %25, 0
br i1 %26, label %27, label %40
27: ; preds = %22
%28 = load i32*, i32** %5
%29 = load i32, i32* %28
%30 = mul nsw i32 %29, 10
store i32 %30, i32* %28
%31 = load i8*, i8** %4
%32 = load i8, i8* %31
%33 = sext i8 %32 to i32
%34 = sub nsw i32 %33, 48
%35 = load i32*, i32** %5
%36 = load i32, i32* %35
%37 = add nsw i32 %36, %34
store i32 %37, i32* %35
%38 = load i8*, i8** %4
%39 = getelementptr inbounds i8, i8* %38, i32 1
store i8* %39, i8** %4
br label %22
40: ; preds = %22
%41 = load i8*, i8** %4
store i8* %41, i8** %3
br label %42
42: ; preds = %40, %11
%43 = load i8*, i8** %3
ret i8* %43
}

LLVM IR (-O2):
@.str = [62 x i8] c"An underscore must separate the parts of a SIP version number\00"
define i8* @getInt(i8* %0, i32* nocapture %1) {
store i32 0, i32* %1
%3 = load i8, i8* %0
switch i8 %3, label %4 [
i8 0, label %23
i8 95, label %6
]
4: ; preds = %2
%5 = tail call i32 @yyerror(i8* getelementptr inbounds ([62 x i8], [62 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %2, %4
%7 = getelementptr inbounds i8, i8* %0, i64 1
%8 = load i8, i8* %7
%9 = tail call i64 @isdigit(i8 signext %8)
%10 = icmp eq i64 %9, 0
br i1 %10, label %23, label %11
11: ; preds = %6, %11
%12 = phi i8* [ %19, %11 ], [ %7, %6 ]
%13 = load i32, i32* %1
%14 = mul nsw i32 %13, 10
store i32 %14, i32* %1
%15 = load i8, i8* %12
%16 = sext i8 %15 to i32
%17 = add i32 %14, -48
%18 = add i32 %17, %16
store i32 %18, i32* %1
%19 = getelementptr inbounds i8, i8* %12, i64 1
%20 = load i8, i8* %19
%21 = tail call i64 @isdigit(i8 signext %20)
%22 = icmp eq i64 %21, 0
br i1 %22, label %23, label %11
23: ; preds = %11, %6, %2
%24 = phi i8* [ %0, %2 ], [ %7, %6 ], [ %19, %11 ]
ret i8* %24
}