#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*/ printf(char *);
int /*<<< orphan*/ scanf(char *, char *);
void escolha_simb(char *jog1, char *jog2) {
  while (1) {
    printf("\njogador 1, escolha X ou O \n");
    char esc;
    scanf("%c", &esc);
    if (esc == 'x') {
      *jog2 = 'X';
      *jog1 = 'O';
      break;
    } else if (esc == 'o') {
      *jog2 = 'O';
      *jog1 = 'X';
      break;
    }
  }
}


x86 assembly (clang, -O0):
<escolha_simb>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xec9(%rip),%rdi
call   1030 <printf@plt>
lea    0xeda(%rip),%rdi
lea    -0x11(%rbp),%rsi
call   1040 <scanf@plt>
movsbl -0x11(%rbp),%eax
cmp    $0x78,%eax
jne    116c <escolha_simb+0x4c>
mov    -0x10(%rbp),%rax
movb   $0x58,(%rax)
mov    -0x8(%rbp),%rax
movb   $0x4f,(%rax)
jmp    1196 <escolha_simb+0x76>
movsbl -0x11(%rbp),%eax
cmp    $0x6f,%eax
jne    118c <escolha_simb+0x6c>
mov    -0x10(%rbp),%rax
movb   $0x4f,(%rax)
mov    -0x8(%rbp),%rax
movb   $0x58,(%rax)
jmp    1196 <escolha_simb+0x76>
jmp    1191 <escolha_simb+0x71>
jmp    1130 <escolha_simb+0x10>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<escolha_simb>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
mov    %rsi,%r14
mov    %rdi,%r15
lea    0xec9(%rip),%r12
lea    0xebf(%rip),%r13
lea    0xf(%rsp),%rbx
cs nopw 0x0(%rax,%rax,1)
mov    %r12,%rdi
call   1030 <puts@plt>
mov    %r13,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
movzbl 0xf(%rsp),%eax
cmp    $0x6f,%al
je     1176 <escolha_simb+0x56>
cmp    $0x78,%al
jne    1150 <escolha_simb+0x30>
mov    $0x4f,%al
mov    $0x58,%cl
jmp    117a <escolha_simb+0x5a>
mov    $0x58,%al
mov    $0x4f,%cl
mov    %cl,(%r14)
mov    %al,(%r15)
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [29 x i8] c"\0Ajogador 1, escolha X ou O \0A\00"
@.str.1 = [3 x i8] c"%c\00"
define void @escolha_simb(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8
store i8* %0, i8** %3
store i8* %1, i8** %4
br label %6
6: ; preds = %2, %23
%7 = call i32 @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %5)
%9 = load i8, i8* %5
%10 = sext i8 %9 to i32
%11 = icmp eq i32 %10, 120
br i1 %11, label %12, label %15
12: ; preds = %6
%13 = load i8*, i8** %4
store i8 88, i8* %13
%14 = load i8*, i8** %3
store i8 79, i8* %14
br label %24
15: ; preds = %6
%16 = load i8, i8* %5
%17 = sext i8 %16 to i32
%18 = icmp eq i32 %17, 111
br i1 %18, label %19, label %22
19: ; preds = %15
%20 = load i8*, i8** %4
store i8 79, i8* %20
%21 = load i8*, i8** %3
store i8 88, i8* %21
br label %24
22: ; preds = %15
br label %23
23: ; preds = %22
br label %6
24: ; preds = %19, %12
ret void
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%c\00"
@str = [28 x i8] c"\0Ajogador 1, escolha X ou O \00"
define void @escolha_simb(i8* nocapture writeonly %0, i8* nocapture writeonly %1) {
%3 = alloca i8
br label %4
4: ; preds = %8, %2
%5 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
%7 = load i8, i8* %3
switch i8 %7, label %8 [
i8 120, label %9
i8 111, label %10
]
8: ; preds = %4
br label %4
9: ; preds = %4
br label %10
10: ; preds = %4, %9
%11 = phi i8 [ 88, %9 ], [ 79, %4 ]
%12 = phi i8 [ 79, %9 ], [ 88, %4 ]
store i8 %11, i8* %1
store i8 %12, i8* %0
ret void
}