#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 /*<<< orphan*/ assert(int);
int compara_cadena(char *, char *);
int cuenta_numero_letras(char *, char);
int /*<<< orphan*/ printf(char *, ...);
int tipo_de_letra(char);
int test1(void) {
  char *cadena = "Hola buenas";
  char letra = 'a';
  int tmp = cuenta_numero_letras(cadena, letra);
  assert(tmp == 2);
  printf("Hay %d letras %c en : %s\n", tmp, letra, cadena);
  char *cadena2 = "Hola buenas";
  tmp = compara_cadena(cadena, cadena2);
  assert(tmp == 1);
  printf("%s es igual a %s\n", cadena, cadena2);
  tmp = tipo_de_letra(letra);
  assert(tmp == 1);
  printf("%c es igual a 'a'\n", letra);
  return 0;
}


x86 assembly (clang, -O0):
<test1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xea1(%rip),%rax
mov    %rax,-0x8(%rbp)
movb   $0x61,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
movsbl -0x9(%rbp),%esi
call   1060 <cuenta_numero_letras@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x2,-0x10(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
mov    -0x10(%rbp),%esi
movsbl -0x9(%rbp),%edx
mov    -0x8(%rbp),%rcx
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
lea    0xe58(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1040 <compara_cadena@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x1,-0x10(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
mov    -0x8(%rbp),%rsi
mov    -0x18(%rbp),%rdx
lea    0xe4a(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
movsbl -0x9(%rbp),%edi
call   1030 <tipo_de_letra@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x1,-0x10(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1070 <assert@plt>
movsbl -0x9(%rbp),%esi
lea    0xe2d(%rip),%rdi
mov    $0x0,%al
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test1>:
push   %rbp
push   %rbx
push   %rax
lea    0xea6(%rip),%rbx
mov    %rbx,%rdi
mov    $0x61,%esi
call   1060 <cuenta_numero_letras@plt>
mov    %eax,%ebp
xor    %edi,%edi
cmp    $0x2,%eax
sete   %dil
call   1070 <assert@plt>
lea    0xe8e(%rip),%rdi
mov    %ebp,%esi
mov    $0x61,%edx
mov    %rbx,%rcx
xor    %eax,%eax
call   1050 <printf@plt>
mov    %rbx,%rdi
mov    %rbx,%rsi
call   1040 <compara_cadena@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1070 <assert@plt>
lea    0xe77(%rip),%rdi
mov    %rbx,%rsi
mov    %rbx,%rdx
xor    %eax,%eax
call   1050 <printf@plt>
mov    $0x61,%edi
call   1030 <tipo_de_letra@plt>
xor    %edi,%edi
cmp    $0x1,%eax
sete   %dil
call   1070 <assert@plt>
lea    0xe5d(%rip),%rdi
mov    $0x61,%esi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [12 x i8] c"Hola buenas\00"
@.str.1 = [26 x i8] c"Hay %d letras %c en : %s\0A\00"
@.str.2 = [18 x i8] c"%s es igual a %s\0A\00"
@.str.3 = [19 x i8] c"%c es igual a 'a'\0A\00"
define i32 @test1() {
%1 = alloca i8*
%2 = alloca i8
%3 = alloca i32
%4 = alloca i8*
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8** %1
store i8 97, i8* %2
%5 = load i8*, i8** %1
%6 = load i8, i8* %2
%7 = call i32 @cuenta_numero_letras(i8* %5, i8 signext %6)
store i32 %7, i32* %3
%8 = load i32, i32* %3
%9 = icmp eq i32 %8, 2
%10 = zext i1 %9 to i32
%11 = call i32 @assert(i32 %10)
%12 = load i32, i32* %3
%13 = load i8, i8* %2
%14 = sext i8 %13 to i32
%15 = load i8*, i8** %1
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %12, i32 %14, i8* %15)
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8** %4
%17 = load i8*, i8** %1
%18 = load i8*, i8** %4
%19 = call i32 @compara_cadena(i8* %17, i8* %18)
store i32 %19, i32* %3
%20 = load i32, i32* %3
%21 = icmp eq i32 %20, 1
%22 = zext i1 %21 to i32
%23 = call i32 @assert(i32 %22)
%24 = load i8*, i8** %1
%25 = load i8*, i8** %4
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* %24, i8* %25)
%27 = load i8, i8* %2
%28 = call i32 @tipo_de_letra(i8 signext %27)
store i32 %28, i32* %3
%29 = load i32, i32* %3
%30 = icmp eq i32 %29, 1
%31 = zext i1 %30 to i32
%32 = call i32 @assert(i32 %31)
%33 = load i8, i8* %2
%34 = sext i8 %33 to i32
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 %34)
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"Hola buenas\00"
@.str.1 = [26 x i8] c"Hay %d letras %c en : %s\0A\00"
@.str.2 = [18 x i8] c"%s es igual a %s\0A\00"
@.str.3 = [19 x i8] c"%c es igual a 'a'\0A\00"
define i32 @test1() {
%1 = tail call i32 @cuenta_numero_letras(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8 signext 97)
%2 = icmp eq i32 %1, 2
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([26 x i8], [26 x i8]* @.str.1, i64 0, i64 0), i32 %1, i32 97, i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%6 = tail call i32 @compara_cadena(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%7 = icmp eq i32 %6, 1
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([18 x i8], [18 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%11 = tail call i32 @tipo_de_letra(i8 signext 97)
%12 = icmp eq i32 %11, 1
%13 = zext i1 %12 to i32
%14 = tail call i32 @assert(i32 %13)
%15 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 97)
ret i32 0
}