#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 atoi(char *);
char getchar();
int /*<<< orphan*/ printf(char *, int);
int main(void) {
  int input, t;
  int even = 0;
  int oneven = 0;
  char s[25];
  for (t = 0; (s[t] = getchar()) != '\n'; t++)
    ;
  s[t] = '\0';
  input = atoi(s);
  printf("ingelezen getal: %d\n", input);
  even = input * (input - 1);
  oneven = input * input;
  printf("even: %d\n", even);
  printf("oneven: %d\n", oneven);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0xc(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
movslq -0xc(%rbp),%rcx
mov    %al,-0x30(%rbp,%rcx,1)
movsbl %al,%eax
cmp    $0xa,%eax
je     1182 <main+0x52>
jmp    1174 <main+0x44>
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1154 <main+0x24>
movslq -0xc(%rbp),%rax
movb   $0x0,-0x30(%rbp,%rax,1)
lea    -0x30(%rbp),%rdi
call   1050 <atoi@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xe5f(%rip),%rdi
call   1030 <printf@plt>
mov    -0x8(%rbp),%eax
mov    -0x8(%rbp),%ecx
sub    $0x1,%ecx
imul   %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%eax
imul   -0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x10(%rbp),%esi
lea    0xe4e(%rip),%rdi
call   1030 <printf@plt>
mov    -0x14(%rbp),%esi
lea    0xe3d(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
mov    $0xffffffffffffffff,%rbx
nopl   0x0(%rax)
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %al,0x1(%rsp,%rbx,1)
add    $0x1,%rbx
cmp    $0xa,%al
jne    1140 <main+0x10>
mov    %ebx,%eax
movb   $0x0,(%rsp,%rax,1)
mov    %rsp,%rdi
call   1050 <atoi@plt>
mov    %eax,%ebx
lea    0xe96(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
lea    -0x1(%rbx),%esi
imul   %ebx,%esi
imul   %ebx,%ebx
lea    0xe96(%rip),%rdi
call   1030 <printf@plt>
lea    0xe88(%rip),%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [21 x i8] c"ingelezen getal: %d\0A\00"
@.str.1 = [10 x i8] c"even: %d\0A\00"
@.str.2 = [12 x i8] c"oneven: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca [25 x i8]
store i32 0, i32* %1
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %3
br label %7
7: ; preds = %15, %0
%8 = call signext i8 (...) @getchar()
%9 = load i32, i32* %3
%10 = sext i32 %9 to i64
%11 = getelementptr inbounds [25 x i8], [25 x i8]* %6, i64 0, i64 %10
store i8 %8, i8* %11
%12 = sext i8 %8 to i32
%13 = icmp ne i32 %12, 10
br i1 %13, label %14, label %18
14: ; preds = %7
br label %15
15: ; preds = %14
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
br label %7
18: ; preds = %7
%19 = load i32, i32* %3
%20 = sext i32 %19 to i64
%21 = getelementptr inbounds [25 x i8], [25 x i8]* %6, i64 0, i64 %20
store i8 0, i8* %21
%22 = getelementptr inbounds [25 x i8], [25 x i8]* %6, i64 0, i64 0
%23 = call i32 @atoi(i8* %22)
store i32 %23, i32* %2
%24 = load i32, i32* %2
%25 = call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %24)
%26 = load i32, i32* %2
%27 = load i32, i32* %2
%28 = sub nsw i32 %27, 1
%29 = mul nsw i32 %26, %28
store i32 %29, i32* %4
%30 = load i32, i32* %2
%31 = load i32, i32* %2
%32 = mul nsw i32 %30, %31
store i32 %32, i32* %5
%33 = load i32, i32* %4
%34 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %33)
%35 = load i32, i32* %5
%36 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %35)
%37 = load i32, i32* %1
ret i32 %37
}

LLVM IR (-O2):
@.str = [21 x i8] c"ingelezen getal: %d\0A\00"
@.str.1 = [10 x i8] c"even: %d\0A\00"
@.str.2 = [12 x i8] c"oneven: %d\0A\00"
define i32 @main() {
%1 = alloca [25 x i8]
%2 = getelementptr inbounds [25 x i8], [25 x i8]* %1, i64 0, i64 0
br label %3
3: ; preds = %3, %0
%4 = phi i64 [ %8, %3 ], [ 0, %0 ]
%5 = tail call signext i8 (...) @getchar()
%6 = getelementptr inbounds [25 x i8], [25 x i8]* %1, i64 0, i64 %4
store i8 %5, i8* %6
%7 = icmp eq i8 %5, 10
%8 = add nuw i64 %4, 1
br i1 %7, label %9, label %3
9: ; preds = %3
%10 = and i64 %4, 4294967295
%11 = getelementptr inbounds [25 x i8], [25 x i8]* %1, i64 0, i64 %10
store i8 0, i8* %11
%12 = call i32 @atoi(i8* %2)
%13 = tail call i32 @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i32 %12)
%14 = add nsw i32 %12, -1
%15 = mul nsw i32 %14, %12
%16 = mul nsw i32 %12, %12
%17 = tail call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.1, i64 0, i64 0), i32 %15)
%18 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.2, i64 0, i64 0), i32 %16)
ret i32 0
}