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

/* Variables and functions */
int atoi(char *);
scalar_t__ es_divisible_entre_cuatro(int);
scalar_t__ es_par(int);
int /*<<< orphan*/ exit(int);
scalar_t__ fork();
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, ...);
int main(int argc, char *argv[]) {
  int numero;
  pid_t pid;
  if (argc != 2) {
    printf("Modo de uso: %s <entero>\n\n", argv[0]);
    exit(1);
  }
  numero = atoi(argv[1]);
  if ((pid = fork()) < 0) {
    perror("\nError en el fork");
    exit(-1);
  } else if (pid == 0) {
    if (es_par(numero)) {
      printf("El numero %d es par\n", numero);
    } else
      printf("El numero %d no es par\n", numero);
  } else {
    if (es_divisible_entre_cuatro(numero)) {
      printf("El numero %d es divisible por 4\n", numero);
    } else
      printf("El numero %d no es divisible por 4\n", numero);
  }
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     11af <main+0x3f>
mov    -0x10(%rbp),%rax
mov    (%rax),%rsi
lea    0xe62(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    $0x0,%al
call   1090 <fork@plt>
mov    %rax,-0x20(%rbp)
cmp    $0x0,%rax
jge    11ea <main+0x7a>
lea    0xe40(%rip),%rdi
call   1050 <perror@plt>
mov    $0xffffffff,%edi
call   1080 <exit@plt>
cmpq   $0x0,-0x20(%rbp)
jne    1233 <main+0xc3>
mov    -0x14(%rbp),%edi
call   1030 <es_par@plt>
cmp    $0x0,%rax
je     121d <main+0xad>
mov    -0x14(%rbp),%esi
lea    0xe1c(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    122e <main+0xbe>
mov    -0x14(%rbp),%esi
lea    0xe1b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1271 <main+0x101>
mov    -0x14(%rbp),%edi
call   1060 <es_divisible_entre_cuatro@plt>
cmp    $0x0,%rax
je     125b <main+0xeb>
mov    -0x14(%rbp),%esi
lea    0xe0b(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    126c <main+0xfc>
mov    -0x14(%rbp),%esi
lea    0xe16(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
jmp    1271 <main+0x101>
jmp    1276 <main+0x106>
xor    %edi,%edi
call   1080 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x2,%edi
jne    11a3 <main+0x33>
mov    0x8(%rsi),%rdi
call   1070 <atoi@plt>
mov    %eax,%ebx
xor    %eax,%eax
call   1090 <fork@plt>
test   %rax,%rax
jns    11be <main+0x4e>
lea    0xe87(%rip),%rdi
call   1050 <perror@plt>
mov    $0xffffffff,%edi
call   1080 <exit@plt>
mov    (%rsi),%rsi
lea    0xe53(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x1,%edi
call   1080 <exit@plt>
mov    %ebx,%edi
jne    11d7 <main+0x67>
call   1030 <es_par@plt>
lea    0xe74(%rip),%rcx
lea    0xe58(%rip),%rdi
jmp    11ea <main+0x7a>
call   1060 <es_divisible_entre_cuatro@plt>
lea    0xe98(%rip),%rcx
lea    0xe70(%rip),%rdi
test   %rax,%rax
cmove  %rcx,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %edi,%edi
call   1080 <exit@plt>

LLVM IR (-O0):
@.str = [27 x i8] c"Modo de uso: %s <entero>\0A\0A\00"
@.str.1 = [18 x i8] c"\0AError en el fork\00"
@.str.2 = [21 x i8] c"El numero %d es par\0A\00"
@.str.3 = [24 x i8] c"El numero %d no es par\0A\00"
@.str.4 = [33 x i8] c"El numero %d es divisible por 4\0A\00"
@.str.5 = [36 x i8] c"El numero %d no es divisible por 4\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i64
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = load i32, i32* %4
%9 = icmp ne i32 %8, 2
br i1 %9, label %10, label %16
10: ; preds = %2
%11 = load i8**, i8*** %5
%12 = getelementptr inbounds i8*, i8** %11, i64 0
%13 = load i8*, i8** %12
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %13)
%15 = call i32 @exit(i32 1)
unreachable
16: ; preds = %2
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = call i32 @atoi(i8* %19)
store i32 %20, i32* %6
%21 = call i64 (...) @fork()
store i64 %21, i64* %7
%22 = icmp slt i64 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %16
%24 = call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%25 = call i32 @exit(i32 -1)
unreachable
26: ; preds = %16
%27 = load i64, i64* %7
%28 = icmp eq i64 %27, 0
br i1 %28, label %29, label %40
29: ; preds = %26
%30 = load i32, i32* %6
%31 = call i64 @es_par(i32 %30)
%32 = icmp ne i64 %31, 0
br i1 %32, label %33, label %36
33: ; preds = %29
%34 = load i32, i32* %6
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), i32 %34)
br label %39
36: ; preds = %29
%37 = load i32, i32* %6
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i32 %37)
br label %39
39: ; preds = %36, %33
br label %51
40: ; preds = %26
%41 = load i32, i32* %6
%42 = call i64 @es_divisible_entre_cuatro(i32 %41)
%43 = icmp ne i64 %42, 0
br i1 %43, label %44, label %47
44: ; preds = %40
%45 = load i32, i32* %6
%46 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), i32 %45)
br label %50
47: ; preds = %40
%48 = load i32, i32* %6
%49 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), i32 %48)
br label %50
50: ; preds = %47, %44
br label %51
51: ; preds = %50, %39
br label %52
52: ; preds = %51
%53 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [27 x i8] c"Modo de uso: %s <entero>\0A\0A\00"
@.str.1 = [18 x i8] c"\0AError en el fork\00"
@.str.2 = [21 x i8] c"El numero %d es par\0A\00"
@.str.3 = [24 x i8] c"El numero %d no es par\0A\00"
@.str.4 = [33 x i8] c"El numero %d es divisible por 4\0A\00"
@.str.5 = [36 x i8] c"El numero %d no es divisible por 4\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp eq i32 %0, 2
br i1 %3, label %8, label %4
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0), i8* %5)
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %2
%9 = getelementptr inbounds i8*, i8** %1, i64 1
%10 = load i8*, i8** %9
%11 = tail call i32 @atoi(i8* %10)
%12 = tail call i64 (...) @fork()
%13 = icmp slt i64 %12, 0
br i1 %13, label %14, label %17
14: ; preds = %8
%15 = tail call i32 @perror(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0))
%16 = tail call i32 @exit(i32 -1)
unreachable
17: ; preds = %8
%18 = icmp eq i64 %12, 0
br i1 %18, label %19, label %21
19: ; preds = %17
%20 = tail call i64 @es_par(i32 %11)
br label %23
21: ; preds = %17
%22 = tail call i64 @es_divisible_entre_cuatro(i32 %11)
br label %23
23: ; preds = %21, %19
%24 = phi i64 [ %22, %21 ], [ %20, %19 ]
%25 = phi i8* [ getelementptr inbounds ([33 x i8], [33 x i8]* @.str.4, i64 0, i64 0), %21 ], [ getelementptr inbounds ([21 x i8], [21 x i8]* @.str.2, i64 0, i64 0), %19 ]
%26 = phi i8* [ getelementptr inbounds ([36 x i8], [36 x i8]* @.str.5, i64 0, i64 0), %21 ], [ getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), %19 ]
%27 = icmp eq i64 %24, 0
%28 = select i1 %27, i8* %26, i8* %25
%29 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) %28, i32 %11)
%30 = tail call i32 @exit(i32 0)
unreachable
}