#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 */
typedef int __int64_t;

/* Variables and functions */
int getchar();
void accept_i64(__int64_t *it) {
  *it = 0;
  int c;
  char neg = 0;
  c = getchar();
  if (c == '-') {
    neg = 1;
    c = getchar();
  }
  while (1) {
    if (c < '0')
      break;
    if (c > '9')
      break;
    *it *= 10;
    *it += c - '0';
    c = getchar();
  }
  if (neg)
    *it = -*it;
}


x86 assembly (clang, -O0):
<accept_i64>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x0,(%rax)
movb   $0x0,-0xd(%rbp)
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x2d,-0xc(%rbp)
jne    114c <accept_i64+0x3c>
movb   $0x1,-0xd(%rbp)
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %eax,-0xc(%rbp)
jmp    1151 <accept_i64+0x41>
cmpl   $0x30,-0xc(%rbp)
jge    1160 <accept_i64+0x50>
jmp    1195 <accept_i64+0x85>
cmpl   $0x39,-0xc(%rbp)
jle    116f <accept_i64+0x5f>
jmp    1195 <accept_i64+0x85>
mov    -0x8(%rbp),%rax
imul   $0xa,(%rax),%ecx
mov    %ecx,(%rax)
mov    -0xc(%rbp),%ecx
sub    $0x30,%ecx
mov    -0x8(%rbp),%rax
add    (%rax),%ecx
mov    %ecx,(%rax)
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %eax,-0xc(%rbp)
jmp    1151 <accept_i64+0x41>
cmpb   $0x0,-0xd(%rbp)
je     11ad <accept_i64+0x9d>
mov    -0x8(%rbp),%rax
xor    %ecx,%ecx
sub    (%rax),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<accept_i64>:
push   %rbp
push   %rbx
push   %rax
mov    %rdi,%rbx
movl   $0x0,(%rdi)
xor    %eax,%eax
call   1030 <getchar@plt>
mov    %eax,%ebp
cmp    $0x2d,%eax
jne    1131 <accept_i64+0x21>
xor    %eax,%eax
call   1030 <getchar@plt>
lea    -0x3a(%rax),%ecx
cmp    $0xfffffff6,%ecx
jb     115e <accept_i64+0x4e>
nopl   0x0(%rax)
mov    (%rbx),%ecx
lea    (%rcx,%rcx,4),%ecx
lea    (%rax,%rcx,2),%eax
add    $0xffffffd0,%eax
mov    %eax,(%rbx)
xor    %eax,%eax
call   1030 <getchar@plt>
mov    %eax,%ecx
add    $0xffffffc6,%ecx
cmp    $0xfffffff5,%ecx
ja     1140 <accept_i64+0x30>
cmp    $0x2d,%ebp
jne    1165 <accept_i64+0x55>
negl   (%rbx)
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define void @accept_i64(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i8
store i32* %0, i32** %2
%5 = load i32*, i32** %2
store i32 0, i32* %5
store i8 0, i8* %4
%6 = call i32 (...) @getchar()
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = icmp eq i32 %7, 45
br i1 %8, label %9, label %11
9: ; preds = %1
store i8 1, i8* %4
%10 = call i32 (...) @getchar()
store i32 %10, i32* %3
br label %11
11: ; preds = %9, %1
br label %12
12: ; preds = %11, %20
%13 = load i32, i32* %3
%14 = icmp slt i32 %13, 48
br i1 %14, label %15, label %16
15: ; preds = %12
br label %30
16: ; preds = %12
%17 = load i32, i32* %3
%18 = icmp sgt i32 %17, 57
br i1 %18, label %19, label %20
19: ; preds = %16
br label %30
20: ; preds = %16
%21 = load i32*, i32** %2
%22 = load i32, i32* %21
%23 = mul nsw i32 %22, 10
store i32 %23, i32* %21
%24 = load i32, i32* %3
%25 = sub nsw i32 %24, 48
%26 = load i32*, i32** %2
%27 = load i32, i32* %26
%28 = add nsw i32 %27, %25
store i32 %28, i32* %26
%29 = call i32 (...) @getchar()
store i32 %29, i32* %3
br label %12
30: ; preds = %19, %15
%31 = load i8, i8* %4
%32 = icmp ne i8 %31, 0
br i1 %32, label %33, label %38
33: ; preds = %30
%34 = load i32*, i32** %2
%35 = load i32, i32* %34
%36 = sub nsw i32 0, %35
%37 = load i32*, i32** %2
store i32 %36, i32* %37
br label %38
38: ; preds = %33, %30
ret void
}

LLVM IR (-O2):
define void @accept_i64(i32* nocapture %0) {
store i32 0, i32* %0
%2 = tail call i32 (...) @getchar()
%3 = icmp eq i32 %2, 45
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 (...) @getchar()
br label %6
6: ; preds = %4, %1
%7 = phi i32 [ %5, %4 ], [ %2, %1 ]
%8 = add i32 %7, -58
%9 = icmp ult i32 %8, -10
br i1 %9, label %19, label %10
10: ; preds = %6, %10
%11 = phi i32 [ %16, %10 ], [ %7, %6 ]
%12 = load i32, i32* %0
%13 = mul nsw i32 %12, 10
%14 = add nsw i32 %11, -48
%15 = add nsw i32 %14, %13
store i32 %15, i32* %0
%16 = tail call i32 (...) @getchar()
%17 = add i32 %16, -58
%18 = icmp ult i32 %17, -10
br i1 %18, label %19, label %10
19: ; preds = %10, %6
br i1 %3, label %20, label %23
20: ; preds = %19
%21 = load i32, i32* %0
%22 = sub nsw i32 0, %21
store i32 %22, i32* %0
br label %23
23: ; preds = %20, %19
ret void
}