#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 oid_parts(char *);
int /*<<< orphan*/ oid_split(char *, int *);
void *render_byte(int, void *);
void *render_oid_part(int, void *);
void *render_oid(char *oid, void *dest) {
  int num_parts = oid_parts(oid);
  int parts[256];
  int i;
  int first_two;
  oid_split(oid, parts);
  first_two = parts[0] * 40 + parts[1];
  dest = render_byte(first_two, dest);
  for (i = 2; i < num_parts; i++)
    dest = render_oid_part(parts[i], dest);
  return dest;
}


x86 assembly (clang, -O0):
<render_oid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x430,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <oid_parts@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
lea    -0x420(%rbp),%rsi
call   1050 <oid_split@plt>
imul   $0x28,-0x420(%rbp),%eax
add    -0x41c(%rbp),%eax
mov    %eax,-0x428(%rbp)
mov    -0x428(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <render_byte@plt>
mov    %rax,-0x10(%rbp)
movl   $0x2,-0x424(%rbp)
mov    -0x424(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    11dd <render_oid+0x9d>
movslq -0x424(%rbp),%rax
mov    -0x420(%rbp,%rax,4),%edi
mov    -0x10(%rbp),%rsi
call   1060 <render_oid_part@plt>
mov    %rax,-0x10(%rbp)
mov    -0x424(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x424(%rbp)
jmp    119f <render_oid+0x5f>
mov    -0x10(%rbp),%rax
add    $0x430,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<render_oid>:
push   %rbp
push   %r14
push   %rbx
sub    $0x400,%rsp
mov    %rsi,%r14
mov    %rdi,%rbx
call   1030 <oid_parts@plt>
mov    %eax,%ebp
mov    %rsp,%rsi
mov    %rbx,%rdi
call   1050 <oid_split@plt>
mov    (%rsp),%eax
lea    (%rax,%rax,4),%edi
shl    $0x3,%edi
add    0x4(%rsp),%edi
mov    %r14,%rsi
call   1040 <render_byte@plt>
cmp    $0x3,%ebp
jl     11a4 <render_oid+0x64>
mov    %ebp,%ebx
mov    $0x2,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    (%rsp,%rbp,4),%edi
mov    %rax,%rsi
call   1060 <render_oid_part@plt>
add    $0x1,%rbp
cmp    %rbp,%rbx
jne    1190 <render_oid+0x50>
add    $0x400,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i8* @render_oid(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i32
%6 = alloca [256 x i32]
%7 = alloca i32
%8 = alloca i32
store i8* %0, i8** %3
store i8* %1, i8** %4
%9 = load i8*, i8** %3
%10 = call i32 @oid_parts(i8* %9)
store i32 %10, i32* %5
%11 = load i8*, i8** %3
%12 = getelementptr inbounds [256 x i32], [256 x i32]* %6, i64 0, i64 0
%13 = call i32 @oid_split(i8* %11, i32* %12)
%14 = getelementptr inbounds [256 x i32], [256 x i32]* %6, i64 0, i64 0
%15 = load i32, i32* %14
%16 = mul nsw i32 %15, 40
%17 = getelementptr inbounds [256 x i32], [256 x i32]* %6, i64 0, i64 1
%18 = load i32, i32* %17
%19 = add nsw i32 %16, %18
store i32 %19, i32* %8
%20 = load i32, i32* %8
%21 = load i8*, i8** %4
%22 = call i8* @render_byte(i32 %20, i8* %21)
store i8* %22, i8** %4
store i32 2, i32* %7
br label %23
23: ; preds = %34, %2
%24 = load i32, i32* %7
%25 = load i32, i32* %5
%26 = icmp slt i32 %24, %25
br i1 %26, label %27, label %37
27: ; preds = %23
%28 = load i32, i32* %7
%29 = sext i32 %28 to i64
%30 = getelementptr inbounds [256 x i32], [256 x i32]* %6, i64 0, i64 %29
%31 = load i32, i32* %30
%32 = load i8*, i8** %4
%33 = call i8* @render_oid_part(i32 %31, i8* %32)
store i8* %33, i8** %4
br label %34
34: ; preds = %27
%35 = load i32, i32* %7
%36 = add nsw i32 %35, 1
store i32 %36, i32* %7
br label %23
37: ; preds = %23
%38 = load i8*, i8** %4
ret i8* %38
}

LLVM IR (-O2):
define i8* @render_oid(i8* %0, i8* %1) {
%3 = alloca [256 x i32]
%4 = tail call i32 @oid_parts(i8* %0)
%5 = bitcast [256 x i32]* %3 to i8*
%6 = getelementptr inbounds [256 x i32], [256 x i32]* %3, i64 0, i64 0
%7 = call i32 @oid_split(i8* %0, i32* %6)
%8 = load i32, i32* %6
%9 = mul nsw i32 %8, 40
%10 = getelementptr inbounds [256 x i32], [256 x i32]* %3, i64 0, i64 1
%11 = load i32, i32* %10
%12 = add nsw i32 %9, %11
%13 = call i8* @render_byte(i32 %12, i8* %1)
%14 = icmp sgt i32 %4, 2
br i1 %14, label %15, label %25
15: ; preds = %2
%16 = zext i32 %4 to i64
br label %17
17: ; preds = %15, %17
%18 = phi i64 [ 2, %15 ], [ %23, %17 ]
%19 = phi i8* [ %13, %15 ], [ %22, %17 ]
%20 = getelementptr inbounds [256 x i32], [256 x i32]* %3, i64 0, i64 %18
%21 = load i32, i32* %20
%22 = call i8* @render_oid_part(i32 %21, i8* %19)
%23 = add nuw nsw i64 %18, 1
%24 = icmp eq i64 %23, %16
br i1 %24, label %25, label %17
25: ; preds = %17, %2
%26 = phi i8* [ %13, %2 ], [ %22, %17 ]
ret i8* %26
}