#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 *, ...);
main() {
  int inteiro, total = 0;
  char resposta;
inicio:
  printf("\nDigite um valor inteiro: ");
  scanf("%d", &inteiro);
  if ((inteiro % 2) == 0)
    total = total + inteiro;
  else {
    printf("Erro: Numero digitado é impar\n\n");
    goto inicio;
  }
  printf("\nRepetir (S/n)? ");
  scanf("%s", &resposta);
  if (resposta != 'N')
    goto inicio;
  else
    printf("\nTotal: %d", total);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xec3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xf0d(%rip),%rdi
lea    -0x8(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1178 <main+0x58>
mov    -0xc(%rbp),%eax
add    -0x8(%rbp),%eax
mov    %eax,-0xc(%rbp)
jmp    118b <main+0x6b>
lea    0xe9c(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    1136 <main+0x16>
lea    0xeaa(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xead(%rip),%rdi
lea    -0xd(%rbp),%rsi
mov    $0x0,%al
call   1040 <scanf@plt>
movsbl -0xd(%rbp),%eax
cmp    $0x4e,%eax
je     11bd <main+0x9d>
jmp    1136 <main+0x16>
mov    -0xc(%rbp),%esi
lea    0xe89(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
push   %rax
lea    0xebe(%rip),%r15
lea    0xeee(%rip),%rbp
lea    0x4(%rsp),%rbx
lea    0x3(%rsp),%r12
lea    0xee0(%rip),%r13
xor    %r14d,%r14d
jmp    1168 <main+0x38>
nop
mov    %r13,%rdi
call   1030 <puts@plt>
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbp,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
mov    0x4(%rsp),%eax
test   $0x1,%al
jne    1160 <main+0x30>
add    %eax,%r14d
lea    0xe8a(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xe8d(%rip),%rdi
mov    %r12,%rsi
xor    %eax,%eax
call   1050 <scanf@plt>
cmpb   $0x4e,0x3(%rsp)
jne    1168 <main+0x38>
lea    0xe78(%rip),%rdi
mov    %r14d,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [27 x i8] c"\0ADigite um valor inteiro: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [33 x i8] c"Erro: Numero digitado \C3\A9 impar\0A\0A\00"
@.str.3 = [17 x i8] c"\0ARepetir (S/n)? \00"
@.str.4 = [3 x i8] c"%s\00"
@.str.5 = [11 x i8] c"\0ATotal: %d\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i8
store i32 0, i32* %1
store i32 0, i32* %3
br label %5
5: ; preds = %23, %15, %0
%6 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%8 = load i32, i32* %2
%9 = srem i32 %8, 2
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %15
11: ; preds = %5
%12 = load i32, i32* %3
%13 = load i32, i32* %2
%14 = add nsw i32 %12, %13
store i32 %14, i32* %3
br label %17
15: ; preds = %5
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.2, i64 0, i64 0))
br label %5
17: ; preds = %11
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%19 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %4)
%20 = load i8, i8* %4
%21 = sext i8 %20 to i32
%22 = icmp ne i32 %21, 78
br i1 %22, label %23, label %24
23: ; preds = %17
br label %5
24: ; preds = %17
%25 = load i32, i32* %3
%26 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i32 %25)
br label %27
27: ; preds = %24
%28 = load i32, i32* %1
ret i32 %28
}

LLVM IR (-O2):
@.str = [27 x i8] c"\0ADigite um valor inteiro: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [17 x i8] c"\0ARepetir (S/n)? \00"
@.str.4 = [3 x i8] c"%s\00"
@.str.5 = [11 x i8] c"\0ATotal: %d\00"
@str = [32 x i8] c"Erro: Numero digitado \C3\A9 impar\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8
%3 = bitcast i32* %1 to i8*
br label %4
4: ; preds = %11, %0
%5 = phi i32 [ %13, %11 ], [ 0, %0 ]
%6 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%7 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%8 = load i32, i32* %1
%9 = and i32 %8, 1
%10 = icmp eq i32 %9, 0
br i1 %10, label %11, label %18
11: ; preds = %18, %4
%12 = phi i32 [ %8, %4 ], [ %22, %18 ]
%13 = add nsw i32 %12, %5
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([17 x i8], [17 x i8]* @.str.3, i64 0, i64 0))
%15 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), i8* %2)
%16 = load i8, i8* %2
%17 = icmp eq i8 %16, 78
br i1 %17, label %25, label %4
18: ; preds = %4, %18
%19 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @str, i64 0, i64 0))
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str, i64 0, i64 0))
%21 = call i32 (i8*, ...) @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%22 = load i32, i32* %1
%23 = and i32 %22, 1
%24 = icmp eq i32 %23, 0
br i1 %24, label %11, label %18
25: ; preds = %11
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.5, i64 0, i64 0), i32 %13)
ret i32 0
}