#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*/ getchar();
int /*<<< orphan*/ intervaloRecursos(int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, char *);
void cicloNomade(int iRecursos, int iIntervalo, int iPopulacao, int iCiclos) {
  char cDecisao = ' ';
  while ((cDecisao != 'x') || (cDecisao != 'X')) {
    printf("\nAperte qualquer tecla para continuar\n");
    printf("\nDigite x para encerrar\n");
    scanf("%c", &cDecisao);
    getchar();
    printf("CHAR1: %c", cDecisao);
    printf("\n Teste para saber a populacao %d\n", iPopulacao);
    if (iIntervalo = 1) {
      iPopulacao = iPopulacao + (iPopulacao / 6);
    } else if (iIntervalo = 2) {
      iPopulacao = iPopulacao + (iPopulacao / 18);
    } else if (iIntervalo = 3) {
      iPopulacao = iPopulacao;
    } else if (iIntervalo = 4) {
      iPopulacao = iPopulacao / 2;
    }
    printf("CHAR2: %c", cDecisao);
    iRecursos = iRecursos - (2 * iPopulacao);
    intervaloRecursos(iRecursos, iIntervalo);
    printf("\n Teste para saber a populacao %d\n", iPopulacao);
    iCiclos++;
    printf("CHAR3: %c", cDecisao);
  }
}


x86 assembly (clang, -O0):
<cicloNomade>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
movb   $0x20,-0x11(%rbp)
movsbl -0x11(%rbp),%ecx
mov    $0x1,%al
cmp    $0x78,%ecx
mov    %al,-0x12(%rbp)
jne    1177 <cicloNomade+0x37>
movsbl -0x11(%rbp),%eax
cmp    $0x58,%eax
setne  %al
mov    %al,-0x12(%rbp)
mov    -0x12(%rbp),%al
test   $0x1,%al
jne    1187 <cicloNomade+0x47>
jmp    12f9 <cicloNomade+0x1b9>
lea    0xe72(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe8b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe9d(%rip),%rdi
lea    -0x11(%rbp),%rsi
call   1050 <scanf@plt>
mov    $0x0,%al
call   1040 <getchar@plt>
movsbl -0x11(%rbp),%esi
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0xc(%rbp),%esi
lea    0xe74(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x8(%rbp)
mov    $0x1,%al
test   $0x1,%al
jne    11f3 <cicloNomade+0xb3>
jmp    1213 <cicloNomade+0xd3>
mov    -0xc(%rbp),%eax
mov    %eax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x6,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x18(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
jmp    129d <cicloNomade+0x15d>
movl   $0x2,-0x8(%rbp)
mov    $0x1,%al
test   $0x1,%al
jne    1229 <cicloNomade+0xe9>
jmp    1249 <cicloNomade+0x109>
mov    -0xc(%rbp),%eax
mov    %eax,-0x1c(%rbp)
mov    -0xc(%rbp),%eax
mov    $0x12,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x1c(%rbp),%eax
add    %ecx,%eax
mov    %eax,-0xc(%rbp)
jmp    1298 <cicloNomade+0x158>
movl   $0x3,-0x8(%rbp)
mov    $0x1,%al
test   $0x1,%al
jne    125f <cicloNomade+0x11f>
jmp    126a <cicloNomade+0x12a>
mov    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    1293 <cicloNomade+0x153>
movl   $0x4,-0x8(%rbp)
mov    $0x1,%al
test   $0x1,%al
jne    1280 <cicloNomade+0x140>
jmp    128e <cicloNomade+0x14e>
mov    -0xc(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
mov    %eax,-0xc(%rbp)
jmp    1293 <cicloNomade+0x153>
jmp    1298 <cicloNomade+0x158>
jmp    129d <cicloNomade+0x15d>
movsbl -0x11(%rbp),%esi
lea    0xdc5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
mov    -0xc(%rbp),%ecx
shl    $0x1,%ecx
sub    %ecx,%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1060 <intervaloRecursos@plt>
mov    -0xc(%rbp),%esi
lea    0xd78(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
movsbl -0x11(%rbp),%esi
lea    0xd8a(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1158 <cicloNomade+0x18>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cicloNomade>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
mov    %edx,%ebx
mov    %edi,%ebp
movb   $0x20,0x7(%rsp)
lea    0xe95(%rip),%r14
lea    0xe98(%rip),%r15
lea    0xeb4(%rip),%r12
lea    0xeb7(%rip),%r13
lea    0xeba(%rip),%rdi
call   1030 <puts@plt>
lea    0xed4(%rip),%rdi
call   1030 <puts@plt>
lea    0xe68(%rip),%rdi
lea    0x7(%rsp),%rsi
call   1060 <scanf@plt>
xor    %eax,%eax
call   1050 <getchar@plt>
movsbl 0x7(%rsp),%esi
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movslq %ebx,%rbx
imul   $0x2aaaaaab,%rbx,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
shr    $0x20,%rax
add    %ecx,%eax
add    %eax,%ebx
movsbl 0x7(%rsp),%esi
mov    %r12,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
sub    %ebx,%ebp
sub    %ebx,%ebp
mov    %ebp,%edi
mov    $0x1,%esi
call   1070 <intervaloRecursos@plt>
mov    %r15,%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
movsbl 0x7(%rsp),%esi
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    1180 <cicloNomade+0x30>

LLVM IR (-O0):
@.str = [39 x i8] c"\0AAperte qualquer tecla para continuar\0A\00"
@.str.1 = [25 x i8] c"\0ADigite x para encerrar\0A\00"
@.str.2 = [3 x i8] c"%c\00"
@.str.3 = [10 x i8] c"CHAR1: %c\00"
@.str.4 = [35 x i8] c"\0A Teste para saber a populacao %d\0A\00"
@.str.5 = [10 x i8] c"CHAR2: %c\00"
@.str.6 = [10 x i8] c"CHAR3: %c\00"
define void @cicloNomade(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i8
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i32 %3, i32* %8
store i8 32, i8* %9
br label %10
10: ; preds = %51, %4
%11 = load i8, i8* %9
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 120
br i1 %13, label %18, label %14
14: ; preds = %10
%15 = load i8, i8* %9
%16 = sext i8 %15 to i32
%17 = icmp ne i32 %16, 88
br label %18
18: ; preds = %14, %10
%19 = phi i1 [ true, %10 ], [ %17, %14 ]
br i1 %19, label %20, label %69
20: ; preds = %18
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([39 x i8], [39 x i8]* @.str, i64 0, i64 0))
%22 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
%23 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %9)
%24 = call i32 (...) @getchar()
%25 = load i8, i8* %9
%26 = sext i8 %25 to i32
%27 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %26)
%28 = load i32, i32* %7
%29 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i32 %28)
store i32 1, i32* %6
br i1 true, label %30, label %35
30: ; preds = %20
%31 = load i32, i32* %7
%32 = load i32, i32* %7
%33 = sdiv i32 %32, 6
%34 = add nsw i32 %31, %33
store i32 %34, i32* %7
br label %51
35: ; preds = %20
store i32 2, i32* %6
br i1 true, label %36, label %41
36: ; preds = %35
%37 = load i32, i32* %7
%38 = load i32, i32* %7
%39 = sdiv i32 %38, 18
%40 = add nsw i32 %37, %39
store i32 %40, i32* %7
br label %50
41: ; preds = %35
store i32 3, i32* %6
br i1 true, label %42, label %44
42: ; preds = %41
%43 = load i32, i32* %7
store i32 %43, i32* %7
br label %49
44: ; preds = %41
store i32 4, i32* %6
br i1 true, label %45, label %48
45: ; preds = %44
%46 = load i32, i32* %7
%47 = sdiv i32 %46, 2
store i32 %47, i32* %7
br label %48
48: ; preds = %45, %44
br label %49
49: ; preds = %48, %42
br label %50
50: ; preds = %49, %36
br label %51
51: ; preds = %50, %30
%52 = load i8, i8* %9
%53 = sext i8 %52 to i32
%54 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i32 %53)
%55 = load i32, i32* %5
%56 = load i32, i32* %7
%57 = mul nsw i32 2, %56
%58 = sub nsw i32 %55, %57
store i32 %58, i32* %5
%59 = load i32, i32* %5
%60 = load i32, i32* %6
%61 = call i32 @intervaloRecursos(i32 %59, i32 %60)
%62 = load i32, i32* %7
%63 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i32 %62)
%64 = load i32, i32* %8
%65 = add nsw i32 %64, 1
store i32 %65, i32* %8
%66 = load i8, i8* %9
%67 = sext i8 %66 to i32
%68 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i32 %67)
br label %10
69: ; preds = %18
ret void
}

