#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*/ mach_alphanum(int, unsigned int);
void print_seg(char *file, int line) {
  int i;
  unsigned int nibble;
  for (i = 0; i < 5; i++) {
    mach_alphanum(i, file[i]);
  }
  for (i = 0; i < 3; i++) {
    nibble = ((line >> (i * 4)) & 0xf);
    mach_alphanum(7 - i, nibble + ((nibble > 9) ? 55 : 48));
  }
}


x86 assembly (clang, -O0):
<print_seg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
cmpl   $0x5,-0x10(%rbp)
jge    1152 <print_seg+0x42>
mov    -0x10(%rbp),%edi
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
movsbl (%rax,%rcx,1),%esi
call   1030 <mach_alphanum@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <print_seg+0x16>
movl   $0x0,-0x10(%rbp)
cmpl   $0x3,-0x10(%rbp)
jge    11a7 <print_seg+0x97>
mov    -0xc(%rbp),%eax
mov    -0x10(%rbp),%ecx
shl    $0x2,%ecx
sar    %cl,%eax
and    $0xf,%eax
mov    %eax,-0x14(%rbp)
mov    $0x7,%edi
sub    -0x10(%rbp),%edi
mov    -0x14(%rbp),%esi
mov    -0x14(%rbp),%edx
mov    $0x30,%eax
mov    $0x37,%ecx
cmp    $0x9,%edx
cmova  %ecx,%eax
add    %eax,%esi
call   1030 <mach_alphanum@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1159 <print_seg+0x49>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_seg>:
push   %r14
push   %rbx
push   %rax
mov    %esi,%r14d
mov    %rdi,%rbx
movsbl (%rdi),%esi
xor    %edi,%edi
call   1030 <mach_alphanum@plt>
movsbl 0x1(%rbx),%esi
mov    $0x1,%edi
call   1030 <mach_alphanum@plt>
movsbl 0x2(%rbx),%esi
mov    $0x2,%edi
call   1030 <mach_alphanum@plt>
movsbl 0x3(%rbx),%esi
mov    $0x3,%edi
call   1030 <mach_alphanum@plt>
movsbl 0x4(%rbx),%esi
mov    $0x4,%edi
call   1030 <mach_alphanum@plt>
mov    %r14d,%eax
and    $0xf,%eax
lea    0x30(%rax),%ecx
lea    0x37(%rax),%esi
cmp    $0xa,%eax
cmovb  %ecx,%esi
mov    $0x7,%edi
call   1030 <mach_alphanum@plt>
mov    %r14d,%eax
shr    $0x4,%eax
and    $0xf,%eax
lea    0x30(%rax),%ecx
lea    0x37(%rax),%esi
cmp    $0xa,%eax
cmovb  %ecx,%esi
mov    $0x6,%edi
call   1030 <mach_alphanum@plt>
shr    $0x8,%r14d
and    $0xf,%r14d
lea    0x30(%r14),%eax
lea    0x37(%r14),%esi
cmp    $0xa,%r14d
cmovb  %eax,%esi
mov    $0x5,%edi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <mach_alphanum@plt>

LLVM IR (-O0):
define void @print_seg(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
store i32 0, i32* %5
br label %7
7: ; preds = %19, %2
%8 = load i32, i32* %5
%9 = icmp slt i32 %8, 5
br i1 %9, label %10, label %22
10: ; preds = %7
%11 = load i32, i32* %5
%12 = load i8*, i8** %3
%13 = load i32, i32* %5
%14 = sext i32 %13 to i64
%15 = getelementptr inbounds i8, i8* %12, i64 %14
%16 = load i8, i8* %15
%17 = sext i8 %16 to i32
%18 = call i32 @mach_alphanum(i32 %11, i32 %17)
br label %19
19: ; preds = %10
%20 = load i32, i32* %5
%21 = add nsw i32 %20, 1
store i32 %21, i32* %5
br label %7
22: ; preds = %7
store i32 0, i32* %5
br label %23
23: ; preds = %41, %22
%24 = load i32, i32* %5
%25 = icmp slt i32 %24, 3
br i1 %25, label %26, label %44
26: ; preds = %23
%27 = load i32, i32* %4
%28 = load i32, i32* %5
%29 = mul nsw i32 %28, 4
%30 = ashr i32 %27, %29
%31 = and i32 %30, 15
store i32 %31, i32* %6
%32 = load i32, i32* %5
%33 = sub nsw i32 7, %32
%34 = load i32, i32* %6
%35 = load i32, i32* %6
%36 = icmp ugt i32 %35, 9
%37 = zext i1 %36 to i64
%38 = select i1 %36, i32 55, i32 48
%39 = add i32 %34, %38
%40 = call i32 @mach_alphanum(i32 %33, i32 %39)
br label %41
41: ; preds = %26
%42 = load i32, i32* %5
%43 = add nsw i32 %42, 1
store i32 %43, i32* %5
br label %23
44: ; preds = %23
ret void
}

LLVM IR (-O2):
define void @print_seg(i8* nocapture %0, i32 %1) {
%3 = load i8, i8* %0
%4 = sext i8 %3 to i32
%5 = tail call i32 @mach_alphanum(i32 0, i32 %4)
%6 = getelementptr inbounds i8, i8* %0, i64 1
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = tail call i32 @mach_alphanum(i32 1, i32 %8)
%10 = getelementptr inbounds i8, i8* %0, i64 2
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = tail call i32 @mach_alphanum(i32 2, i32 %12)
%14 = getelementptr inbounds i8, i8* %0, i64 3
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = tail call i32 @mach_alphanum(i32 3, i32 %16)
%18 = getelementptr inbounds i8, i8* %0, i64 4
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = tail call i32 @mach_alphanum(i32 4, i32 %20)
%22 = and i32 %1, 15
%23 = icmp ugt i32 %22, 9
%24 = select i1 %23, i32 55, i32 48
%25 = add nuw nsw i32 %24, %22
%26 = tail call i32 @mach_alphanum(i32 7, i32 %25)
%27 = lshr i32 %1, 4
%28 = and i32 %27, 15
%29 = icmp ugt i32 %28, 9
%30 = select i1 %29, i32 55, i32 48
%31 = add nuw nsw i32 %30, %28
%32 = tail call i32 @mach_alphanum(i32 6, i32 %31)
%33 = lshr i32 %1, 8
%34 = and i32 %33, 15
%35 = icmp ugt i32 %34, 9
%36 = select i1 %35, i32 55, i32 48
%37 = add nuw nsw i32 %36, %34
%38 = tail call i32 @mach_alphanum(i32 5, i32 %37)
ret void
}