#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 generate_sequences(unsigned int *);
int /*<<< orphan*/ printf(char *, ...);
int scanf(char *, unsigned int *, unsigned int *, unsigned int *,
          unsigned int *);
int main(void) {
  unsigned values[4];
  printf("Enter n1, n2, n3 and n4\n");
  printf("> ");
  while (scanf("%u%u%u%u", &values[0], &values[1], &values[2], &values[3]) ==
         4) {
    printf("There are %u possible sequences\n", generate_sequences(values));
    printf("> ");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec5(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0x20(%rbp),%rsi
lea    -0x20(%rbp),%rdx
add    $0x4,%rdx
lea    -0x20(%rbp),%rcx
add    $0x8,%rcx
lea    -0x20(%rbp),%r8
add    $0xc,%r8
lea    0xe9e(%rip),%rdi
call   1040 <scanf@plt>
cmp    $0x4,%eax
jne    11b8 <main+0x88>
lea    -0x20(%rbp),%rdi
call   1050 <generate_sequences@plt>
mov    %eax,%esi
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe6d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    115b <main+0x2b>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x18,%rsp
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
lea    0xe9f(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
lea    0x4(%rsp),%rdx
lea    0x8(%rsp),%rcx
lea    0xc(%rsp),%r8
lea    0xe85(%rip),%rdi
mov    %rsp,%rsi
mov    %rcx,%r12
mov    %r8,%r15
call   1050 <scanf@plt>
cmp    $0x4,%eax
jne    11e9 <main+0xa9>
mov    %rsp,%rbx
lea    0xe71(%rip),%r13
lea    0xe5e(%rip),%rbp
lea    0xe5a(%rip),%r14
nopl   0x0(%rax)
mov    %rbx,%rdi
call   1060 <generate_sequences@plt>
mov    %r13,%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %rbp,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
lea    0x4(%rsp),%rdx
mov    %r12,%rcx
mov    %r15,%r8
call   1050 <scanf@plt>
cmp    $0x4,%eax
je     11b0 <main+0x70>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Enter n1, n2, n3 and n4\0A\00"
@.str.1 = [3 x i8] c"> \00"
@.str.2 = [9 x i8] c"%u%u%u%u\00"
@.str.3 = [33 x i8] c"There are %u possible sequences\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [4 x i32]
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %5
5: ; preds = %12, %0
%6 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 0
%7 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 1
%8 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 2
%9 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 3
%10 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32* %6, i32* %7, i32* %8, i32* %9)
%11 = icmp eq i32 %10, 4
br i1 %11, label %12, label %17
12: ; preds = %5
%13 = getelementptr inbounds [4 x i32], [4 x i32]* %2, i64 0, i64 0
%14 = call i32 @generate_sequences(i32* %13)
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i32 %14)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
br label %5
17: ; preds = %5
ret i32 0
}

LLVM IR (-O2):
@.str.1 = [3 x i8] c"> \00"
@.str.2 = [9 x i8] c"%u%u%u%u\00"
@.str.3 = [33 x i8] c"There are %u possible sequences\0A\00"
@str = [24 x i8] c"Enter n1, n2, n3 and n4\00"
define i32 @main() {
%1 = alloca [4 x i32]
%2 = bitcast [4 x i32]* %1 to i8*
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%5 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 0
%6 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 1
%7 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 2
%8 = getelementptr inbounds [4 x i32], [4 x i32]* %1, i64 0, i64 3
%9 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32* %5, i32* %6, i32* %7, i32* %8)
%10 = icmp eq i32 %9, 4
br i1 %10, label %11, label %17
11: ; preds = %0, %11
%12 = call i32 @generate_sequences(i32* %5)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([33 x i8], [33 x i8]* @.str.3, i64 0, i64 0), i32 %12)
%14 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0))
%15 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.2, i64 0, i64 0), i32* %5, i32* %6, i32* %7, i32* %8)
%16 = icmp eq i32 %15, 4
br i1 %16, label %11, label %17
17: ; preds = %11, %0
ret i32 0
}