#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 *, int *);
int main() {
  int n, a;
  a = 0;
  do {
    printf("Introduzca un numero entero: ");
    scanf("%d", &n);
    if (n == 0) {
      printf("ERROR: El cero es su mismo opuesto.\n");
      break;
    }
    printf("El opuesto es: %d\n", -n);
    a += n;
  } while (n >= -10 && n <= 10);
  printf("Suma: %d\n", a);
  return 0;
}


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    0xed3(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
jne    1171 <main+0x51>
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11b1 <main+0x91>
xor    %esi,%esi
sub    -0x8(%rbp),%esi
lea    0xec9(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
add    -0xc(%rbp),%eax
mov    %eax,-0xc(%rbp)
xor    %eax,%eax
cmpl   $0xfffffff6,-0x8(%rbp)
mov    %al,-0xd(%rbp)
jl     11a6 <main+0x86>
cmpl   $0xa,-0x8(%rbp)
setle  %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    1136 <main+0x16>
mov    -0xc(%rbp),%esi
lea    0xe9e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x10,%rsp
lea    0xebc(%rip),%r14
lea    0xed3(%rip),%r15
lea    0xc(%rsp),%r12
lea    0xeca(%rip),%r13
xor    %ebx,%ebx
nopl   0x0(%rax)
mov    %r14,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r15,%rdi
mov    %r12,%rsi
call   1050 <scanf@plt>
mov    0xc(%rsp),%esi
test   %esi,%esi
je     1199 <main+0x69>
neg    %esi
mov    %r13,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    0xc(%rsp),%eax
add    %eax,%ebx
add    $0xa,%eax
cmp    $0x15,%eax
jb     1160 <main+0x30>
jmp    11a5 <main+0x75>
lea    0xe9e(%rip),%rdi
call   1030 <puts@plt>
lea    0xe88(%rip),%rdi
mov    %ebx,%esi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [30 x i8] c"Introduzca un numero entero: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [37 x i8] c"ERROR: El cero es su mismo opuesto.\0A\00"
@.str.3 = [19 x i8] c"El opuesto es: %d\0A\00"
@.str.4 = [10 x i8] c"Suma: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
br label %4
4: ; preds = %24, %0
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([30 x i8], [30 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), i32* %2)
%7 = load i32, i32* %2
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %4
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str.2, i64 0, i64 0))
br label %26
11: ; preds = %4
%12 = load i32, i32* %2
%13 = sub nsw i32 0, %12
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 %13)
%15 = load i32, i32* %2
%16 = load i32, i32* %3
%17 = add nsw i32 %16, %15
store i32 %17, i32* %3
br label %18
18: ; preds = %11
%19 = load i32, i32* %2
%20 = icmp sge i32 %19, -10
br i1 %20, label %21, label %24
21: ; preds = %18
%22 = load i32, i32* %2
%23 = icmp sle i32 %22, 10
br label %24
24: ; preds = %21, %18
%25 = phi i1 [ false, %18 ], [ %23, %21 ]
br i1 %25, label %4, label %26
26: ; preds = %24, %9
%27 = load i32, i32* %3
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 %27)
ret i32 0
}

LLVM IR (-O2):
@.str = [30 x i8] c"Introduzca un numero entero: \00"
@.str.1 = [3 x i8] c"%d\00"
@.str.3 = [19 x i8] c"El opuesto es: %d\0A\00"
@.str.4 = [10 x i8] c"Suma: %d\0A\00"
@str = [36 x i8] c"ERROR: El cero es su mismo opuesto.\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
br label %3
3: ; preds = %11, %0
%4 = phi i32 [ 0, %0 ], [ %15, %11 ]
%5 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 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), i32* %1)
%7 = load i32, i32* %1
%8 = icmp eq i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %3
%10 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
br label %18
11: ; preds = %3
%12 = sub nsw i32 0, %7
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @.str.3, i64 0, i64 0), i32 %12)
%14 = load i32, i32* %1
%15 = add nsw i32 %14, %4
%16 = add i32 %14, 10
%17 = icmp ult i32 %16, 21
br i1 %17, label %3, label %18
18: ; preds = %11, %9
%19 = phi i32 [ %4, %9 ], [ %15, %11 ]
%20 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.4, i64 0, i64 0), i32 %19)
ret i32 0
}