#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 primera_letra(char *, char);
int /*<<< orphan*/ printf(char *, ...);
int suma_numeros(int, int);
int test2(void) {
  char *cadena = "Hola buenas";
  char letra = 'a';
  int tmp = primera_letra(cadena, letra);
  assert(tmp == 3);
  printf("En %s la letra %c esta en la posicion %d\n", cadena, letra, tmp);
  int n = 4;
  int m = 5;
  tmp = suma_numeros(n, m);
  assert(n + m == tmp);
  printf("%d + %d es igual a: %d\n", n, m, tmp);
  return 0;
}


x86 assembly (clang, -O0):
<test2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    0xeb1(%rip),%rax
mov    %rax,-0x8(%rbp)
movb   $0x61,-0x9(%rbp)
mov    -0x8(%rbp),%rdi
movsbl -0x9(%rbp),%esi
call   1060 <primera_letra@plt>
mov    %eax,-0x10(%rbp)
cmpl   $0x3,-0x10(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x8(%rbp),%rsi
movsbl -0x9(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe82(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
movl   $0x4,-0x14(%rbp)
movl   $0x5,-0x18(%rbp)
mov    -0x14(%rbp),%edi
mov    -0x18(%rbp),%esi
call   1030 <suma_numeros@plt>
mov    %eax,-0x10(%rbp)
mov    -0x14(%rbp),%eax
add    -0x18(%rbp),%eax
cmp    -0x10(%rbp),%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assert@plt>
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x10(%rbp),%ecx
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test2>:
push   %rbp
push   %rbx
push   %rax
lea    0xeb6(%rip),%rbx
mov    %rbx,%rdi
mov    $0x61,%esi
call   1060 <primera_letra@plt>
mov    %eax,%ebp
xor    %edi,%edi
cmp    $0x3,%eax
sete   %dil
call   1050 <assert@plt>
lea    0xe9e(%rip),%rdi
mov    %rbx,%rsi
mov    $0x61,%edx
mov    %ebp,%ecx
xor    %eax,%eax
call   1040 <printf@plt>
mov    $0x4,%edi
mov    $0x5,%esi
call   1030 <suma_numeros@plt>
mov    %eax,%ebx
xor    %edi,%edi
cmp    $0x9,%eax
sete   %dil
call   1050 <assert@plt>
lea    0xe91(%rip),%rdi
mov    $0x4,%esi
mov    $0x5,%edx
mov    %ebx,%ecx
xor    %eax,%eax
call   1040 <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 = [42 x i8] c"En %s la letra %c esta en la posicion %d\0A\00"
@.str.2 = [24 x i8] c"%d + %d es igual a: %d\0A\00"
define i32 @test2() {
%1 = alloca i8*
%2 = alloca i8
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8** %1
store i8 97, i8* %2
%6 = load i8*, i8** %1
%7 = load i8, i8* %2
%8 = call i32 @primera_letra(i8* %6, i8 signext %7)
store i32 %8, i32* %3
%9 = load i32, i32* %3
%10 = icmp eq i32 %9, 3
%11 = zext i1 %10 to i32
%12 = call i32 @assert(i32 %11)
%13 = load i8*, i8** %1
%14 = load i8, i8* %2
%15 = sext i8 %14 to i32
%16 = load i32, i32* %3
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i8* %13, i32 %15, i32 %16)
store i32 4, i32* %4
store i32 5, i32* %5
%18 = load i32, i32* %4
%19 = load i32, i32* %5
%20 = call i32 @suma_numeros(i32 %18, i32 %19)
store i32 %20, i32* %3
%21 = load i32, i32* %4
%22 = load i32, i32* %5
%23 = add nsw i32 %21, %22
%24 = load i32, i32* %3
%25 = icmp eq i32 %23, %24
%26 = zext i1 %25 to i32
%27 = call i32 @assert(i32 %26)
%28 = load i32, i32* %4
%29 = load i32, i32* %5
%30 = load i32, i32* %3
%31 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 %28, i32 %29, i32 %30)
ret i32 0
}

LLVM IR (-O2):
@.str = [12 x i8] c"Hola buenas\00"
@.str.1 = [42 x i8] c"En %s la letra %c esta en la posicion %d\0A\00"
@.str.2 = [24 x i8] c"%d + %d es igual a: %d\0A\00"
define i32 @test2() {
%1 = tail call i32 @primera_letra(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i8 signext 97)
%2 = icmp eq i32 %1, 3
%3 = zext i1 %2 to i32
%4 = tail call i32 @assert(i32 %3)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([42 x i8], [42 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 97, i32 %1)
%6 = tail call i32 @suma_numeros(i32 4, i32 5)
%7 = icmp eq i32 %6, 9
%8 = zext i1 %7 to i32
%9 = tail call i32 @assert(i32 %8)
%10 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str.2, i64 0, i64 0), i32 4, i32 5, i32 %6)
ret i32 0
}