#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 frequencia(char *, char);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, ...);
int main() {
  int i, j = 0, c, f;
  printf("\nInforme o numero de casos de teste:\n");
  scanf("%d", &c);
  char v[c][200];
  printf("\nInforme os %d casos de teste: \n", c);
  for (i = 0; i < c; i++) {
    printf("%d", i);
    scanf("%s[^\n]", &v[i][j]);
  }
  printf("frequencia de s e: %d", frequencia(&v[1][j], 's'));
  printf("\nOs %d casos de teste informados são:\n", c);
  for (i = 0; i < c; i++) {
    printf("%d    %s\n", i, &v[i][j]);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xeb3(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x31(%rbp)
call   1030 <printf@plt>
mov    -0x31(%rbp),%al
lea    0xf00(%rip),%rdi
lea    -0x10(%rbp),%rsi
call   1040 <scanf@plt>
mov    -0x10(%rbp),%eax
mov    %rsp,%rcx
mov    %rcx,-0x20(%rbp)
imul   $0xc8,%rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x30(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x28(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe88(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    11fe <main+0xce>
mov    -0x8(%rbp),%esi
lea    0xe9f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x30(%rbp),%rsi
movslq -0x8(%rbp),%rax
imul   $0xc8,%rax,%rax
add    %rax,%rsi
movslq -0xc(%rbp),%rax
add    %rax,%rsi
lea    0xe5e(%rip),%rdi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    11ac <main+0x7c>
mov    -0x30(%rbp),%rdi
add    $0xc8,%rdi
movslq -0xc(%rbp),%rax
add    %rax,%rdi
mov    $0x73,%esi
call   1050 <frequencia@plt>
mov    %eax,%esi
lea    0xe2b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xe30(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1286 <main+0x156>
mov    -0x30(%rbp),%rdx
mov    -0x8(%rbp),%esi
movslq -0x8(%rbp),%rax
imul   $0xc8,%rax,%rax
add    %rax,%rdx
movslq -0xc(%rbp),%rax
add    %rax,%rdx
lea    0xe1b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1242 <main+0x112>
movl   $0x0,-0x4(%rbp)
mov    -0x20(%rbp),%rax
mov    %rax,%rsp
mov    -0x4(%rbp),%eax
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xf18(%rip),%rdi
call   1030 <puts@plt>
lea    0xed7(%rip),%rdi
lea    -0x2c(%rbp),%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    %rsp,-0x38(%rbp)
mov    -0x2c(%rbp),%eax
mov    %rsp,%r12
imul   $0xc8,%rax,%rax
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r12
mov    %r12,%rsp
mov    -0x2c(%rbp),%esi
lea    0xe68(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x0,-0x2c(%rbp)
jle    11ed <main+0xad>
lea    0xe8f(%rip),%r14
lea    0xe6e(%rip),%r15
mov    %r12,%r13
xor    %ebx,%ebx
nopl   0x0(%rax,%rax,1)
mov    %r14,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r13,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
add    $0x1,%rbx
movslq -0x2c(%rbp),%rax
add    $0xc8,%r13
cmp    %rax,%rbx
jl     11c0 <main+0x80>
lea    0xc8(%r12),%rdi
mov    $0x73,%esi
call   1060 <frequencia@plt>
lea    0xe22(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    -0x2c(%rbp),%esi
lea    0xe25(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
cmpl   $0x0,-0x2c(%rbp)
jle    1253 <main+0x113>
lea    0xe39(%rip),%r14
xor    %ebx,%ebx
nop
mov    %r14,%rdi
mov    %ebx,%esi
mov    %r12,%rdx
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
movslq -0x2c(%rbp),%rax
add    $0xc8,%r12
cmp    %rax,%rbx
jl     1230 <main+0xf0>
mov    -0x38(%rbp),%rsp
xor    %eax,%eax
lea    -0x28(%rbp),%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [38 x i8] c"\0AInforme o numero de casos de teste:\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [33 x i8] c"\0AInforme os %d casos de teste: \0A\00"
@.str.3 = [7 x i8] c"%s[^\0A]\00"
@.str.4 = [22 x i8] c"frequencia de s e: %d\00"
@.str.5 = [40 x i8] c"\0AOs %d casos de teste informados s\C3\A3o:\0A\00"
@.str.6 = [10 x i8] c"%d %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i8*
%7 = alloca i64
store i32 0, i32* %1
store i32 0, i32* %3
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str, i64 0, i64 0))
%9 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%10 = load i32, i32* %4
%11 = zext i32 %10 to i64
%12 = call i8* @llvm.stacksave()
store i8* %12, i8** %6
%13 = alloca [200 x i8], i64 %11
store i64 %11, i64* %7
%14 = load i32, i32* %4
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i32 %14)
store i32 0, i32* %2
br label %16
16: ; preds = %30, %0
%17 = load i32, i32* %2
%18 = load i32, i32* %4
%19 = icmp slt i32 %17, %18
br i1 %19, label %20, label %33
20: ; preds = %16
%21 = load i32, i32* %2
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %21)
%23 = load i32, i32* %2
%24 = sext i32 %23 to i64
%25 = getelementptr inbounds [200 x i8], [200 x i8]* %13, i64 %24
%26 = load i32, i32* %3
%27 = sext i32 %26 to i64
%28 = getelementptr inbounds [200 x i8], [200 x i8]* %25, i64 0, i64 %27
%29 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* %28)
br label %30
30: ; preds = %20
%31 = load i32, i32* %2
%32 = add nsw i32 %31, 1
store i32 %32, i32* %2
br label %16
33: ; preds = %16
%34 = getelementptr inbounds [200 x i8], [200 x i8]* %13, i64 1
%35 = load i32, i32* %3
%36 = sext i32 %35 to i64
%37 = getelementptr inbounds [200 x i8], [200 x i8]* %34, i64 0, i64 %36
%38 = call i32 @frequencia(i8* %37, i8 signext 115)
%39 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 %38)
%40 = load i32, i32* %4
%41 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0), i32 %40)
store i32 0, i32* %2
br label %42
42: ; preds = %55, %33
%43 = load i32, i32* %2
%44 = load i32, i32* %4
%45 = icmp slt i32 %43, %44
br i1 %45, label %46, label %58
46: ; preds = %42
%47 = load i32, i32* %2
%48 = load i32, i32* %2
%49 = sext i32 %48 to i64
%50 = getelementptr inbounds [200 x i8], [200 x i8]* %13, i64 %49
%51 = load i32, i32* %3
%52 = sext i32 %51 to i64
%53 = getelementptr inbounds [200 x i8], [200 x i8]* %50, i64 0, i64 %52
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i32 %47, i8* %53)
br label %55
55: ; preds = %46
%56 = load i32, i32* %2
%57 = add nsw i32 %56, 1
store i32 %57, i32* %2
br label %42
58: ; preds = %42
store i32 0, i32* %1
%59 = load i8*, i8** %6
%60 = load i32, i32* %1
ret i32 %60
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [33 x i8] c"\0AInforme os %d casos de teste: \0A\00"
@.str.3 = [7 x i8] c"%s[^\0A]\00"
@.str.4 = [22 x i8] c"frequencia de s e: %d\00"
@.str.5 = [40 x i8] c"\0AOs %d casos de teste informados s\C3\A3o:\0A\00"
@.str.6 = [10 x i8] c"%d %s\0A\00"
@str = [37 x i8] c"\0AInforme o numero de casos de teste:\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([37 x i8], [37 x i8]* @str, i64 0, i64 0))
%4 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = zext i32 %5 to i64
%7 = call i8* @llvm.stacksave()
%8 = alloca [200 x i8], i64 %6
%9 = load i32, i32* %1
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0), i32 %9)
%11 = load i32, i32* %1
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %23
13: ; preds = %0, %13
%14 = phi i64 [ %19, %13 ], [ 0, %0 ]
%15 = trunc i64 %14 to i32
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%17 = getelementptr inbounds [200 x i8], [200 x i8]* %8, i64 %14, i64 0
%18 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str.3, i64 0, i64 0), i8* %17)
%19 = add nuw nsw i64 %14, 1
%20 = load i32, i32* %1
%21 = sext i32 %20 to i64
%22 = icmp slt i64 %19, %21
br i1 %22, label %13, label %23
23: ; preds = %13, %0
%24 = getelementptr inbounds [200 x i8], [200 x i8]* %8, i64 1, i64 0
%25 = call i32 @frequencia(i8* %24, i8 signext 115)
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([22 x i8], [22 x i8]* @.str.4, i64 0, i64 0), i32 %25)
%27 = load i32, i32* %1
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.5, i64 0, i64 0), i32 %27)
%29 = load i32, i32* %1
%30 = icmp sgt i32 %29, 0
br i1 %30, label %31, label %40
31: ; preds = %23, %31
%32 = phi i64 [ %36, %31 ], [ 0, %23 ]
%33 = getelementptr inbounds [200 x i8], [200 x i8]* %8, i64 %32, i64 0
%34 = trunc i64 %32 to i32
%35 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i32 %34, i8* %33)
%36 = add nuw nsw i64 %32, 1
%37 = load i32, i32* %1
%38 = sext i32 %37 to i64
%39 = icmp slt i64 %36, %38
br i1 %39, label %31, label %40
40: ; preds = %31, %23
ret i32 0
}