#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*/ abort();
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *, char, char *, char *, char *);
int /*<<< orphan*/ stderr;
char *strchr(char *, char);
int strtol(char *, char **, int);
int print_results(void *dummy, int field_count, char **row, char **fields) {
  char status = ' ';
  char *end;
  (void)dummy;
  (void)field_count;
  (void)fields;
  end = strchr(row[3], '\n');
  if (end) {
    *end = '\0';
  }
  if (row[0]) {
    int status_val = strtol(row[0], &end, 10);
    if (*end) {
      fprintf(stderr, "Database interface error: Invalid integer!\n");
      abort();
    }
    status_val += 2;
    if (status_val < 0 || status_val > 4) {
      status = '?';
    } else {
      status = "UU ID"[status_val];
    }
  }
  printf("%c %-20s %-10s %s\n", status, row[1], row[2], row[3]);
  return 0;
}


x86 assembly (clang, -O0):
<print_results>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
movb   $0x20,-0x21(%rbp)
mov    -0x18(%rbp),%rax
mov    0x18(%rax),%rdi
mov    $0xa,%esi
call   1040 <strchr@plt>
mov    %rax,-0x30(%rbp)
cmpq   $0x0,-0x30(%rbp)
je     1193 <print_results+0x43>
mov    -0x30(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x18(%rbp),%rax
cmpq   $0x0,(%rax)
je     121e <print_results+0xce>
mov    -0x18(%rbp),%rax
mov    (%rax),%rdi
lea    -0x30(%rbp),%rsi
mov    $0xa,%edx
call   1070 <strtol@plt>
mov    %eax,-0x34(%rbp)
mov    -0x30(%rbp),%rax
cmpb   $0x0,(%rax)
je     11e2 <print_results+0x92>
mov    0x2e13(%rip),%rax
mov    (%rax),%edi
lea    0xe2a(%rip),%rsi
call   1060 <fprintf@plt>
mov    $0x0,%al
call   1030 <abort@plt>
mov    -0x34(%rbp),%eax
add    $0x2,%eax
mov    %eax,-0x34(%rbp)
cmpl   $0x0,-0x34(%rbp)
jl     11ff <print_results+0xaf>
cmpl   $0x4,-0x34(%rbp)
jle    1208 <print_results+0xb8>
movb   $0x3f,-0x21(%rbp)
jmp    1219 <print_results+0xc9>
movslq -0x34(%rbp),%rcx
lea    0xe19(%rip),%rax
mov    (%rax,%rcx,1),%al
mov    %al,-0x21(%rbp)
jmp    121e <print_results+0xce>
mov    -0x21(%rbp),%al
mov    -0x18(%rbp),%rcx
mov    0x8(%rcx),%rdx
mov    -0x18(%rbp),%rcx
mov    0x10(%rcx),%rcx
mov    -0x18(%rbp),%rsi
mov    0x18(%rsi),%r8
lea    0xdf2(%rip),%rdi
movsbl %al,%esi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_results>:
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%rbx
mov    0x18(%rdx),%rdi
mov    $0xa,%esi
call   1040 <strchr@plt>
mov    %rax,0x8(%rsp)
test   %rax,%rax
je     1173 <print_results+0x23>
movb   $0x0,(%rax)
mov    (%rbx),%rdi
test   %rdi,%rdi
je     11af <print_results+0x5f>
lea    0x8(%rsp),%rsi
mov    $0xa,%edx
call   1070 <strtol@plt>
mov    0x8(%rsp),%rcx
cmpb   $0x0,(%rcx)
jne    11d6 <print_results+0x86>
lea    -0x3(%rax),%ecx
mov    $0x3f,%sil
cmp    $0xfffffffb,%ecx
jb     11b2 <print_results+0x62>
add    $0x2,%eax
lea    0xe83(%rip),%rcx
mov    (%rax,%rcx,1),%sil
jmp    11b2 <print_results+0x62>
mov    $0x20,%sil
mov    0x8(%rbx),%rdx
mov    0x10(%rbx),%rcx
mov    0x18(%rbx),%r8
movsbl %sil,%esi
lea    0xe69(%rip),%rdi
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret
mov    0x2e03(%rip),%rax
mov    (%rax),%edi
lea    0xe1a(%rip),%rsi
call   1060 <fprintf@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [44 x i8] c"Database interface error: Invalid integer!\0A\00"
@.str.1 = [6 x i8] c"UU ID\00"
@.str.2 = [19 x i8] c"%c %-20s %-10s %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**
%9 = alloca i8
%10 = alloca i8*
%11 = alloca i32
store i8* %0, i8** %5
store i32 %1, i32* %6
store i8** %2, i8*** %7
store i8** %3, i8*** %8
store i8 32, i8* %9
%12 = load i8*, i8** %5
%13 = load i32, i32* %6
%14 = load i8**, i8*** %8
%15 = load i8**, i8*** %7
%16 = getelementptr inbounds i8*, i8** %15, i64 3
%17 = load i8*, i8** %16
%18 = call i8* @strchr(i8* %17, i8 signext 10)
store i8* %18, i8** %10
%19 = load i8*, i8** %10
%20 = icmp ne i8* %19, null
br i1 %20, label %21, label %23
21: ; preds = %4
%22 = load i8*, i8** %10
store i8 0, i8* %22
br label %23
23: ; preds = %21, %4
%24 = load i8**, i8*** %7
%25 = getelementptr inbounds i8*, i8** %24, i64 0
%26 = load i8*, i8** %25
%27 = icmp ne i8* %26, null
br i1 %27, label %28, label %55
28: ; preds = %23
%29 = load i8**, i8*** %7
%30 = getelementptr inbounds i8*, i8** %29, i64 0
%31 = load i8*, i8** %30
%32 = call i32 @strtol(i8* %31, i8** %10, i32 10)
store i32 %32, i32* %11
%33 = load i8*, i8** %10
%34 = load i8, i8* %33
%35 = icmp ne i8 %34, 0
br i1 %35, label %36, label %40
36: ; preds = %28
%37 = load i32, i32* @stderr
%38 = call i32 @fprintf(i32 %37, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%39 = call i32 (...) @abort()
unreachable
40: ; preds = %28
%41 = load i32, i32* %11
%42 = add nsw i32 %41, 2
store i32 %42, i32* %11
%43 = load i32, i32* %11
%44 = icmp slt i32 %43, 0
br i1 %44, label %48, label %45
45: ; preds = %40
%46 = load i32, i32* %11
%47 = icmp sgt i32 %46, 4
br i1 %47, label %48, label %49
48: ; preds = %45, %40
store i8 63, i8* %9
br label %54
49: ; preds = %45
%50 = load i32, i32* %11
%51 = sext i32 %50 to i64
%52 = getelementptr inbounds [6 x i8], [6 x i8]* @.str.1, i64 0, i64 %51
%53 = load i8, i8* %52
store i8 %53, i8* %9
br label %54
54: ; preds = %49, %48
br label %55
55: ; preds = %54, %23
%56 = load i8, i8* %9
%57 = load i8**, i8*** %7
%58 = getelementptr inbounds i8*, i8** %57, i64 1
%59 = load i8*, i8** %58
%60 = load i8**, i8*** %7
%61 = getelementptr inbounds i8*, i8** %60, i64 2
%62 = load i8*, i8** %61
%63 = load i8**, i8*** %7
%64 = getelementptr inbounds i8*, i8** %63, i64 3
%65 = load i8*, i8** %64
%66 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8 signext %56, i8* %59, i8* %62, i8* %65)
ret i32 0
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [44 x i8] c"Database interface error: Invalid integer!\0A\00"
@.str.1 = [6 x i8] c"UU ID\00"
@.str.2 = [19 x i8] c"%c %-20s %-10s %s\0A\00"
define i32 @print_results(i8* nocapture readnone %0, i32 %1, i8** nocapture %2, i8** nocapture readnone %3) {
%5 = alloca i8*
%6 = bitcast i8** %5 to i8*
%7 = getelementptr inbounds i8*, i8** %2, i64 3
%8 = load i8*, i8** %7
%9 = tail call i8* @strchr(i8* dereferenceable(1) %8, i8 signext 10)
store i8* %9, i8** %5
%10 = icmp eq i8* %9, null
br i1 %10, label %12, label %11
11: ; preds = %4
store i8 0, i8* %9
br label %12
12: ; preds = %11, %4
%13 = load i8*, i8** %2
%14 = icmp eq i8* %13, null
br i1 %14, label %32, label %15
15: ; preds = %12
%16 = call i32 @strtol(i8* %13, i8** %5, i32 10)
%17 = load i8*, i8** %5
%18 = load i8, i8* %17
%19 = icmp eq i8 %18, 0
br i1 %19, label %24, label %20
20: ; preds = %15
%21 = load i32, i32* @stderr
%22 = tail call i32 @fprintf(i32 %21, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%23 = tail call i32 (...) @abort()
unreachable
24: ; preds = %15
%25 = add i32 %16, -3
%26 = icmp ult i32 %25, -5
br i1 %26, label %32, label %27
27: ; preds = %24
%28 = add nsw i32 %16, 2
%29 = zext i32 %28 to i64
%30 = getelementptr inbounds [6 x i8], [6 x i8]* @.str.1, i64 0, i64 %29
%31 = load i8, i8* %30
br label %32
32: ; preds = %27, %24, %12
%33 = phi i8 [ 32, %12 ], [ %31, %27 ], [ 63, %24 ]
%34 = getelementptr inbounds i8*, i8** %2, i64 1
%35 = load i8*, i8** %34
%36 = getelementptr inbounds i8*, i8** %2, i64 2
%37 = load i8*, i8** %36
%38 = load i8*, i8** %7
%39 = tail call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.2, i64 0, i64 0), i8 signext %33, i8* %35, i8* %37, i8* %38)
ret i32 0
}