#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 pid_t;

/* Variables and functions */
int getpid();
int /*<<< orphan*/ printf(char *, ...);
void trabajo_hijo(pid_t resultado_fork) {
  int i;
  for (i = 200000; i >= 0; i--)
    printf("\t\thijo trabajando (%d:%d), valor = %d\n", getpid(),
           resultado_fork, i);
  printf("   *** proceso hijo finalizado ***\n");
  return;
}


x86 assembly (clang, -O0):
<trabajo_hijo>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x30d40,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jl     1167 <trabajo_hijo+0x47>
mov    $0x0,%al
call   1030 <getpid@plt>
mov    %eax,%esi
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
lea    0xeae(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    1132 <trabajo_hijo+0x12>
lea    0xeb9(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<trabajo_hijo>:
push   %rbp
push   %r14
push   %rbx
mov    %edi,%ebx
mov    $0x30d40,%ebp
lea    0xebe(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
xor    %eax,%eax
call   1040 <getpid@plt>
mov    %r14,%rdi
mov    %eax,%esi
mov    %ebx,%edx
mov    %ebp,%ecx
xor    %eax,%eax
call   1050 <printf@plt>
add    $0xffffffff,%ebp
jb     1150 <trabajo_hijo+0x20>
lea    0xeb4(%rip),%rdi
pop    %rbx
pop    %r14
pop    %rbp
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [39 x i8] c"\09\09hijo trabajando (%d:%d), valor = %d\0A\00"
@.str.1 = [36 x i8] c" *** proceso hijo finalizado ***\0A\00"
define void @trabajo_hijo(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 200000, i32* %3
br label %4
4: ; preds = %12, %1
%5 = load i32, i32* %3
%6 = icmp sge i32 %5, 0
br i1 %6, label %7, label %15
7: ; preds = %4
%8 = call i32 (...) @getpid()
%9 = load i32, i32* %2
%10 = load i32, i32* %3
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 %8, i32 %9, i32 %10)
br label %12
12: ; preds = %7
%13 = load i32, i32* %3
%14 = add nsw i32 %13, -1
store i32 %14, i32* %3
br label %4
15: ; preds = %4
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.1, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [39 x i8] c"\09\09hijo trabajando (%d:%d), valor = %d\0A\00"
@str = [35 x i8] c" *** proceso hijo finalizado ***\00"
define void @trabajo_hijo(i32 %0) {
br label %2
2: ; preds = %1, %2
%3 = phi i32 [ 200000, %1 ], [ %6, %2 ]
%4 = tail call i32 (...) @getpid()
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0), i32 %4, i32 %0, i32 %3)
%6 = add nsw i32 %3, -1
%7 = icmp eq i32 %3, 0
br i1 %7, label %8, label %2
8: ; preds = %2
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @str, i64 0, i64 0))
ret void
}