LLVM IR (-O2):
@.str.2 = [3 x i8] c"%c\00"
@.str.3 = [10 x i8] c"CHAR1: %c\00"
@.str.4 = [35 x i8] c"\0A Teste para saber a populacao %d\0A\00"
@.str.5 = [10 x i8] c"CHAR2: %c\00"
@.str.6 = [10 x i8] c"CHAR3: %c\00"
@str = [38 x i8] c"\0AAperte qualquer tecla para continuar\00"
@str.7 = [24 x i8] c"\0ADigite x para encerrar\00"
define void @cicloNomade(i32 %0, i32 %1, i32 %2, i32 %3) {
%5 = alloca i8
store i8 32, i8* %5
br label %6
6: ; preds = %6, %4
%7 = phi i32 [ %0, %4 ], [ %23, %6 ]
%8 = phi i32 [ %2, %4 ], [ %18, %6 ]
%9 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @str, i64 0, i64 0))
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str.7, i64 0, i64 0))
%11 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* %5)
%12 = call i32 (...) @getchar()
%13 = load i8, i8* %5
%14 = sext i8 %13 to i32
%15 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.3, i64 0, i64 0), i32 %14)
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i32 %8)
%17 = sdiv i32 %8, 6
%18 = add nsw i32 %17, %8
%19 = load i8, i8* %5
%20 = sext i8 %19 to i32
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.5, i64 0, i64 0), i32 %20)
%22 = mul i32 %18, -2
%23 = add i32 %22, %7
%24 = call i32 @intervaloRecursos(i32 %23, i32 1)
%25 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([35 x i8], [35 x i8]* @.str.4, i64 0, i64 0), i32 %18)
%26 = load i8, i8* %5
%27 = sext i8 %26 to i32
%28 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.6, i64 0, i64 0), i32 %27)
br label %6
}