#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*/ exit(int);
int /*<<< orphan*/ printf(char *, char *, char *);
unsigned long strtoul(char *, char **, int);
unsigned long get_number(char *line, char **ptr, int base) {
  unsigned long value;
  char *ptr2;
  value = strtoul(*ptr, &ptr2, base);
  if (ptr2 == *ptr) {
    printf("Error missing digits at: \n%s\n in line:\n%s\n", *ptr, line);
    exit(1);
  }
  *ptr = ptr2;
  return value;
}


x86 assembly (clang, -O0):
<get_number>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rax
mov    (%rax),%rdi
mov    -0x14(%rbp),%edx
lea    -0x28(%rbp),%rsi
call   1040 <strtoul@plt>
mov    %rax,-0x20(%rbp)
mov    -0x28(%rbp),%rax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%rax
jne    118c <get_number+0x5c>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
mov    -0x8(%rbp),%rdx
lea    0xe83(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x28(%rbp),%rcx
mov    -0x10(%rbp),%rax
mov    %rcx,(%rax)
mov    -0x20(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_number>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    (%rsi),%rdi
mov    %rsp,%rsi
call   1040 <strtoul@plt>
mov    (%rsp),%rsi
cmp    (%rbx),%rsi
je     1159 <get_number+0x29>
mov    %rsi,(%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret
lea    0xea0(%rip),%rdi
mov    %r14,%rdx
call   1030 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [43 x i8] c"Error missing digits at: \0A%s\0A in line:\0A%s\0A\00"
define i64 @get_number(i8* %0, i8** %1, i32 %2) {
%4 = alloca i8*
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i64
%8 = alloca i8*
store i8* %0, i8** %4
store i8** %1, i8*** %5
store i32 %2, i32* %6
%9 = load i8**, i8*** %5
%10 = load i8*, i8** %9
%11 = load i32, i32* %6
%12 = call i64 @strtoul(i8* %10, i8** %8, i32 %11)
store i64 %12, i64* %7
%13 = load i8*, i8** %8
%14 = load i8**, i8*** %5
%15 = load i8*, i8** %14
%16 = icmp eq i8* %13, %15
br i1 %16, label %17, label %23
17: ; preds = %3
%18 = load i8**, i8*** %5
%19 = load i8*, i8** %18
%20 = load i8*, i8** %4
%21 = call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* %19, i8* %20)
%22 = call i32 @exit(i32 1)
unreachable
23: ; preds = %3
%24 = load i8*, i8** %8
%25 = load i8**, i8*** %5
store i8* %24, i8** %25
%26 = load i64, i64* %7
ret i64 %26
}

LLVM IR (-O2):
@.str = [43 x i8] c"Error missing digits at: \0A%s\0A in line:\0A%s\0A\00"
define i64 @get_number(i8* %0, i8** nocapture %1, i32 %2) {
%4 = alloca i8*
%5 = bitcast i8** %4 to i8*
%6 = load i8*, i8** %1
%7 = call i64 @strtoul(i8* %6, i8** %4, i32 %2)
%8 = load i8*, i8** %4
%9 = load i8*, i8** %1
%10 = icmp eq i8* %8, %9
br i1 %10, label %11, label %14
11: ; preds = %3
%12 = tail call i32 @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0), i8* %8, i8* %0)
%13 = tail call i32 @exit(i32 1)
unreachable
14: ; preds = %3
store i8* %8, i8** %1
ret i64 %7
}