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

/* Variables and functions */
int EXIT_SUCCESS;
int div16(int const);
int /*<<< orphan*/ printf(char *, int const, int, int);
int main(void) {
  const int numbers[] = {165,  -165, 48, -48, 32,  -32, 197,
                         -197, 1,    -1, 0,   234, -234};
  const int elem_of_numbers = sizeof(numbers) / sizeof(numbers[0]);
  for (int i = 0; i < elem_of_numbers; i++)
    printf("%5d / %2d = %3d\n", numbers[i], 16, div16(numbers[i]));
  return (EXIT_SUCCESS);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x40(%rbp),%rdi
lea    0xeb6(%rip),%rsi
mov    $0x34,%edx
call   1040 <memcpy@plt>
movl   $0xd,-0x44(%rbp)
movl   $0x0,-0x48(%rbp)
cmpl   $0xd,-0x48(%rbp)
jge    11a8 <main+0x78>
movslq -0x48(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%eax
mov    %eax,-0x4c(%rbp)
movslq -0x48(%rbp),%rax
mov    -0x40(%rbp,%rax,4),%edi
call   1050 <div16@plt>
mov    -0x4c(%rbp),%esi
mov    %eax,%ecx
lea    0xea4(%rip),%rdi
mov    $0x10,%edx
call   1030 <printf@plt>
mov    -0x48(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x48(%rbp)
jmp    1162 <main+0x32>
mov    0x2e31(%rip),%rax
mov    (%rax),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    $0xa5,%edi
call   1040 <div16@plt>
lea    0xece(%rip),%rbx
mov    %rbx,%rdi
mov    $0xa5,%esi
mov    $0x10,%edx
mov    %eax,%ecx
call   1030 <printf@plt>
mov    $0xffffff5b,%edi
call   1040 <div16@plt>
mov    %rbx,%rdi
mov    $0xffffff5b,%esi
mov    $0x10,%edx
mov    %eax,%ecx
call   1030 <printf@plt>
mov    $0x30,%edi
call   1040 <div16@plt>
mov    %rbx,%rdi
mov    $0x30,%esi
mov    $0x10,%edx
mov    %eax,%ecx
call   1030 <printf@plt>
mov    $0xffffffd0,%edi
call   1040 <div16@plt>
mov    %rbx,%rdi
mov    $0xffffffd0,%esi
mov    $0x10,%edx
mov    %eax,%ecx
call   1030 <printf@plt>
mov    $0x20,%edi
call   1040 <div16@plt>
mov    %rbx,%rdi
mov    $0x20,%esi
mov    $0x10,%edx
mov    %eax,%ecx
call   1030 <printf@plt>
mov    $0xffffffe0,%edi
call   1040 <div16@plt>
mov    %rbx,%rdi
mov    $0xffffffe0,%esi
mov    $0x10,%edx
mov    %eax,%ecx
call   1030 <printf@plt>
mov    $0xc5,%edi
call   1040 <div16@plt>
mov    %rbx,%rdi
mov    $0xc5,%esi
mov    $0x10,%edx
mov    %eax,%ecx
call   1030 <printf@plt>
mov    $0xffffff3b,%edi
call   1040 <div16@plt>
mov    %rbx,%rdi
mov    $0xffffff3b,%esi
mov    $0x10,%edx
mov    %eax,%ecx
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <div16@plt>
mov    %rbx,%rdi
mov    $0x1,%esi
mov    $0x10,%edx
mov    %eax,%ecx
call   1030 <printf@plt>
mov    $0xffffffff,%edi
call   1040 <div16@plt>
mov    %rbx,%rdi
mov    $0xffffffff,%esi
mov    $0x10,%edx
mov    %eax,%ecx
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <div16@plt>
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x10,%edx
mov    %eax,%ecx
call   1030 <printf@plt>
mov    $0xea,%edi
call   1040 <div16@plt>
mov    %rbx,%rdi
mov    $0xea,%esi
mov    $0x10,%edx
mov    %eax,%ecx
call   1030 <printf@plt>
mov    $0xffffff16,%edi
call   1040 <div16@plt>
mov    %rbx,%rdi
mov    $0xffffff16,%esi
mov    $0x10,%edx
mov    %eax,%ecx
call   1030 <printf@plt>
mov    0x2d31(%rip),%rax
mov    (%rax),%eax
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.numbers = [13 x i32] [i32 165, i32 -165, i32 48, i32 -48, i32 32, i32 -32, i32 197, i32 -197, i32 1, i32 -1, i32 0, i32 234, i32 -234]
@.str = [17 x i8] c"%5d / %2d = %3d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [13 x i32]
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = bitcast [13 x i32]* %2 to i8*
store i32 13, i32* %3
store i32 0, i32* %4
br label %6
6: ; preds = %20, %0
%7 = load i32, i32* %4
%8 = icmp slt i32 %7, 13
br i1 %8, label %9, label %23
9: ; preds = %6
%10 = load i32, i32* %4
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds [13 x i32], [13 x i32]* %2, i64 0, i64 %11
%13 = load i32, i32* %12
%14 = load i32, i32* %4
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds [13 x i32], [13 x i32]* %2, i64 0, i64 %15
%17 = load i32, i32* %16
%18 = call i32 @div16(i32 %17)
%19 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %13, i32 16, i32 %18)
br label %20
20: ; preds = %9
%21 = load i32, i32* %4
%22 = add nsw i32 %21, 1
store i32 %22, i32* %4
br label %6
23: ; preds = %6
%24 = load i32, i32* @EXIT_SUCCESS
ret i32 %24
}

LLVM IR (-O2):
@.str = [17 x i8] c"%5d / %2d = %3d\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = tail call i32 @div16(i32 165)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 165, i32 16, i32 %1)
%3 = tail call i32 @div16(i32 -165)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 -165, i32 16, i32 %3)
%5 = tail call i32 @div16(i32 48)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 48, i32 16, i32 %5)
%7 = tail call i32 @div16(i32 -48)
%8 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 -48, i32 16, i32 %7)
%9 = tail call i32 @div16(i32 32)
%10 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 32, i32 16, i32 %9)
%11 = tail call i32 @div16(i32 -32)
%12 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 -32, i32 16, i32 %11)
%13 = tail call i32 @div16(i32 197)
%14 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 197, i32 16, i32 %13)
%15 = tail call i32 @div16(i32 -197)
%16 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 -197, i32 16, i32 %15)
%17 = tail call i32 @div16(i32 1)
%18 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 1, i32 16, i32 %17)
%19 = tail call i32 @div16(i32 -1)
%20 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 -1, i32 16, i32 %19)
%21 = tail call i32 @div16(i32 0)
%22 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 0, i32 16, i32 %21)
%23 = tail call i32 @div16(i32 234)
%24 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 234, i32 16, i32 %23)
%25 = tail call i32 @div16(i32 -234)
%26 = tail call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 -234, i32 16, i32 %25)
%27 = load i32, i32* @EXIT_SUCCESS
ret i32 %27
}