#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 */
char div2(char *, char *);
int /*<<< orphan*/ zeroleft(char *);
void dec2bin(char *numantes, char *numdepois) {
  char tempchar[128];
  if (*numantes == '\0') {
    *numdepois = '\0';
    return;
  }
  *numdepois = div2(numantes, tempchar) + '0';
  zeroleft(tempchar);
  ++numdepois;
  dec2bin(tempchar, numdepois);
  return;
}


x86 assembly (clang, -O0):
<dec2bin>:
push   %rbp
mov    %rsp,%rbp
sub    $0x90,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x0,%eax
jne    115f <dec2bin+0x2f>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
jmp    11a5 <dec2bin+0x75>
mov    -0x8(%rbp),%rdi
lea    -0x90(%rbp),%rsi
call   1040 <div2@plt>
movsbl %al,%eax
add    $0x30,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
lea    -0x90(%rbp),%rdi
call   1030 <zeroleft@plt>
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
lea    -0x90(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1050 <dec2bin@plt>
add    $0x90,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dec2bin>:
push   %r14
push   %rbx
sub    $0x88,%rsp
mov    %rsi,%rbx
cmpb   $0x0,(%rdi)
je     116a <dec2bin+0x3a>
mov    %rsp,%r14
mov    %r14,%rsi
call   1040 <div2@plt>
add    $0x30,%al
mov    %al,(%rbx)
mov    %r14,%rdi
call   1030 <zeroleft@plt>
add    $0x1,%rbx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1050 <dec2bin@plt>
jmp    116d <dec2bin+0x3d>
movb   $0x0,(%rbx)
add    $0x88,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define void @dec2bin(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca [128 x i8]
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
%7 = load i8, i8* %6
%8 = sext i8 %7 to i32
%9 = icmp eq i32 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %2
%11 = load i8*, i8** %4
store i8 0, i8* %11
br label %26
12: ; preds = %2
%13 = load i8*, i8** %3
%14 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%15 = call signext i8 @div2(i8* %13, i8* %14)
%16 = sext i8 %15 to i32
%17 = add nsw i32 %16, 48
%18 = trunc i32 %17 to i8
%19 = load i8*, i8** %4
store i8 %18, i8* %19
%20 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%21 = call i32 @zeroleft(i8* %20)
%22 = load i8*, i8** %4
%23 = getelementptr inbounds i8, i8* %22, i32 1
store i8* %23, i8** %4
%24 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%25 = load i8*, i8** %4
br label %26
26: ; preds = %12, %10
ret void
}

LLVM IR (-O2):
define void @dec2bin(i8* %0, i8* nocapture writeonly %1) {
%3 = alloca [128 x i8]
%4 = getelementptr inbounds [128 x i8], [128 x i8]* %3, i64 0, i64 0
%5 = load i8, i8* %0
%6 = icmp eq i8 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %2
store i8 0, i8* %1
br label %13
8: ; preds = %2
%9 = call signext i8 @div2(i8* %0, i8* %4)
%10 = add i8 %9, 48
store i8 %10, i8* %1
%11 = call i32 @zeroleft(i8* %4)
%12 = getelementptr inbounds i8, i8* %1, i64 1
br label %13
13: ; preds = %8, %7
ret void
}