#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 rand();
int sorteio() {
  int x;
  if ((rand() % 2) == 0) {
    x = rand() % 10;
    x *= (x % 2) == 1 ? 1 : -1;
  } else {
    x = rand() % 10;
    x *= (x % 2) == 0 ? 1 : -1;
  }
  if (x == 0) {
    printf("\nNúmero 0 sorteado, sorteando novamente...");
    return sorteio();
  }
  return x;
}


x86 assembly (clang, -O0):
<sorteio>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1189 <sorteio+0x59>
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    $0xffffffff,%eax
mov    $0x1,%ecx
cmp    $0x1,%edx
cmove  %ecx,%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
jmp    11bd <sorteio+0x8d>
mov    $0x0,%al
call   1050 <rand@plt>
mov    $0xa,%ecx
cltd
idiv   %ecx
mov    %edx,-0x8(%rbp)
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    $0xffffffff,%eax
mov    $0x1,%ecx
cmp    $0x0,%edx
cmove  %ecx,%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jne    11e0 <sorteio+0xb0>
lea    0xe32(%rip),%rdi
call   1040 <printf@plt>
call   1030 <sorteio@plt>
mov    %eax,-0x4(%rbp)
jmp    11e6 <sorteio+0xb6>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sorteio>:
push   %rbp
push   %rbx
push   %rax
lea    0xed6(%rip),%rbx
nopw   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <rand@plt>
mov    %eax,%ebp
xor    %eax,%eax
call   1040 <rand@plt>
movslq %eax,%rcx
imul   $0x66666667,%rcx,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x22,%rax
add    %edx,%eax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%ecx
test   $0x1,%bpl
jne    1180 <sorteio+0x60>
mov    %ecx,%eax
shr    $0x7,%al
add    %cl,%al
and    $0xfe,%al
mov    %ecx,%edx
sub    %al,%dl
cmp    $0x1,%dl
jmp    1183 <sorteio+0x63>
cs nopw 0x0(%rax,%rax,1)
test   $0x1,%cl
sete   %dl
mov    %ecx,%eax
neg    %eax
test   %dl,%dl
cmovne %ecx,%eax
test   %eax,%eax
jne    119d <sorteio+0x7d>
mov    %rbx,%rdi
call   1030 <printf@plt>
jmp    1130 <sorteio+0x10>
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
@.str = [44 x i8] c"\0AN\C3\BAmero 0 sorteado, sorteando novamente...\00"
define i32 @sorteio() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 (...) @rand()
%4 = srem i32 %3, 2
%5 = icmp eq i32 %4, 0
br i1 %5, label %6, label %16
6: ; preds = %0
%7 = call i32 (...) @rand()
%8 = srem i32 %7, 10
store i32 %8, i32* %2
%9 = load i32, i32* %2
%10 = srem i32 %9, 2
%11 = icmp eq i32 %10, 1
%12 = zext i1 %11 to i64
%13 = select i1 %11, i32 1, i32 -1
%14 = load i32, i32* %2
%15 = mul nsw i32 %14, %13
store i32 %15, i32* %2
br label %26
16: ; preds = %0
%17 = call i32 (...) @rand()
%18 = srem i32 %17, 10
store i32 %18, i32* %2
%19 = load i32, i32* %2
%20 = srem i32 %19, 2
%21 = icmp eq i32 %20, 0
%22 = zext i1 %21 to i64
%23 = select i1 %21, i32 1, i32 -1
%24 = load i32, i32* %2
%25 = mul nsw i32 %24, %23
store i32 %25, i32* %2
br label %26
26: ; preds = %16, %6
%27 = load i32, i32* %2
%28 = icmp eq i32 %27, 0
br i1 %28, label %29, label %32
29: ; preds = %26
%30 = call i32 @printf(i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%31 = call i32 @sorteio()
store i32 %31, i32* %1
br label %34
32: ; preds = %26
%33 = load i32, i32* %2
store i32 %33, i32* %1
br label %34
34: ; preds = %32, %29
%35 = load i32, i32* %1
ret i32 %35
}

LLVM IR (-O2):
@.str = [44 x i8] c"\0AN\C3\BAmero 0 sorteado, sorteando novamente...\00"
define i32 @sorteio() {
br label %1
1: ; preds = %19, %0
%2 = tail call i32 (...) @rand()
%3 = and i32 %2, 1
%4 = icmp eq i32 %3, 0
%5 = tail call i32 (...) @rand()
%6 = srem i32 %5, 10
br i1 %4, label %7, label %11
7: ; preds = %1
%8 = trunc i32 %6 to i8
%9 = srem i8 %8, 2
%10 = icmp eq i8 %9, 1
br label %14
11: ; preds = %1
%12 = and i32 %6, 1
%13 = icmp eq i32 %12, 0
br label %14
14: ; preds = %11, %7
%15 = phi i1 [ %13, %11 ], [ %10, %7 ]
%16 = sub nsw i32 0, %6
%17 = select i1 %15, i32 %6, i32 %16
%18 = icmp eq i32 %17, 0
br i1 %18, label %19, label %21
19: ; preds = %14
%20 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
br label %1
21: ; preds = %14
ret i32 %17
}