#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*/ fflush(int /*<<< orphan*/);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *,
                           unsigned long long, char *);
long long int128max();
char *numtostr(int /*<<< orphan*/, long long);
int /*<<< orphan*/ stderr;
scalar_t__ strcmp(char *, char const *);
void test_minmax(void) {
  const char *llmax;
  const char *llmin;
  long long llmaxnum;
  long long llminnum;
  char *x;
  long long numlen = sizeof(long long);
  if (numlen == 16) {
    llmax = "170141183460469231731687303715884105727";
    llmin = "-170141183460469231731687303715884105728";
    llmaxnum = int128max();
    llminnum = -llmaxnum - 1LL;
  } else if (numlen == 8) {
    llmax = "9223372036854775807";
    llmin = "-9223372036854775808";
    llmaxnum = 9223372036854775807LL;
    llminnum = -llmaxnum - 1LL;
  } else {
    do {
      fprintf(stderr, "%s:%llu: %s\n",
              ("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/janmojzis/tinyssh/refs/heads/"
               "master/tinyssh-tests/numtostrtest.c"),
              (unsigned long long)(83), (("unsupported size for 'num'")));
      fflush(stderr);
      _exit(111);
    } while (0);
    ;
  }
  x = numtostr(0, llmaxnum);
  if (strcmp(x, llmax))
    do {
      fprintf(stderr, "%s:%llu: %s\n",
              ("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/janmojzis/tinyssh/refs/heads/"
               "master/tinyssh-tests/numtostrtest.c"),
              (unsigned long long)(87), (("numtostr() failure")));
      fflush(stderr);
      _exit(111);
    } while (0);
  ;
  x = numtostr(0, llminnum);
  if (strcmp(x, llmin))
    do {
      fprintf(stderr, "%s:%llu: %s\n",
              ("/scratch/repos/new/home/jordi_armengol_estape/c-scraper/"
               "outputs/2022-01-22/02-19-57/repos/janmojzis/tinyssh/refs/heads/"
               "master/tinyssh-tests/numtostrtest.c"),
              (unsigned long long)(90), (("numtostr() failure")));
      fflush(stderr);
      _exit(111);
    } while (0);
  ;
}


