#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;
  int parell = 0;
  printf("Introdueix la serie de nombres a comprobar si son senars.\n");
  scanf("%d", &n);
  while (n) {
    if (!parell) {
      if (n % 2 == 0) {
        parell = 1;
      }
    }
    scanf("%d", &n);
  }
  if (!parell) {
    printf("Cada element de la sequencia era un nombre senar.\n");
  } else {
    printf("No tots els elements de la sequencia eren senars.\n");
  }
  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
call   1030 <printf@plt>
lea    0xef2(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmpl   $0x0,-0x8(%rbp)
je     119b <main+0x7b>
cmpl   $0x0,-0xc(%rbp)
jne    1186 <main+0x66>
mov    -0x8(%rbp),%eax
mov    $0x2,%ecx
cltd
idiv   %ecx
cmp    $0x0,%edx
jne    1181 <main+0x61>
movl   $0x1,-0xc(%rbp)
jmp    1186 <main+0x66>
lea    0xeae(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
jmp    1152 <main+0x32>
cmpl   $0x0,-0xc(%rbp)
jne    11b6 <main+0x96>
lea    0xe92(%rip),%rdi
call   1030 <printf@plt>
jmp    11c2 <main+0xa2>
lea    0xeb4(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
lea    0xed5(%rip),%rdi
call   1030 <puts@plt>
lea    0xec6(%rip),%rdi
lea    0x4(%rsp),%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
je     1196 <main+0x76>
xor    %ebp,%ebp
mov    $0x1,%r15d
lea    0xea5(%rip),%r14
lea    0x4(%rsp),%rbx
not    %eax
and    $0x1,%eax
test   %ebp,%ebp
mov    %eax,%ebp
cmovne %r15d,%ebp
mov    %r14,%rdi
mov    %rbx,%rsi
call   1040 <scanf@plt>
mov    0x4(%rsp),%eax
test   %eax,%eax
jne    1160 <main+0x40>
test   %ebp,%ebp
lea    0xeb4(%rip),%rax
lea    0xedf(%rip),%rdi
cmove  %rax,%rdi
jmp    119d <main+0x7d>
lea    0xea0(%rip),%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [59 x i8] c"Introdueix la serie de nombres a comprobar si son senars.\0A\00"
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [51 x i8] c"Cada element de la sequencia era un nombre senar.\0A\00"
@.str.3 = [51 x i8] c"No tots els elements de la sequencia eren senars.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %3
%4 = call i32 @printf(i8* getelementptr inbounds ([59 x i8], [59 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
br label %6
6: ; preds = %18, %0
%7 = load i32, i32* %2
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %20
9: ; preds = %6
%10 = load i32, i32* %3
%11 = icmp ne i32 %10, 0
br i1 %11, label %18, label %12
12: ; preds = %9
%13 = load i32, i32* %2
%14 = srem i32 %13, 2
%15 = icmp eq i32 %14, 0
br i1 %15, label %16, label %17
16: ; preds = %12
store i32 1, i32* %3
br label %17
17: ; preds = %16, %12
br label %18
18: ; preds = %17, %9
%19 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
br label %6
20: ; preds = %6
%21 = load i32, i32* %3
%22 = icmp ne i32 %21, 0
br i1 %22, label %25, label %23
23: ; preds = %20
%24 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.2, i64 0, i64 0))
br label %27
25: ; preds = %20
%26 = call i32 @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.3, i64 0, i64 0))
br label %27
27: ; preds = %25, %23
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"%d\00"
@str = [58 x i8] c"Introdueix la serie de nombres a comprobar si son senars.\00"
@str.4 = [50 x i8] c"Cada element de la sequencia era un nombre senar.\00"
@str.5 = [50 x i8] c"No tots els elements de la sequencia eren senars.\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([58 x i8], [58 x i8]* @str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = load i32, i32* %1
%6 = icmp eq i32 %5, 0
br i1 %6, label %20, label %7
7: ; preds = %0, %7
%8 = phi i32 [ %15, %7 ], [ %5, %0 ]
%9 = phi i32 [ %13, %7 ], [ 0, %0 ]
%10 = icmp eq i32 %9, 0
%11 = and i32 %8, 1
%12 = xor i32 %11, 1
%13 = select i1 %10, i32 %12, i32 1
%14 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%15 = load i32, i32* %1
%16 = icmp eq i32 %15, 0
br i1 %16, label %17, label %7
17: ; preds = %7
%18 = icmp eq i32 %13, 0
%19 = select i1 %18, i8* getelementptr inbounds ([50 x i8], [50 x i8]* @str.4, i64 0, i64 0), i8* getelementptr inbounds ([50 x i8], [50 x i8]* @str.5, i64 0, i64 0)
br label %20
20: ; preds = %17, %0
%21 = phi i8* [ getelementptr inbounds ([50 x i8], [50 x i8]* @str.4, i64 0, i64 0), %0 ], [ %19, %17 ]
%22 = call i32 @puts(i8* dereferenceable(1) %21)
ret i32 0
}