#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 atoi(char *);
int /*<<< orphan*/ getToken(char *, int, int, char *);
int /*<<< orphan*/ setToken(char *, int, int, char *);
int /*<<< orphan*/ sprintf(char *, char *, int);
int /*<<< orphan*/ strcat(char *, char *);
scalar_t__ strcmp(char *, char *);
int /*<<< orphan*/ strcpy(char *, char *);
void mudaPlacar(char *placarJogo, char *valorRodada, char *equipe) {
  int rodada, valorPlacar;
  char placar[3];
  char aux[2];
  rodada = atoi(valorRodada);
  if (strcmp(equipe, "a") == 0) {
    getToken(placarJogo, 0, 1, placar);
    valorPlacar = atoi(placar);
    valorPlacar += rodada;
    sprintf(aux, "%d", valorPlacar);
    if (valorPlacar < 10) {
      strcpy(placar, "0");
      strcat(placar, aux);
    } else {
      strcpy(placar, aux);
    }
    setToken(placarJogo, 0, 1, placar);
  } else if (strcmp(equipe, "b") == 0) {
    getToken(placarJogo, 2, 3, placar);
    valorPlacar = atoi(placar);
    valorPlacar += rodada;
    sprintf(aux, "%d", valorPlacar);
    if (valorPlacar < 10) {
      strcpy(placar, "0");
      strcat(placar, aux);
    } else {
      strcpy(placar, aux);
    }
    setToken(placarJogo, 2, 3, placar);
  }
}


