#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 */
scalar_t__ errno;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, char *);
int /*<<< orphan*/ stderr;
int strtol(char *, int /*<<< orphan*/ *, int);
int print_results(void *status, int field_count, char **row, char **fields) {
  (void)fields;
  (void)field_count;
  if (row[0] == NULL) {
    row[0] = "0";
  }
  if (*((int *)status) == 101) {
    errno = 0;
    *((int *)status) = strtol(row[0], NULL, 10);
    if (*((int *)status) < 0) {
      *((int *)status) *= -1;
    }
    if (*((int *)status) == 0) {
      *((int *)status) = 1;
    }
    if (errno) {
      fputs("Fatal error.", stderr);
      exit(-1);
    }
  } else {
    printf("%s\n", row[0]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<print_results>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
jne    1173 <print_results+0x33>
mov    -0x18(%rbp),%rax
lea    0xe90(%rip),%rcx
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
cmpl   $0x65,(%rax)
jne    120d <print_results+0xcd>
mov    0x2e51(%rip),%rax
movq   $0x0,(%rax)
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
xor    %eax,%eax
mov    %eax,%esi
mov    $0xa,%edx
call   1050 <strtol@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
cmpl   $0x0,(%rax)
jge    11c1 <print_results+0x81>
mov    -0x8(%rbp),%rax
imul   $0xffffffff,(%rax),%ecx
mov    %ecx,(%rax)
mov    -0x8(%rbp),%rax
cmpl   $0x0,(%rax)
jne    11d8 <print_results+0x98>
mov    -0x8(%rbp),%rax
movl   $0x1,(%rax)
mov    0x2df9(%rip),%rax
cmpq   $0x0,(%rax)
je     1208 <print_results+0xc8>
mov    0x2df0(%rip),%rax
mov    (%rax),%esi
lea    0xe09(%rip),%rdi
call   1040 <fputs@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>
jmp    1220 <print_results+0xe0>
mov    -0x18(%rbp),%rax
mov    (%rax),%rsi
lea    0xdf4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_results>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
mov    (%rdx),%rsi
test   %rsi,%rsi
je     11a7 <print_results+0x67>
cmpl   $0x65,(%rbx)
jne    11b6 <print_results+0x76>
mov    0x2e7d(%rip),%r14
movq   $0x0,(%r14)
mov    %rsi,%rdi
xor    %esi,%esi
mov    $0xa,%edx
call   1050 <strtol@plt>
mov    %eax,%ecx
neg    %ecx
cmovs  %eax,%ecx
mov    $0x1,%eax
cmovb  %ecx,%eax
mov    %eax,(%rbx)
cmpq   $0x0,(%r14)
je     11c2 <print_results+0x82>
mov    0x2e51(%rip),%rax
mov    (%rax),%esi
lea    0xe6a(%rip),%rdi
call   1040 <fputs@plt>
mov    $0xffffffff,%edi
call   1060 <exit@plt>
lea    0xe52(%rip),%rsi
mov    %rsi,(%rdx)
cmpl   $0x65,(%rbx)
je     1154 <print_results+0x14>
lea    0xe52(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [2 x i8] c"0\00"
@errno = global i64 0
@.str.1 = [13 x i8] c"Fatal error.\00"
@stderr = global i32 0
@.str.2 = [4 x i8] c"%s\0A\00"
define i32 @print_results(i8* %0, i32 %1, i8** %2, i8** %3) {
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8**
%8 = alloca i8**
store i8* %0, i8** %5
store i32 %1, i32* %6
store i8** %2, i8*** %7
store i8** %3, i8*** %8
%9 = load i8**, i8*** %8
%10 = load i32, i32* %6
%11 = load i8**, i8*** %7
%12 = getelementptr inbounds i8*, i8** %11, i64 0
%13 = load i8*, i8** %12
%14 = icmp eq i8* %13, null
br i1 %14, label %15, label %18
15: ; preds = %4
%16 = load i8**, i8*** %7
%17 = getelementptr inbounds i8*, i8** %16, i64 0
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %17
br label %18
18: ; preds = %15, %4
%19 = load i8*, i8** %5
%20 = bitcast i8* %19 to i32*
%21 = load i32, i32* %20
%22 = icmp eq i32 %21, 101
br i1 %22, label %23, label %55
23: ; preds = %18
store i64 0, i64* @errno
%24 = load i8**, i8*** %7
%25 = getelementptr inbounds i8*, i8** %24, i64 0
%26 = load i8*, i8** %25
%27 = call i32 @strtol(i8* %26, i32* null, i32 10)
%28 = load i8*, i8** %5
%29 = bitcast i8* %28 to i32*
store i32 %27, i32* %29
%30 = load i8*, i8** %5
%31 = bitcast i8* %30 to i32*
%32 = load i32, i32* %31
%33 = icmp slt i32 %32, 0
br i1 %33, label %34, label %39
34: ; preds = %23
%35 = load i8*, i8** %5
%36 = bitcast i8* %35 to i32*
%37 = load i32, i32* %36
%38 = mul nsw i32 %37, -1
store i32 %38, i32* %36
br label %39
39: ; preds = %34, %23
%40 = load i8*, i8** %5
%41 = bitcast i8* %40 to i32*
%42 = load i32, i32* %41
%43 = icmp eq i32 %42, 0
br i1 %43, label %44, label %47
44: ; preds = %39
%45 = load i8*, i8** %5
%46 = bitcast i8* %45 to i32*
store i32 1, i32* %46
br label %47
47: ; preds = %44, %39
%48 = load i64, i64* @errno
%49 = icmp ne i64 %48, 0
br i1 %49, label %50, label %54
50: ; preds = %47
%51 = load i32, i32* @stderr
%52 = call i32 @fputs(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %51)
%53 = call i32 @exit(i32 -1)
unreachable
54: ; preds = %47
br label %60
55: ; preds = %18
%56 = load i8**, i8*** %7
%57 = getelementptr inbounds i8*, i8** %56, i64 0
%58 = load i8*, i8** %57
%59 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %58)
br label %60
60: ; preds = %55, %54
ret i32 0
}

LLVM IR (-O2):
@.str = [2 x i8] c"0\00"
@errno = global i64 0
@.str.1 = [13 x i8] c"Fatal error.\00"
@stderr = global i32 0
@.str.2 = [4 x i8] c"%s\0A\00"
define i32 @print_results(i8* nocapture %0, i32 %1, i8** nocapture %2, i8** nocapture readnone %3) {
%5 = load i8*, i8** %2
%6 = icmp eq i8* %5, null
br i1 %6, label %7, label %8
7: ; preds = %4
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %2
br label %8
8: ; preds = %7, %4
%9 = phi i8* [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), %7 ], [ %5, %4 ]
%10 = bitcast i8* %0 to i32*
%11 = load i32, i32* %10
%12 = icmp eq i32 %11, 101
br i1 %12, label %13, label %24
13: ; preds = %8
store i64 0, i64* @errno
%14 = tail call i32 @strtol(i8* nocapture %9, i32* null, i32 10)
%15 = tail call i32 @llvm.abs.i32(i32 %14, i1 true)
%16 = icmp eq i32 %14, 0
%17 = select i1 %16, i32 1, i32 %15
store i32 %17, i32* %10
%18 = load i64, i64* @errno
%19 = icmp eq i64 %18, 0
br i1 %19, label %26, label %20
20: ; preds = %13
%21 = load i32, i32* @stderr
%22 = tail call i32 @fputs(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i32 %21)
%23 = tail call i32 @exit(i32 -1)
unreachable
24: ; preds = %8
%25 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i8* %9)
br label %26
26: ; preds = %13, %24
ret i32 0
}