#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*/ fprintf(int /*<<< orphan*/, char *, char const *, int,
                           char const *);
int sscanf(char const *, char *, unsigned long long *);
int /*<<< orphan*/ stderr;
int number_scan(unsigned long long *buf, char const *arg, char const *file,
                int line) {
  if (sscanf(arg, "%llu", buf) != 1) {
    fprintf(stderr, "%s:%d: expected number, got \"%s\"\n", file, line, arg);
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<number_scan>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %rdx,-0x20(%rbp)
mov    %ecx,-0x24(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x10(%rbp),%rdx
lea    0xeba(%rip),%rsi
call   1040 <sscanf@plt>
cmp    $0x1,%eax
je     1180 <number_scan+0x60>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
mov    -0x20(%rbp),%rdx
mov    -0x24(%rbp),%ecx
mov    -0x18(%rbp),%r8
lea    0xe96(%rip),%rsi
call   1030 <fprintf@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    1187 <number_scan+0x67>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<number_scan>:
push   %rbp
push   %r14
push   %rbx
mov    %ecx,%r14d
mov    %rdx,%rbp
mov    %rsi,%rbx
mov    %rdi,%rdx
lea    0xec9(%rip),%rsi
mov    %rbx,%rdi
call   1040 <sscanf@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x1,%ecx
je     116b <number_scan+0x4b>
mov    0x2e91(%rip),%rax
mov    (%rax),%edi
lea    0xead(%rip),%rsi
mov    %rbp,%rdx
mov    %r14d,%ecx
mov    %rbx,%r8
call   1030 <fprintf@plt>
mov    $0xffffffff,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%llu\00"
@stderr = global i32 0
@.str.1 = [34 x i8] c"%s:%d: expected number, got \22%s\22\0A\00"
define i32 @number_scan(i64* %0, i8* %1, i8* %2, i32 %3) {
%5 = alloca i32
%6 = alloca i64*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca i32
store i64* %0, i64** %6
store i8* %1, i8** %7
store i8* %2, i8** %8
store i32 %3, i32* %9
%10 = load i8*, i8** %7
%11 = load i64*, i64** %6
%12 = call i32 @sscanf(i8* %10, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %11)
%13 = icmp ne i32 %12, 1
br i1 %13, label %14, label %20
14: ; preds = %4
%15 = load i32, i32* @stderr
%16 = load i8*, i8** %8
%17 = load i32, i32* %9
%18 = load i8*, i8** %7
%19 = call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i8* %16, i32 %17, i8* %18)
store i32 -1, i32* %5
br label %21
20: ; preds = %4
store i32 0, i32* %5
br label %21
21: ; preds = %20, %14
%22 = load i32, i32* %5
ret i32 %22
}

LLVM IR (-O2):
@.str = [5 x i8] c"%llu\00"
@stderr = global i32 0
@.str.1 = [34 x i8] c"%s:%d: expected number, got \22%s\22\0A\00"
define i32 @number_scan(i64* %0, i8* %1, i8* %2, i32 %3) {
%5 = tail call i32 @sscanf(i8* %1, i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i64* %0)
%6 = icmp eq i32 %5, 1
br i1 %6, label %10, label %7
7: ; preds = %4
%8 = load i32, i32* @stderr
%9 = tail call i32 @fprintf(i32 %8, i8* getelementptr inbounds ([34 x i8], [34 x i8]* @.str.1, i64 0, i64 0), i8* %2, i32 %3, i8* %1)
br label %10
10: ; preds = %4, %7
%11 = phi i32 [ -1, %7 ], [ 0, %4 ]
ret i32 %11
}