x86 assembly (clang, -O0):
<mudaPlacar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
lea    0xe65(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    1238 <mudaPlacar+0xc8>
mov    -0x8(%rbp),%rdi
lea    -0x23(%rbp),%rcx
xor    %esi,%esi
mov    $0x1,%edx
call   1040 <getToken@plt>
lea    -0x23(%rbp),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
lea    -0x25(%rbp),%rdi
mov    -0x20(%rbp),%edx
lea    0xe21(%rip),%rsi
call   1090 <sprintf@plt>
cmpl   $0xa,-0x20(%rbp)
jge    1212 <mudaPlacar+0xa2>
lea    -0x23(%rbp),%rdi
lea    0xe0a(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x23(%rbp),%rdi
lea    -0x25(%rbp),%rsi
call   1080 <strcat@plt>
jmp    121f <mudaPlacar+0xaf>
lea    -0x23(%rbp),%rdi
lea    -0x25(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
lea    -0x23(%rbp),%rcx
xor    %esi,%esi
mov    $0x1,%edx
call   1060 <setToken@plt>
jmp    12e6 <mudaPlacar+0x176>
mov    -0x18(%rbp),%rdi
lea    0xdc4(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
jne    12e1 <mudaPlacar+0x171>
mov    -0x8(%rbp),%rdi
lea    -0x23(%rbp),%rcx
mov    $0x2,%esi
mov    $0x3,%edx
call   1040 <getToken@plt>
lea    -0x23(%rbp),%rdi
call   1070 <atoi@plt>
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
add    -0x20(%rbp),%eax
mov    %eax,-0x20(%rbp)
lea    -0x25(%rbp),%rdi
mov    -0x20(%rbp),%edx
lea    0xd76(%rip),%rsi
call   1090 <sprintf@plt>
cmpl   $0xa,-0x20(%rbp)
jge    12bd <mudaPlacar+0x14d>
lea    -0x23(%rbp),%rdi
lea    0xd5f(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0x23(%rbp),%rdi
lea    -0x25(%rbp),%rsi
call   1080 <strcat@plt>
jmp    12ca <mudaPlacar+0x15a>
lea    -0x23(%rbp),%rdi
lea    -0x25(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x8(%rbp),%rdi
lea    -0x23(%rbp),%rcx
mov    $0x2,%esi
mov    $0x3,%edx
call   1060 <setToken@plt>
jmp    12e6 <mudaPlacar+0x176>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mudaPlacar>:
push   %rbp
push   %r14
push   %rbx
sub    $0x10,%rsp
mov    %rdx,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1070 <atoi@plt>
mov    %eax,%ebp
lea    0xe71(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1220 <mudaPlacar+0xb0>
lea    0xe60(%rip),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
jne    12c4 <mudaPlacar+0x154>
lea    0xd(%rsp),%rbx
mov    %r14,%rdi
mov    $0x2,%esi
mov    $0x3,%edx
mov    %rbx,%rcx
call   1040 <getToken@plt>
mov    %rbx,%rdi
call   1070 <atoi@plt>
mov    %eax,%ebx
add    %ebp,%ebx
lea    0xe1d(%rip),%rsi
lea    0xb(%rsp),%rdi
mov    %ebx,%edx
call   1090 <sprintf@plt>
cmp    $0x9,%ebx
jg     129e <mudaPlacar+0x12e>
lea    0xe04(%rip),%rsi
lea    0xd(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
lea    0xb(%rsp),%rsi
mov    %rbx,%rdi
call   1080 <strcat@plt>
jmp    12ad <mudaPlacar+0x13d>
lea    0xd(%rsp),%rbx
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x1,%edx
mov    %rbx,%rcx
call   1040 <getToken@plt>
mov    %rbx,%rdi
call   1070 <atoi@plt>
mov    %eax,%ebx
add    %ebp,%ebx
lea    0xdb8(%rip),%rsi
lea    0xb(%rsp),%rdi
mov    %ebx,%edx
call   1090 <sprintf@plt>
cmp    $0x9,%ebx
jg     127e <mudaPlacar+0x10e>
lea    0xda3(%rip),%rsi
lea    0xd(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
lea    0xb(%rsp),%rsi
mov    %rbx,%rdi
call   1080 <strcat@plt>
jmp    128d <mudaPlacar+0x11d>
lea    0xd(%rsp),%rdi
lea    0xb(%rsp),%rsi
call   1030 <strcpy@plt>
lea    0xd(%rsp),%rcx
mov    %r14,%rdi
xor    %esi,%esi
mov    $0x1,%edx
jmp    12bf <mudaPlacar+0x14f>
lea    0xd(%rsp),%rdi
lea    0xb(%rsp),%rsi
call   1030 <strcpy@plt>
lea    0xd(%rsp),%rcx
mov    %r14,%rdi
mov    $0x2,%esi
mov    $0x3,%edx
call   1060 <setToken@plt>
add    $0x10,%rsp
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
@.str = [2 x i8] c"a\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [2 x i8] c"0\00"
@.str.3 = [2 x i8] c"b\00"
define void @mudaPlacar(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca i32
%8 = alloca i32
%9 = alloca [3 x i8]
%10 = alloca [2 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%11 = load i8*, i8** %5
%12 = call i32 @atoi(i8* %11)
store i32 %12, i32* %7
%13 = load i8*, i8** %6
%14 = call i64 @strcmp(i8* %13, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%15 = icmp eq i64 %14, 0
br i1 %15, label %16, label %44
16: ; preds = %3
%17 = load i8*, i8** %4
%18 = getelementptr inbounds [3 x i8], [3 x i8]* %9, i64 0, i64 0
%19 = call i32 @getToken(i8* %17, i32 0, i32 1, i8* %18)
%20 = getelementptr inbounds [3 x i8], [3 x i8]* %9, i64 0, i64 0
%21 = call i32 @atoi(i8* %20)
store i32 %21, i32* %8
%22 = load i32, i32* %7
%23 = load i32, i32* %8
%24 = add nsw i32 %23, %22
store i32 %24, i32* %8
%25 = getelementptr inbounds [2 x i8], [2 x i8]* %10, i64 0, i64 0
%26 = load i32, i32* %8
%27 = call i32 @sprintf(i8* %25, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %26)
%28 = load i32, i32* %8
%29 = icmp slt i32 %28, 10
br i1 %29, label %30, label %36
30: ; preds = %16
%31 = getelementptr inbounds [3 x i8], [3 x i8]* %9, i64 0, i64 0
%32 = call i32 @strcpy(i8* %31, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%33 = getelementptr inbounds [3 x i8], [3 x i8]* %9, i64 0, i64 0
%34 = getelementptr inbounds [2 x i8], [2 x i8]* %10, i64 0, i64 0
%35 = call i32 @strcat(i8* %33, i8* %34)
br label %40
36: ; preds = %16
%37 = getelementptr inbounds [3 x i8], [3 x i8]* %9, i64 0, i64 0
%38 = getelementptr inbounds [2 x i8], [2 x i8]* %10, i64 0, i64 0
%39 = call i32 @strcpy(i8* %37, i8* %38)
br label %40
40: ; preds = %36, %30
%41 = load i8*, i8** %4
%42 = getelementptr inbounds [3 x i8], [3 x i8]* %9, i64 0, i64 0
%43 = call i32 @setToken(i8* %41, i32 0, i32 1, i8* %42)
br label %77
44: ; preds = %3
%45 = load i8*, i8** %6
%46 = call i64 @strcmp(i8* %45, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%47 = icmp eq i64 %46, 0
br i1 %47, label %48, label %76
48: ; preds = %44
%49 = load i8*, i8** %4
%50 = getelementptr inbounds [3 x i8], [3 x i8]* %9, i64 0, i64 0
%51 = call i32 @getToken(i8* %49, i32 2, i32 3, i8* %50)
%52 = getelementptr inbounds [3 x i8], [3 x i8]* %9, i64 0, i64 0
%53 = call i32 @atoi(i8* %52)
store i32 %53, i32* %8
%54 = load i32, i32* %7
%55 = load i32, i32* %8
%56 = add nsw i32 %55, %54
store i32 %56, i32* %8
%57 = getelementptr inbounds [2 x i8], [2 x i8]* %10, i64 0, i64 0
%58 = load i32, i32* %8
%59 = call i32 @sprintf(i8* %57, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %58)
%60 = load i32, i32* %8
%61 = icmp slt i32 %60, 10
br i1 %61, label %62, label %68
62: ; preds = %48
%63 = getelementptr inbounds [3 x i8], [3 x i8]* %9, i64 0, i64 0
%64 = call i32 @strcpy(i8* %63, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%65 = getelementptr inbounds [3 x i8], [3 x i8]* %9, i64 0, i64 0
%66 = getelementptr inbounds [2 x i8], [2 x i8]* %10, i64 0, i64 0
%67 = call i32 @strcat(i8* %65, i8* %66)
br label %72
68: ; preds = %48
%69 = getelementptr inbounds [3 x i8], [3 x i8]* %9, i64 0, i64 0
%70 = getelementptr inbounds [2 x i8], [2 x i8]* %10, i64 0, i64 0
%71 = call i32 @strcpy(i8* %69, i8* %70)
br label %72
72: ; preds = %68, %62
%73 = load i8*, i8** %4
%74 = getelementptr inbounds [3 x i8], [3 x i8]* %9, i64 0, i64 0
%75 = call i32 @setToken(i8* %73, i32 2, i32 3, i8* %74)
br label %76
76: ; preds = %72, %44
br label %77
77: ; preds = %76, %40
ret void
}

LLVM IR (-O2):
@.str = [2 x i8] c"a\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [2 x i8] c"0\00"
@.str.3 = [2 x i8] c"b\00"
define void @mudaPlacar(i8* %0, i8* nocapture %1, i8* %2) {
%4 = alloca [3 x i8]
%5 = alloca [2 x i8]
%6 = getelementptr inbounds [3 x i8], [3 x i8]* %4, i64 0, i64 0
%7 = getelementptr inbounds [2 x i8], [2 x i8]* %5, i64 0, i64 0
%8 = tail call i32 @atoi(i8* %1)
%9 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0))
%10 = icmp eq i64 %9, 0
br i1 %10, label %11, label %24
11: ; preds = %3
%12 = call i32 @getToken(i8* %0, i32 0, i32 1, i8* %6)
%13 = call i32 @atoi(i8* %6)
%14 = add nsw i32 %13, %8
%15 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %14)
%16 = icmp slt i32 %14, 10
br i1 %16, label %17, label %20
17: ; preds = %11
%18 = call i32 @strcpy(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%19 = call i32 @strcat(i8* %6, i8* %7)
br label %22
20: ; preds = %11
%21 = call i32 @strcpy(i8* %6, i8* %7)
br label %22
22: ; preds = %20, %17
%23 = call i32 @setToken(i8* %0, i32 0, i32 1, i8* %6)
br label %40
24: ; preds = %3
%25 = tail call i64 @strcmp(i8* %2, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.3, i64 0, i64 0))
%26 = icmp eq i64 %25, 0
br i1 %26, label %27, label %40
27: ; preds = %24
%28 = call i32 @getToken(i8* %0, i32 2, i32 3, i8* %6)
%29 = call i32 @atoi(i8* %6)
%30 = add nsw i32 %29, %8
%31 = call i32 @sprintf(i8* %7, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32 %30)
%32 = icmp slt i32 %30, 10
br i1 %32, label %33, label %36
33: ; preds = %27
%34 = call i32 @strcpy(i8* %6, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.2, i64 0, i64 0))
%35 = call i32 @strcat(i8* %6, i8* %7)
br label %38
36: ; preds = %27
%37 = call i32 @strcpy(i8* %6, i8* %7)
br label %38
38: ; preds = %36, %33
%39 = call i32 @setToken(i8* %0, i32 2, i32 3, i8* %6)
br label %40
40: ; preds = %24, %38, %22
ret void
}