x86 assembly (clang, -O0):
<test_minmax>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movq   $0x8,-0x30(%rbp)
cmpq   $0x10,-0x30(%rbp)
jne    11af <test_minmax+0x4f>
lea    0xe7e(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xe9b(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    $0x0,%al
call   1050 <int128max@plt>
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
sub    -0x18(%rbp),%rax
sub    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    123b <test_minmax+0xdb>
cmpq   $0x8,-0x30(%rbp)
jne    11f1 <test_minmax+0x91>
lea    0xe90(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xe99(%rip),%rax
mov    %rax,-0x10(%rbp)
movabs $0x7fffffffffffffff,%rax
ff ff 7f
mov    %rax,-0x18(%rbp)
xor    %eax,%eax
sub    -0x18(%rbp),%rax
sub    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1236 <test_minmax+0xd6>
jmp    11f6 <test_minmax+0x96>
mov    0x2de3(%rip),%rax
mov    (%rax),%edi
lea    0xe74(%rip),%rsi
lea    0xe7a(%rip),%rdx
mov    $0x53,%ecx
lea    0xf09(%rip),%r8
call   1070 <fprintf@plt>
mov    0x2dbb(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
mov    $0x6f,%edi
call   1030 <_exit@plt>
jmp    123b <test_minmax+0xdb>
mov    -0x18(%rbp),%rsi
xor    %edi,%edi
call   1040 <numtostr@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     12a6 <test_minmax+0x146>
jmp    1266 <test_minmax+0x106>
mov    0x2d73(%rip),%rax
mov    (%rax),%edi
lea    0xe04(%rip),%rsi
lea    0xe0a(%rip),%rdx
mov    $0x57,%ecx
lea    0xeb4(%rip),%r8
call   1070 <fprintf@plt>
mov    0x2d4b(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
mov    $0x6f,%edi
call   1030 <_exit@plt>
mov    -0x20(%rbp),%rsi
xor    %edi,%edi
call   1040 <numtostr@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1060 <strcmp@plt>
cmp    $0x0,%rax
je     1311 <test_minmax+0x1b1>
jmp    12d1 <test_minmax+0x171>
mov    0x2d08(%rip),%rax
mov    (%rax),%edi
lea    0xd99(%rip),%rsi
lea    0xd9f(%rip),%rdx
mov    $0x5a,%ecx
lea    0xe49(%rip),%r8
call   1070 <fprintf@plt>
mov    0x2ce0(%rip),%rax
mov    (%rax),%edi
call   1080 <fflush@plt>
mov    $0x6f,%edi
call   1030 <_exit@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_minmax>:
push   %rbx
movabs $0x7fffffffffffffff,%rbx
ff ff 7f
xor    %edi,%edi
mov    %rbx,%rsi
call   1040 <numtostr@plt>
lea    0xe94(%rip),%rsi
mov    %rax,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
jne    119d <test_minmax+0x4d>
add    $0x1,%rbx
xor    %edi,%edi
mov    %rbx,%rsi
call   1040 <numtostr@plt>
lea    0xe86(%rip),%rsi
mov    %rax,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
jne    11c2 <test_minmax+0x72>
pop    %rbx
ret
mov    0x2e3c(%rip),%rbx
mov    (%rbx),%edi
lea    0xe7c(%rip),%rsi
lea    0xe82(%rip),%rdx
lea    0xf16(%rip),%r8
mov    $0x57,%ecx
jmp    11e5 <test_minmax+0x95>
mov    0x2e17(%rip),%rbx
mov    (%rbx),%edi
lea    0xe57(%rip),%rsi
lea    0xe5d(%rip),%rdx
lea    0xef1(%rip),%r8
mov    $0x5a,%ecx
call   1060 <fprintf@plt>
mov    (%rbx),%edi
call   1070 <fflush@plt>
mov    $0x6f,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
@.str = [40 x i8] c"170141183460469231731687303715884105727\00"
@.str.1 = [41 x i8] c"-170141183460469231731687303715884105728\00"
@.str.2 = [20 x i8] c"9223372036854775807\00"
@.str.3 = [21 x i8] c"-9223372036854775808\00"
@stderr = global i32 0
@.str.4 = [13 x i8] c"%s:%llu: %s\0A\00"
@.str.5 = [155 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/janmojzis/tinyssh/refs/heads/master/tinyssh-tests/numtostrtest.c\00"
@.str.6 = [27 x i8] c"unsupported size for 'num'\00"
@.str.7 = [19 x i8] c"numtostr() failure\00"
define void @test_minmax() {
%1 = alloca i8*
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i64
%5 = alloca i8*
%6 = alloca i64
store i64 8, i64* %6
%7 = load i64, i64* %6
%8 = icmp eq i64 %7, 16
br i1 %8, label %9, label %14
9: ; preds = %0
store i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str, i64 0, i64 0), i8** %1
store i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str.1, i64 0, i64 0), i8** %2
%10 = call i64 (...) @int128max()
store i64 %10, i64* %3
%11 = load i64, i64* %3
%12 = sub nsw i64 0, %11
%13 = sub nsw i64 %12, 1
store i64 %13, i64* %4
br label %30
14: ; preds = %0
%15 = load i64, i64* %6
%16 = icmp eq i64 %15, 8
br i1 %16, label %17, label %21
17: ; preds = %14
store i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0), i8** %1
store i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i8** %2
store i64 9223372036854775807, i64* %3
%18 = load i64, i64* %3
%19 = sub nsw i64 0, %18
%20 = sub nsw i64 %19, 1
store i64 %20, i64* %4
br label %29
21: ; preds = %14
br label %22
22: ; preds = %21
%23 = load i32, i32* @stderr
%24 = call i32 @fprintf(i32 %23, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([155 x i8], [155 x i8]* @.str.5, i64 0, i64 0), i64 83, i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.6, i64 0, i64 0))
%25 = load i32, i32* @stderr
%26 = call i32 @fflush(i32 %25)
%27 = call i32 @_exit(i32 111)
unreachable
28: ; No predecessors!
br label %29
29: ; preds = %28, %17
br label %30
30: ; preds = %29, %9
%31 = load i64, i64* %3
%32 = call i8* @numtostr(i32 0, i64 %31)
store i8* %32, i8** %5
%33 = load i8*, i8** %5
%34 = load i8*, i8** %1
%35 = call i64 @strcmp(i8* %33, i8* %34)
%36 = icmp ne i64 %35, 0
br i1 %36, label %37, label %45
37: ; preds = %30
br label %38
38: ; preds = %37
%39 = load i32, i32* @stderr
%40 = call i32 @fprintf(i32 %39, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([155 x i8], [155 x i8]* @.str.5, i64 0, i64 0), i64 87, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0))
%41 = load i32, i32* @stderr
%42 = call i32 @fflush(i32 %41)
%43 = call i32 @_exit(i32 111)
unreachable
44: ; No predecessors!
br label %45
45: ; preds = %44, %30
%46 = load i64, i64* %4
%47 = call i8* @numtostr(i32 0, i64 %46)
store i8* %47, i8** %5
%48 = load i8*, i8** %5
%49 = load i8*, i8** %2
%50 = call i64 @strcmp(i8* %48, i8* %49)
%51 = icmp ne i64 %50, 0
br i1 %51, label %52, label %60
52: ; preds = %45
br label %53
53: ; preds = %52
%54 = load i32, i32* @stderr
%55 = call i32 @fprintf(i32 %54, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([155 x i8], [155 x i8]* @.str.5, i64 0, i64 0), i64 90, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0))
%56 = load i32, i32* @stderr
%57 = call i32 @fflush(i32 %56)
%58 = call i32 @_exit(i32 111)
unreachable
59: ; No predecessors!
br label %60
60: ; preds = %59, %45
ret void
}

