#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*/ bench_assertion_failed(char *, int, char *);
scalar_t__ isdigit(char const);
const char *parseint(const char *s, int *n) {
  int sign = 1;
  *n = 0;
  if (*s == '-') {
    sign = -1;
    ++s;
  } else if (*s == '+') {
    sign = +1;
    ++s;
  }
  (void)((isdigit(*s)) ||
         (bench_assertion_failed(
              "isdigit(*s)", 98,
              "/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/"
              "2022-01-22/02-19-57/repos/abrahamneben/orbcomm_beam_mapping/"
              "refs/heads/master/cinelerra-4.6/cinelerra-4.6.mod/thirdparty/"
              "fftw-3.0.1/libbench2/problem.c"),
          0));
  while (isdigit(*s)) {
    *n = *n * 10 + (*s - '0');
    ++s;
  }
  *n *= sign;
  return s;
}


x86 assembly (clang, -O0):
<parseint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0x1,-0x14(%rbp)
mov    -0x10(%rbp),%rax
movl   $0x0,(%rax)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2d,%eax
jne    1169 <parseint+0x49>
movl   $0xffffffff,-0x14(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1191 <parseint+0x71>
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x2b,%eax
jne    118c <parseint+0x6c>
movl   $0x1,-0x14(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    1191 <parseint+0x71>
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
mov    %rax,%rcx
mov    $0x1,%al
cmp    $0x0,%rcx
mov    %al,-0x15(%rbp)
jne    11cc <parseint+0xac>
lea    0xe4a(%rip),%rdi
mov    $0x62,%esi
lea    0xe4a(%rip),%rdx
call   1040 <bench_assertion_failed@plt>
xor    %eax,%eax
mov    %al,-0x15(%rbp)
mov    -0x15(%rbp),%al
mov    -0x8(%rbp),%rax
movsbl (%rax),%edi
call   1030 <isdigit@plt>
cmp    $0x0,%rax
je     120f <parseint+0xef>
mov    -0x10(%rbp),%rax
imul   $0xa,(%rax),%ecx
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
sub    $0x30,%eax
add    %eax,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    11cf <parseint+0xaf>
mov    -0x14(%rbp),%ecx
mov    -0x10(%rbp),%rax
imul   (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parseint>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
movl   $0x0,(%rsi)
mov    (%rdi),%al
mov    $0x1,%ebp
cmp    $0x2b,%al
je     114a <parseint+0x2a>
cmp    $0x2d,%al
jne    114e <parseint+0x2e>
add    $0x1,%rbx
mov    $0xffffffff,%ebp
jmp    114e <parseint+0x2e>
add    $0x1,%rbx
movsbl (%rbx),%edi
call   1030 <isdigit@plt>
test   %rax,%rax
jne    1173 <parseint+0x53>
lea    0xe9e(%rip),%rdi
lea    0xea3(%rip),%rdx
mov    $0x62,%esi
call   1040 <bench_assertion_failed@plt>
movsbl (%rbx),%edi
cs nopw 0x0(%rax,%rax,1)
call   1030 <isdigit@plt>
test   %rax,%rax
je     11a6 <parseint+0x86>
mov    (%r14),%eax
lea    (%rax,%rax,4),%eax
movsbl (%rbx),%ecx
lea    (%rcx,%rax,2),%eax
add    $0xffffffd0,%eax
mov    %eax,(%r14)
movsbl 0x1(%rbx),%edi
add    $0x1,%rbx
jmp    1180 <parseint+0x60>
imul   (%r14),%ebp
mov    %ebp,(%r14)
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"isdigit(*s)\00"
@.str.1 = [216 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/abrahamneben/orbcomm_beam_mapping/refs/heads/master/cinelerra-4.6/cinelerra-4.6.mod/thirdparty/fftw-3.0.1/libbench2/problem.c\00"
define i8* @parseint(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca i32
store i8* %0, i8** %3
store i32* %1, i32** %4
store i32 1, i32* %5
%6 = load i32*, i32** %4
store i32 0, i32* %6
%7 = load i8*, i8** %3
%8 = load i8, i8* %7
%9 = sext i8 %8 to i32
%10 = icmp eq i32 %9, 45
br i1 %10, label %11, label %14
11: ; preds = %2
store i32 -1, i32* %5
%12 = load i8*, i8** %3
%13 = getelementptr inbounds i8, i8* %12, i32 1
store i8* %13, i8** %3
br label %23
14: ; preds = %2
%15 = load i8*, i8** %3
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 43
br i1 %18, label %19, label %22
19: ; preds = %14
store i32 1, i32* %5
%20 = load i8*, i8** %3
%21 = getelementptr inbounds i8, i8* %20, i32 1
store i8* %21, i8** %3
br label %22
22: ; preds = %19, %14
br label %23
23: ; preds = %22, %11
%24 = load i8*, i8** %3
%25 = load i8, i8* %24
%26 = call i64 @isdigit(i8 signext %25)
%27 = icmp ne i64 %26, 0
br i1 %27, label %30, label %28
28: ; preds = %23
%29 = call i32 @bench_assertion_failed(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 98, i8* getelementptr inbounds ([216 x i8], [216 x i8]* @.str.1, i64 0, i64 0))
br label %30
30: ; preds = %28, %23
%31 = phi i1 [ true, %23 ], [ false, %28 ]
%32 = zext i1 %31 to i32
br label %33
33: ; preds = %38, %30
%34 = load i8*, i8** %3
%35 = load i8, i8* %34
%36 = call i64 @isdigit(i8 signext %35)
%37 = icmp ne i64 %36, 0
br i1 %37, label %38, label %50
38: ; preds = %33
%39 = load i32*, i32** %4
%40 = load i32, i32* %39
%41 = mul nsw i32 %40, 10
%42 = load i8*, i8** %3
%43 = load i8, i8* %42
%44 = sext i8 %43 to i32
%45 = sub nsw i32 %44, 48
%46 = add nsw i32 %41, %45
%47 = load i32*, i32** %4
store i32 %46, i32* %47
%48 = load i8*, i8** %3
%49 = getelementptr inbounds i8, i8* %48, i32 1
store i8* %49, i8** %3
br label %33
50: ; preds = %33
%51 = load i32, i32* %5
%52 = load i32*, i32** %4
%53 = load i32, i32* %52
%54 = mul nsw i32 %53, %51
store i32 %54, i32* %52
%55 = load i8*, i8** %3
ret i8* %55
}

LLVM IR (-O2):
@.str = [12 x i8] c"isdigit(*s)\00"
@.str.1 = [216 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/abrahamneben/orbcomm_beam_mapping/refs/heads/master/cinelerra-4.6/cinelerra-4.6.mod/thirdparty/fftw-3.0.1/libbench2/problem.c\00"
define i8* @parseint(i8* %0, i32* nocapture %1) {
store i32 0, i32* %1
%3 = load i8, i8* %0
switch i8 %3, label %8 [
i8 45, label %4
i8 43, label %6
]
4: ; preds = %2
%5 = getelementptr inbounds i8, i8* %0, i64 1
br label %8
6: ; preds = %2
%7 = getelementptr inbounds i8, i8* %0, i64 1
br label %8
8: ; preds = %2, %6, %4
%9 = phi i8* [ %5, %4 ], [ %7, %6 ], [ %0, %2 ]
%10 = phi i32 [ -1, %4 ], [ 1, %6 ], [ 1, %2 ]
%11 = load i8, i8* %9
%12 = tail call i64 @isdigit(i8 signext %11)
%13 = icmp eq i64 %12, 0
br i1 %13, label %14, label %16
14: ; preds = %8
%15 = tail call i32 @bench_assertion_failed(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 98, i8* getelementptr inbounds ([216 x i8], [216 x i8]* @.str.1, i64 0, i64 0))
br label %16
16: ; preds = %14, %8
%17 = load i8, i8* %9
%18 = tail call i64 @isdigit(i8 signext %17)
%19 = icmp eq i64 %18, 0
br i1 %19, label %32, label %20
20: ; preds = %16, %20
%21 = phi i8* [ %28, %20 ], [ %9, %16 ]
%22 = load i32, i32* %1
%23 = mul nsw i32 %22, 10
%24 = load i8, i8* %21
%25 = sext i8 %24 to i32
%26 = add i32 %23, -48
%27 = add i32 %26, %25
store i32 %27, i32* %1
%28 = getelementptr inbounds i8, i8* %21, i64 1
%29 = load i8, i8* %28
%30 = tail call i64 @isdigit(i8 signext %29)
%31 = icmp eq i64 %30, 0
br i1 %31, label %32, label %20
32: ; preds = %20, %16
%33 = phi i8* [ %9, %16 ], [ %28, %20 ]
%34 = load i32, i32* %1
%35 = mul nsw i32 %34, %10
store i32 %35, i32* %1
ret i8* %33
}