#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 /*<<< orphan*/ newval;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, char *, char *, char *, char *);
int /*<<< orphan*/ snprintf(char *, int, char *, long);
int /*<<< orphan*/ strtod(char *, char **);
long strtol(char *, char **, long);
void print_line(char *name, char *name2, char *val) {
  char *typename = NULL, *endptr, newval[128];
  (void)strtod(val, &endptr);
  if (*endptr == '\0')
    typename = "n";
  if (NULL == typename) {
    long foo, base = 10;
    if (val[0] == '0' && (val[1] == 'x' || val[1] == 'X')) {
      val += 2;
      base = 16;
    } else if (val[0] == '0') {
      base = 8;
    }
    foo = strtol(val, &endptr, base);
    if (*endptr == '\0') {
      typename = "l";
      snprintf(newval, sizeof(newval), "%ld", foo);
      val = newval;
    }
  }
  if (NULL == typename)
    typename = "s";
  printf("%s:%s\t%s\t%s\n", name, name2, typename, val);
}


x86 assembly (clang, -O0):
<print_line>:
push   %rbp
mov    %rsp,%rbp
sub    $0xc0,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movq   $0x0,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
lea    -0x28(%rbp),%rsi
call   1030 <strtod@plt>
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    1187 <print_line+0x47>
lea    0xe7d(%rip),%rax
mov    %rax,-0x20(%rbp)
xor    %eax,%eax
cmp    -0x20(%rbp),%rax
jne    1271 <print_line+0x131>
movq   $0xa,-0xc0(%rbp)
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jne    11ec <print_line+0xac>
mov    -0x18(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x78,%eax
je     11d0 <print_line+0x90>
mov    -0x18(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x58,%eax
jne    11ec <print_line+0xac>
mov    -0x18(%rbp),%rax
add    $0x2,%rax
mov    %rax,-0x18(%rbp)
movq   $0x10,-0xc0(%rbp)
jmp    120c <print_line+0xcc>
mov    -0x18(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x30,%eax
jne    1207 <print_line+0xc7>
movq   $0x8,-0xc0(%rbp)
jmp    120c <print_line+0xcc>
mov    -0x18(%rbp),%rdi
mov    -0xc0(%rbp),%rdx
lea    -0x28(%rbp),%rsi
call   1060 <strtol@plt>
mov    %rax,-0xb8(%rbp)
mov    -0x28(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    126c <print_line+0x12c>
lea    0xdc4(%rip),%rax
mov    %rax,-0x20(%rbp)
lea    -0xb0(%rbp),%rdi
mov    -0xb8(%rbp),%rcx
mov    $0x80,%esi
lea    0xda8(%rip),%rdx
call   1050 <snprintf@plt>
lea    -0xb0(%rbp),%rax
mov    %rax,-0x18(%rbp)
jmp    1271 <print_line+0x131>
xor    %eax,%eax
cmp    -0x20(%rbp),%rax
jne    1288 <print_line+0x148>
lea    0xd84(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rsi
mov    -0x10(%rbp),%rdx
mov    -0x20(%rbp),%rcx
mov    -0x18(%rbp),%r8
lea    0xd6b(%rip),%rdi
call   1040 <printf@plt>
add    $0xc0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_line>:
push   %r15
push   %r14
push   %rbx
sub    $0x90,%rsp
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
lea    0x8(%rsp),%rsi
mov    %rdx,%rdi
call   1030 <strtod@plt>
mov    0x8(%rsp),%rax
cmpb   $0x0,(%rax)
je     118a <print_line+0x4a>
mov    $0xa,%edx
cmpb   $0x30,(%rbx)
jne    1198 <print_line+0x58>
mov    0x1(%rbx),%al
or     $0x20,%al
cmp    $0x78,%al
jne    1193 <print_line+0x53>
add    $0x2,%rbx
mov    $0x10,%edx
jmp    1198 <print_line+0x58>
lea    0xe6f(%rip),%rcx
jmp    11db <print_line+0x9b>
mov    $0x8,%edx
lea    0x8(%rsp),%rsi
mov    %rbx,%rdi
call   1060 <strtol@plt>
mov    0x8(%rsp),%rcx
cmpb   $0x0,(%rcx)
je     11b8 <print_line+0x78>
lea    0xe52(%rip),%rcx
jmp    11db <print_line+0x9b>
lea    0x10(%rsp),%rbx
lea    0xe40(%rip),%rdx
mov    %rbx,%rdi
mov    $0x80,%esi
mov    %rax,%rcx
call   1050 <snprintf@plt>
lea    0xe27(%rip),%rcx
lea    0xe28(%rip),%rdi
mov    %r15,%rsi
mov    %r14,%rdx
mov    %rbx,%r8
call   1040 <printf@plt>
add    $0x90,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c"n\00"
@.str.1 = [2 x i8] c"l\00"
@.str.2 = [4 x i8] c"%ld\00"
@.str.3 = [2 x i8] c"s\00"
@.str.4 = [13 x i8] c"%s:%s\09%s\09%s\0A\00"
define void @print_line(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i8*
%8 = alloca i8*
%9 = alloca [128 x i8]
%10 = alloca i64
%11 = alloca i64
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
store i8* null, i8** %7
%12 = load i8*, i8** %6
%13 = call i32 @strtod(i8* %12, i8** %8)
%14 = load i8*, i8** %8
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 0
br i1 %17, label %18, label %19
18: ; preds = %3
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), i8** %7
br label %19
19: ; preds = %18, %3
%20 = load i8*, i8** %7
%21 = icmp eq i8* null, %20
br i1 %21, label %22, label %65
22: ; preds = %19
store i64 10, i64* %11
%23 = load i8*, i8** %6
%24 = getelementptr inbounds i8, i8* %23, i64 0
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 48
br i1 %27, label %28, label %43
28: ; preds = %22
%29 = load i8*, i8** %6
%30 = getelementptr inbounds i8, i8* %29, i64 1
%31 = load i8, i8* %30
%32 = sext i8 %31 to i32
%33 = icmp eq i32 %32, 120
br i1 %33, label %40, label %34
34: ; preds = %28
%35 = load i8*, i8** %6
%36 = getelementptr inbounds i8, i8* %35, i64 1
%37 = load i8, i8* %36
%38 = sext i8 %37 to i32
%39 = icmp eq i32 %38, 88
br i1 %39, label %40, label %43
40: ; preds = %34, %28
%41 = load i8*, i8** %6
%42 = getelementptr inbounds i8, i8* %41, i64 2
store i8* %42, i8** %6
store i64 16, i64* %11
br label %51
43: ; preds = %34, %22
%44 = load i8*, i8** %6
%45 = getelementptr inbounds i8, i8* %44, i64 0
%46 = load i8, i8* %45
%47 = sext i8 %46 to i32
%48 = icmp eq i32 %47, 48
br i1 %48, label %49, label %50
49: ; preds = %43
store i64 8, i64* %11
br label %50
50: ; preds = %49, %43
br label %51
51: ; preds = %50, %40
%52 = load i8*, i8** %6
%53 = load i64, i64* %11
%54 = call i64 @strtol(i8* %52, i8** %8, i64 %53)
store i64 %54, i64* %10
%55 = load i8*, i8** %8
%56 = load i8, i8* %55
%57 = sext i8 %56 to i32
%58 = icmp eq i32 %57, 0
br i1 %58, label %59, label %64
59: ; preds = %51
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8** %7
%60 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%61 = load i64, i64* %10
%62 = call i32 @snprintf(i8* %60, i32 128, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i64 %61)
%63 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
store i8* %63, i8** %6
br label %64
64: ; preds = %59, %51
br label %65
65: ; preds = %64, %19
%66 = load i8*, i8** %7
%67 = icmp eq i8* null, %66
br i1 %67, label %68, label %69
68: ; preds = %65
store i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), i8** %7
br label %69
69: ; preds = %68, %65
%70 = load i8*, i8** %4
%71 = load i8*, i8** %5
%72 = load i8*, i8** %7
%73 = load i8*, i8** %6
%74 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i8* %70, i8* %71, i8* %72, i8* %73)
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"n\00"
@.str.1 = [2 x i8] c"l\00"
@.str.2 = [4 x i8] c"%ld\00"
@.str.3 = [2 x i8] c"s\00"
@.str.4 = [13 x i8] c"%s:%s\09%s\09%s\0A\00"
define void @print_line(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca [128 x i8]
%6 = bitcast i8** %4 to i8*
%7 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%8 = call i32 @strtod(i8* %2, i8** %4)
%9 = load i8*, i8** %4
%10 = load i8, i8* %9
%11 = icmp eq i8 %10, 0
br i1 %11, label %29, label %12
12: ; preds = %3
%13 = load i8, i8* %2
%14 = icmp eq i8 %13, 48
br i1 %14, label %15, label %20
15: ; preds = %12
%16 = getelementptr inbounds i8, i8* %2, i64 1
%17 = load i8, i8* %16
switch i8 %17, label %20 [
i8 120, label %18
i8 88, label %18
]
18: ; preds = %15, %15
%19 = getelementptr inbounds i8, i8* %2, i64 2
br label %20
20: ; preds = %12, %15, %18
%21 = phi i8* [ %19, %18 ], [ %2, %15 ], [ %2, %12 ]
%22 = phi i64 [ 16, %18 ], [ 8, %15 ], [ 10, %12 ]
%23 = call i64 @strtol(i8* %21, i8** %4, i64 %22)
%24 = load i8*, i8** %4
%25 = load i8, i8* %24
%26 = icmp eq i8 %25, 0
br i1 %26, label %27, label %29
27: ; preds = %20
%28 = call i32 @snprintf(i8* %7, i32 128, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.2, i64 0, i64 0), i64 %23)
br label %29
29: ; preds = %20, %27, %3
%30 = phi i8* [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0), %20 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), %27 ], [ getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0), %3 ]
%31 = phi i8* [ %21, %20 ], [ %7, %27 ], [ %2, %3 ]
%32 = call i32 @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.4, i64 0, i64 0), i8* %0, i8* %1, i8* %30, i8* %31)
ret void
}