#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 ft_strlen(char *);
void ft_len_n(int *j, int *i, char *base_to, int n) {
  while (n / *j > ft_strlen(base_to) - 1) {
    *j *= ft_strlen(base_to);
    (*i)++;
  }
}


x86 assembly (clang, -O0):
<ft_len_n>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
mov    -0x8(%rbp),%rcx
cltd
idivl  (%rcx)
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <ft_strlen@plt>
mov    %eax,%ecx
mov    -0x20(%rbp),%eax
sub    $0x1,%ecx
cmp    %ecx,%eax
jle    1171 <ft_len_n+0x61>
mov    -0x18(%rbp),%rdi
call   1030 <ft_strlen@plt>
mov    %eax,%ecx
mov    -0x8(%rbp),%rax
imul   (%rax),%ecx
mov    %ecx,(%rax)
mov    -0x10(%rbp),%rax
mov    (%rax),%ecx
add    $0x1,%ecx
mov    %ecx,(%rax)
jmp    1127 <ft_len_n+0x17>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ft_len_n>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %ecx,%r15d
mov    %rdx,%r13
mov    %rsi,%r14
mov    %rdi,%rbp
mov    %ecx,%eax
cltd
idivl  (%rdi)
mov    %eax,%r12d
mov    %r13,%rdi
call   1030 <ft_strlen@plt>
cmp    %eax,%r12d
jl     1168 <ft_len_n+0x58>
nopl   0x0(%rax)
mov    %r13,%rdi
call   1030 <ft_strlen@plt>
imul   0x0(%rbp),%eax
mov    %eax,0x0(%rbp)
addl   $0x1,(%r14)
mov    %r15d,%eax
cltd
idivl  0x0(%rbp)
mov    %eax,%ebx
mov    %r13,%rdi
call   1030 <ft_strlen@plt>
cmp    %eax,%ebx
jge    1140 <ft_len_n+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @ft_len_n(i32* %0, i32* %1, i8* %2, i32 %3) {
%5 = alloca i32*
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i32
store i32* %0, i32** %5
store i32* %1, i32** %6
store i8* %2, i8** %7
store i32 %3, i32* %8
br label %9
9: ; preds = %18, %4
%10 = load i32, i32* %8
%11 = load i32*, i32** %5
%12 = load i32, i32* %11
%13 = sdiv i32 %10, %12
%14 = load i8*, i8** %7
%15 = call i32 @ft_strlen(i8* %14)
%16 = sub nsw i32 %15, 1
%17 = icmp sgt i32 %13, %16
br i1 %17, label %18, label %27
18: ; preds = %9
%19 = load i8*, i8** %7
%20 = call i32 @ft_strlen(i8* %19)
%21 = load i32*, i32** %5
%22 = load i32, i32* %21
%23 = mul nsw i32 %22, %20
store i32 %23, i32* %21
%24 = load i32*, i32** %6
%25 = load i32, i32* %24
%26 = add nsw i32 %25, 1
store i32 %26, i32* %24
br label %9
27: ; preds = %9
ret void
}

LLVM IR (-O2):
define void @ft_len_n(i32* nocapture %0, i32* nocapture %1, i8* %2, i32 %3) {
%5 = load i32, i32* %0
%6 = sdiv i32 %3, %5
%7 = tail call i32 @ft_strlen(i8* %2)
%8 = icmp slt i32 %6, %7
br i1 %8, label %19, label %9
9: ; preds = %4, %9
%10 = tail call i32 @ft_strlen(i8* %2)
%11 = load i32, i32* %0
%12 = mul nsw i32 %11, %10
store i32 %12, i32* %0
%13 = load i32, i32* %1
%14 = add nsw i32 %13, 1
store i32 %14, i32* %1
%15 = load i32, i32* %0
%16 = sdiv i32 %3, %15
%17 = tail call i32 @ft_strlen(i8* %2)
%18 = icmp slt i32 %16, %17
br i1 %18, label %19, label %9
19: ; preds = %9, %4
ret void
}