LLVM IR (-O2):
@.str.2 = [20 x i8] c"9223372036854775807\00"
@.str.3 = [21 x i8] c"-9223372036854775808\00"
@stderr = global i32 0
@.str.4 = [13 x i8] c"%s:%llu: %s\0A\00"
@.str.5 = [155 x i8] c"/scratch/repos/new/home/jordi_armengol_estape/c-scraper/outputs/2022-01-22/02-19-57/repos/janmojzis/tinyssh/refs/heads/master/tinyssh-tests/numtostrtest.c\00"
@.str.7 = [19 x i8] c"numtostr() failure\00"
define void @test_minmax() {
%1 = tail call i8* @numtostr(i32 0, i64 9223372036854775807)
%2 = tail call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([20 x i8], [20 x i8]* @.str.2, i64 0, i64 0))
%3 = icmp eq i64 %2, 0
br i1 %3, label %10, label %4
4: ; preds = %0
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([155 x i8], [155 x i8]* @.str.5, i64 0, i64 0), i64 87, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0))
%7 = load i32, i32* @stderr
%8 = tail call i32 @fflush(i32 %7)
%9 = tail call i32 @_exit(i32 111)
unreachable
10: ; preds = %0
%11 = tail call i8* @numtostr(i32 0, i64 -9223372036854775808)
%12 = tail call i64 @strcmp(i8* %11, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0))
%13 = icmp eq i64 %12, 0
br i1 %13, label %20, label %14
14: ; preds = %10
%15 = load i32, i32* @stderr
%16 = tail call i32 @fprintf(i32 %15, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i8* getelementptr inbounds ([155 x i8], [155 x i8]* @.str.5, i64 0, i64 0), i64 90, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.7, i64 0, i64 0))
%17 = load i32, i32* @stderr
%18 = tail call i32 @fflush(i32 %17)
%19 = tail call i32 @_exit(i32 111)
unreachable
20: ; preds = %10
ret void
}