#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*/ scanf(char *, ...);
void carrega(char f[200], int *tf, char p[200], int *tp) {
  int i;
  scanf("%d", tf);
  scanf("%d\n", tp);
  for (i = 0; i < *tf; i++)
    scanf("%c", &f[i]);
  scanf("\n");
  for (i = 0; i < *tp; i++)
    scanf("%c", &p[i]);
  scanf("\n");
}


x86 assembly (clang, -O0):
<carrega>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x10(%rbp),%rsi
lea    0xecd(%rip),%rdi
mov    $0x0,%al
call   1030 <scanf@plt>
mov    -0x20(%rbp),%rsi
lea    0xebe(%rip),%rdi
mov    $0x0,%al
call   1030 <scanf@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%eax
jge    1189 <carrega+0x79>
mov    -0x8(%rbp),%rsi
movslq -0x24(%rbp),%rax
add    %rax,%rsi
lea    0xe93(%rip),%rdi
mov    $0x0,%al
call   1030 <scanf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    1153 <carrega+0x43>
lea    0xe75(%rip),%rdi
mov    $0x0,%al
call   1030 <scanf@plt>
movl   $0x0,-0x24(%rbp)
mov    -0x24(%rbp),%eax
mov    -0x20(%rbp),%rcx
cmp    (%rcx),%eax
jge    11d4 <carrega+0xc4>
mov    -0x18(%rbp),%rsi
movslq -0x24(%rbp),%rax
add    %rax,%rsi
lea    0xe48(%rip),%rdi
mov    $0x0,%al
call   1030 <scanf@plt>
mov    -0x24(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x24(%rbp)
jmp    119e <carrega+0x8e>
lea    0xe2a(%rip),%rdi
mov    $0x0,%al
call   1030 <scanf@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<carrega>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %rcx,%r15
mov    %rdx,%r14
mov    %rsi,%rbx
mov    %rdi,%r12
lea    0xed2(%rip),%rdi
xor    %eax,%eax
call   1030 <scanf@plt>
lea    0xec7(%rip),%rdi
mov    %r15,%rsi
xor    %eax,%eax
call   1030 <scanf@plt>
cmpl   $0x0,(%rbx)
jle    117a <carrega+0x6a>
lea    0xeb5(%rip),%r13
xor    %ebp,%ebp
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
lea    (%r12,%rbp,1),%rsi
mov    %r13,%rdi
xor    %eax,%eax
call   1030 <scanf@plt>
add    $0x1,%rbp
movslq (%rbx),%rax
cmp    %rax,%rbp
jl     1160 <carrega+0x50>
lea    0xe84(%rip),%rdi
xor    %eax,%eax
call   1030 <scanf@plt>
cmpl   $0x0,(%r15)
jle    11ba <carrega+0xaa>
lea    0xe72(%rip),%rbx
xor    %ebp,%ebp
nopw   0x0(%rax,%rax,1)
lea    (%r14,%rbp,1),%rsi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <scanf@plt>
add    $0x1,%rbp
movslq (%r15),%rax
cmp    %rax,%rbp
jl     11a0 <carrega+0x90>
lea    0xe44(%rip),%rdi
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
jmp    1030 <scanf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
@.str.2 = [3 x i8] c"%c\00"
@.str.3 = [2 x i8] c"\0A\00"
define void @carrega(i8* %0, i32* %1, i8* %2, i32* %3) {
%5 = alloca i8*
%6 = alloca i32*
%7 = alloca i8*
%8 = alloca i32*
%9 = alloca i32
store i8* %0, i8** %5
store i32* %1, i32** %6
store i8* %2, i8** %7
store i32* %3, i32** %8
%10 = load i32*, i32** %6
%11 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %10)
%12 = load i32*, i32** %8
%13 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %12)
store i32 0, i32* %9
br label %14
14: ; preds = %25, %4
%15 = load i32, i32* %9
%16 = load i32*, i32** %6
%17 = load i32, i32* %16
%18 = icmp slt i32 %15, %17
br i1 %18, label %19, label %28
19: ; preds = %14
%20 = load i8*, i8** %5
%21 = load i32, i32* %9
%22 = sext i32 %21 to i64
%23 = getelementptr inbounds i8, i8* %20, i64 %22
%24 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %23)
br label %25
25: ; preds = %19
%26 = load i32, i32* %9
%27 = add nsw i32 %26, 1
store i32 %27, i32* %9
br label %14
28: ; preds = %14
%29 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
store i32 0, i32* %9
br label %30
30: ; preds = %41, %28
%31 = load i32, i32* %9
%32 = load i32*, i32** %8
%33 = load i32, i32* %32
%34 = icmp slt i32 %31, %33
br i1 %34, label %35, label %44
35: ; preds = %30
%36 = load i8*, i8** %7
%37 = load i32, i32* %9
%38 = sext i32 %37 to i64
%39 = getelementptr inbounds i8, i8* %36, i64 %38
%40 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %39)
br label %41
41: ; preds = %35
%42 = load i32, i32* %9
%43 = add nsw i32 %42, 1
store i32 %43, i32* %9
br label %30
44: ; preds = %30
%45 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%d\00"
@.str.1 = [4 x i8] c"%d\0A\00"
@.str.2 = [3 x i8] c"%c\00"
@.str.3 = [2 x i8] c"\0A\00"
define void @carrega(i8* %0, i32* %1, i8* %2, i32* %3) {
%5 = tail call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32* %1)
%6 = tail call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%7 = load i32, i32* %1
%8 = icmp sgt i32 %7, 0
br i1 %8, label %9, label %17
9: ; preds = %4, %9
%10 = phi i64 [ %13, %9 ], [ 0, %4 ]
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = tail call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %11)
%13 = add nuw nsw i64 %10, 1
%14 = load i32, i32* %1
%15 = sext i32 %14 to i64
%16 = icmp slt i64 %13, %15
br i1 %16, label %9, label %17
17: ; preds = %9, %4
%18 = tail call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%19 = load i32, i32* %3
%20 = icmp sgt i32 %19, 0
br i1 %20, label %21, label %29
21: ; preds = %17, %21
%22 = phi i64 [ %25, %21 ], [ 0, %17 ]
%23 = getelementptr inbounds i8, i8* %2, i64 %22
%24 = tail call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %23)
%25 = add nuw nsw i64 %22, 1
%26 = load i32, i32* %3
%27 = sext i32 %26 to i64
%28 = icmp slt i64 %25, %27
br i1 %28, label %21, label %29
29: ; preds = %21, %17
%30 = tail call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
ret void
}