#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 *);
int cijfersom(int, int *);
char getchar();
int /*<<< orphan*/ printf(char *, ...);
int main(void) {
  int t, e, s = 0, *r;
  char getal[10];
  r = &s;
  printf("voer getal in: ");
  for (t = 0; (getal[t] = getchar()) != '\n'; t++)
    ;
  getal[t] = '\0';
  e = atoi(getal);
  printf("\nde som van de getallen is: %d\n", cijfersom(e, r));
  printf("\nde som van de getallen is: %d\n", *r);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x10(%rbp)
lea    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
lea    0xe9b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x8(%rbp)
mov    $0x0,%al
call   1040 <getchar@plt>
movslq -0x8(%rbp),%rcx
mov    %al,-0x22(%rbp,%rcx,1)
movsbl %al,%eax
cmp    $0xa,%eax
je     11a1 <main+0x61>
jmp    1193 <main+0x53>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1173 <main+0x33>
movslq -0x8(%rbp),%rax
movb   $0x0,-0x22(%rbp,%rax,1)
lea    -0x22(%rbp),%rdi
call   1060 <atoi@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
mov    -0x18(%rbp),%rsi
call   1050 <cijfersom@plt>
mov    %eax,%esi
lea    0xe45(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
lea    0xe31(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0x0,(%rsp)
lea    0xead(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    $0xffffffffffffffff,%rbx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1040 <getchar@plt>
mov    %al,0x7(%rsp,%rbx,1)
add    $0x1,%rbx
cmp    $0xa,%al
jne    1170 <main+0x30>
mov    %ebx,%eax
movb   $0x0,0x6(%rsp,%rax,1)
lea    0x6(%rsp),%rdi
call   1060 <atoi@plt>
mov    %rsp,%rsi
mov    %eax,%edi
call   1050 <cijfersom@plt>
lea    0xe6b(%rip),%rbx
mov    %rbx,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%rsp),%esi
mov    %rbx,%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

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

LLVM IR (-O2):
@.str = [16 x i8] c"voer getal in: \00"
@.str.1 = [32 x i8] c"\0Ade som van de getallen is: %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i8]
%3 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%4 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0))
br label %6
6: ; preds = %6, %0
%7 = phi i64 [ %11, %6 ], [ 0, %0 ]
%8 = tail call signext i8 (...) @getchar()
%9 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 %7
store i8 %8, i8* %9
%10 = icmp eq i8 %8, 10
%11 = add nuw i64 %7, 1
br i1 %10, label %12, label %6
12: ; preds = %6
%13 = and i64 %7, 4294967295
%14 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 %13
store i8 0, i8* %14
%15 = call i32 @atoi(i8* %4)
%16 = call i32 @cijfersom(i32 %15, i32* %1)
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %16)
%18 = load i32, i32* %1
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.1, i64 0, i64 0), i32 %18)
ret i32 0
}