#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 */
scalar_t__ pow(int, int);
int /*<<< orphan*/ printf(char *, int);
void BinFormat(char character, char *text) {
  text[8] = '\0';
  for (int i = 7; i >= 0; i--) {
    int divisor = (int)pow(2, i);
    printf("[%d, ", divisor);
    int cabe = character / divisor;
    printf("%d, ", cabe);
    int impar = (cabe % 2 != 0);
    printf("%d] ", impar);
    text[i] = impar + '0';
  }
}


x86 assembly (clang, -O0):
<BinFormat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movb   $0x0,0x8(%rax)
movl   $0x7,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
jl     11cd <BinFormat+0xad>
mov    -0x14(%rbp),%esi
mov    $0x2,%edi
call   1040 <pow@plt>
mov    %eax,-0x18(%rbp)
mov    -0x18(%rbp),%esi
lea    0xe9b(%rip),%rdi
call   1030 <printf@plt>
movsbl -0x1(%rbp),%eax
cltd
idivl  -0x18(%rbp)
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%esi
lea    0xe82(%rip),%rdi
call   1030 <printf@plt>
mov    -0x1c(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
setne  %al
and    $0x1,%al
movzbl %al,%eax
mov    %eax,-0x20(%rbp)
mov    -0x20(%rbp),%esi
lea    0xe5f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x20(%rbp),%eax
add    $0x30,%eax
mov    %al,%dl
mov    -0x10(%rbp),%rax
movslq -0x14(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    -0x14(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x14(%rbp)
jmp    1141 <BinFormat+0x21>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<BinFormat>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rsi,%r12
mov    %edi,%r14d
movb   $0x0,0x8(%rsi)
mov    $0x7,%ebp
lea    0xec5(%rip),%r13
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    $0x2,%edi
mov    %ebp,%esi
call   1040 <pow@plt>
mov    %rax,%r15
lea    0xe9a(%rip),%rdi
mov    %r15d,%esi
call   1030 <printf@plt>
mov    %r14d,%eax
cltd
idiv   %r15d
mov    %eax,%ebx
lea    0xe83(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
and    $0x1,%ebx
mov    %r13,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
or     $0x30,%bl
mov    %bl,(%r12,%rbp,1)
add    $0xffffffffffffffff,%rbp
jb     1150 <BinFormat+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [6 x i8] c"[%d, \00"
@.str.1 = [5 x i8] c"%d, \00"
@.str.2 = [5 x i8] c"%d] \00"
define void @BinFormat(i8 signext %0, i8* %1) {
%3 = alloca i8
%4 = alloca i8*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
store i8 %0, i8* %3
store i8* %1, i8** %4
%9 = load i8*, i8** %4
%10 = getelementptr inbounds i8, i8* %9, i64 8
store i8 0, i8* %10
store i32 7, i32* %5
br label %11
11: ; preds = %39, %2
%12 = load i32, i32* %5
%13 = icmp sge i32 %12, 0
br i1 %13, label %14, label %42
14: ; preds = %11
%15 = load i32, i32* %5
%16 = call i64 @pow(i32 2, i32 %15)
%17 = trunc i64 %16 to i32
store i32 %17, i32* %6
%18 = load i32, i32* %6
%19 = call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %18)
%20 = load i8, i8* %3
%21 = sext i8 %20 to i32
%22 = load i32, i32* %6
%23 = sdiv i32 %21, %22
store i32 %23, i32* %7
%24 = load i32, i32* %7
%25 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %24)
%26 = load i32, i32* %7
%27 = srem i32 %26, 2
%28 = icmp ne i32 %27, 0
%29 = zext i1 %28 to i32
store i32 %29, i32* %8
%30 = load i32, i32* %8
%31 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %30)
%32 = load i32, i32* %8
%33 = add nsw i32 %32, 48
%34 = trunc i32 %33 to i8
%35 = load i8*, i8** %4
%36 = load i32, i32* %5
%37 = sext i32 %36 to i64
%38 = getelementptr inbounds i8, i8* %35, i64 %37
store i8 %34, i8* %38
br label %39
39: ; preds = %14
%40 = load i32, i32* %5
%41 = add nsw i32 %40, -1
store i32 %41, i32* %5
br label %11
42: ; preds = %11
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"[%d, \00"
@.str.1 = [5 x i8] c"%d, \00"
@.str.2 = [5 x i8] c"%d] \00"
define void @BinFormat(i8 signext %0, i8* nocapture writeonly %1) {
%3 = getelementptr inbounds i8, i8* %1, i64 8
store i8 0, i8* %3
%4 = sext i8 %0 to i32
br label %6
5: ; preds = %6
ret void
6: ; preds = %2, %6
%7 = phi i64 [ 7, %2 ], [ %19, %6 ]
%8 = trunc i64 %7 to i32
%9 = tail call i64 @pow(i32 2, i32 %8)
%10 = trunc i64 %9 to i32
%11 = tail call i32 @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 %10)
%12 = sdiv i32 %4, %10
%13 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32 %12)
%14 = and i32 %12, 1
%15 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0), i32 %14)
%16 = trunc i32 %14 to i8
%17 = or i8 %16, 48
%18 = getelementptr inbounds i8, i8* %1, i64 %7
store i8 %17, i8* %18
%19 = add nsw i64 %7, -1
%20 = icmp eq i64 %7, 0
br i1 %20, label %5, label %6
}