#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*/ printf(char *, char const *);
int /*<<< orphan*/ puts(char *);
long long int strtoll(const char *restrict nptr, char **restrict endptr,
                      int base) {
  if (base != 10) {
    puts("strtoll: base != 10");
    return 0;
  }
  (void)nptr;
  (void)endptr;
  (void)base;
  printf("strtoll: not implemented (%s)\n", nptr);
  if (endptr != NULL) {
    *endptr = (char *)&nptr[1];
  }
  return 1;
}


x86 assembly (clang, -O0):
<strtoll>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    %edx,-0x1c(%rbp)
cmpl   $0xa,-0x1c(%rbp)
je     1156 <strtoll+0x36>
lea    0xebc(%rip),%rdi
call   1030 <puts@plt>
movq   $0x0,-0x8(%rbp)
jmp    1188 <strtoll+0x68>
mov    -0x10(%rbp),%rsi
lea    0xeb3(%rip),%rdi
call   1040 <printf@plt>
cmpq   $0x0,-0x18(%rbp)
je     1180 <strtoll+0x60>
mov    -0x10(%rbp),%rcx
add    $0x1,%rcx
mov    -0x18(%rbp),%rax
mov    %rcx,(%rax)
movq   $0x1,-0x8(%rbp)
mov    -0x8(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<strtoll>:
push   %r14
push   %rbx
push   %rax
cmp    $0xa,%edx
jne    1151 <strtoll+0x31>
mov    %rsi,%r14
mov    %rdi,%rbx
lea    0xede(%rip),%rdi
mov    %rbx,%rsi
call   1040 <printf@plt>
mov    $0x1,%eax
test   %r14,%r14
je     115f <strtoll+0x3f>
add    $0x1,%rbx
mov    %rbx,(%r14)
jmp    115f <strtoll+0x3f>
lea    0xea8(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [20 x i8] c"strtoll: base != 10\00"
@.str.1 = [31 x i8] c"strtoll: not implemented (%s)\0A\00"
define i64 @strtoll(i8* noalias %0, i8** noalias %1, i32 %2) {
%4 = alloca i64
%5 = alloca i8*
%6 = alloca i8**
%7 = alloca i32
store i8* %0, i8** %5
store i8** %1, i8*** %6
store i32 %2, i32* %7
%8 = load i32, i32* %7
%9 = icmp ne i32 %8, 10
br i1 %9, label %10, label %12
10: ; preds = %3
%11 = call i32 @puts(i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
store i64 0, i64* %4
br label %25
12: ; preds = %3
%13 = load i8*, i8** %5
%14 = load i8**, i8*** %6
%15 = load i32, i32* %7
%16 = load i8*, i8** %5
%17 = call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* %16)
%18 = load i8**, i8*** %6
%19 = icmp ne i8** %18, null
br i1 %19, label %20, label %24
20: ; preds = %12
%21 = load i8*, i8** %5
%22 = getelementptr inbounds i8, i8* %21, i64 1
%23 = load i8**, i8*** %6
store i8* %22, i8** %23
br label %24
24: ; preds = %20, %12
store i64 1, i64* %4
br label %25
25: ; preds = %24, %10
%26 = load i64, i64* %4
ret i64 %26
}

LLVM IR (-O2):
@.str = [20 x i8] c"strtoll: base != 10\00"
@.str.1 = [31 x i8] c"strtoll: not implemented (%s)\0A\00"
define i64 @strtoll(i8* noalias %0, i8** noalias writeonly %1, i32 %2) {
%4 = icmp eq i32 %2, 10
br i1 %4, label %7, label %5
5: ; preds = %3
%6 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([20 x i8], [20 x i8]* @.str, i64 0, i64 0))
br label %12
7: ; preds = %3
%8 = tail call i32 @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%9 = icmp eq i8** %1, null
br i1 %9, label %12, label %10
10: ; preds = %7
%11 = getelementptr inbounds i8, i8* %0, i64 1
store i8* %11, i8** %1
br label %12
12: ; preds = %7, %10, %5
%13 = phi i64 [ 0, %5 ], [ 1, %10 ], [ 1, %7 ]
ret i64 %13
}