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

/* Variables and functions */
scalar_t__ EOF;
scalar_t__ escribir(int /*<<< orphan*/ *, int *, char);
int strlen(char *);
void escribir_numero(FILE *fp, int *seek, char numero[4]) {
  int i = 0;
  int largo = strlen(numero);
  while (i < largo && escribir(fp, seek, numero[i++]) != EOF)
    ;
}


x86 assembly (clang, -O0):
<escribir_numero>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%ecx
xor    %eax,%eax
cmp    -0x20(%rbp),%ecx
mov    %al,-0x21(%rbp)
jge    118b <escribir_numero+0x6b>
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rax
mov    -0x1c(%rbp),%ecx
mov    %ecx,%edx
add    $0x1,%edx
mov    %edx,-0x1c(%rbp)
movslq %ecx,%rcx
movsbl (%rax,%rcx,1),%edx
call   1040 <escribir@plt>
mov    0x2e66(%rip),%rcx
cmp    (%rcx),%rax
setne  %al
mov    %al,-0x21(%rbp)
mov    -0x21(%rbp),%al
test   $0x1,%al
jne    119b <escribir_numero+0x7b>
jmp    11a0 <escribir_numero+0x80>
jmp    1147 <escribir_numero+0x27>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<escribir_numero>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rdx,%r12
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rdx,%rdi
call   1030 <strlen@plt>
mov    %eax,%r13d
xor    %ebx,%ebx
test   %eax,%eax
cmovle %ebx,%r13d
mov    0x2e9a(%rip),%rbp
xchg   %ax,%ax
cmp    %rbx,%r13
je     116f <escribir_numero+0x4f>
movsbl (%r12,%rbx,1),%edx
add    $0x1,%rbx
mov    %r15,%rdi
mov    %r14,%rsi
call   1040 <escribir@plt>
cmp    0x0(%rbp),%rax
jne    1150 <escribir_numero+0x30>
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@EOF = global i64 0
define void @escribir_numero(i32* %0, i32* %1, i8* %2) {
%4 = alloca i32*
%5 = alloca i32*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
store i32* %0, i32** %4
store i32* %1, i32** %5
store i8* %2, i8** %6
store i32 0, i32* %7
%9 = load i8*, i8** %6
%10 = call i32 @strlen(i8* %9)
store i32 %10, i32* %8
br label %11
11: ; preds = %29, %3
%12 = load i32, i32* %7
%13 = load i32, i32* %8
%14 = icmp slt i32 %12, %13
br i1 %14, label %15, label %27
15: ; preds = %11
%16 = load i32*, i32** %4
%17 = load i32*, i32** %5
%18 = load i8*, i8** %6
%19 = load i32, i32* %7
%20 = add nsw i32 %19, 1
store i32 %20, i32* %7
%21 = sext i32 %19 to i64
%22 = getelementptr inbounds i8, i8* %18, i64 %21
%23 = load i8, i8* %22
%24 = call i64 @escribir(i32* %16, i32* %17, i8 signext %23)
%25 = load i64, i64* @EOF
%26 = icmp ne i64 %24, %25
br label %27
27: ; preds = %15, %11
%28 = phi i1 [ false, %11 ], [ %26, %15 ]
br i1 %28, label %29, label %30
29: ; preds = %27
br label %11
30: ; preds = %27
ret void
}

LLVM IR (-O2):
@EOF = global i64 0
define void @escribir_numero(i32* %0, i32* %1, i8* %2) {
%4 = tail call i32 @strlen(i8* %2)
%5 = call i32 @llvm.smax.i32(i32 %4, i32 0)
%6 = zext i32 %5 to i64
br label %7
7: ; preds = %10, %3
%8 = phi i64 [ %11, %10 ], [ 0, %3 ]
%9 = icmp eq i64 %8, %6
br i1 %9, label %17, label %10
10: ; preds = %7
%11 = add nuw nsw i64 %8, 1
%12 = getelementptr inbounds i8, i8* %2, i64 %8
%13 = load i8, i8* %12
%14 = tail call i64 @escribir(i32* %0, i32* %1, i8 signext %13)
%15 = load i64, i64* @EOF
%16 = icmp eq i64 %14, %15
br i1 %16, label %17, label %7
17: ; preds = %7, %10
ret void
}