#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 faktorial(int);
int /*<<< orphan*/ fgets(char *, int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sscanf(char *, char *, int *);
int /*<<< orphan*/ stdin;
int main(int argc, char *argv[]) {
  int n, m, emaitz;
  char str[128];
  printf("Zenbat elementu nahi zenituzke konbinatu: ");
  fgets(str, 128, stdin);
  sscanf(str, "%d", &n);
  printf("zenbatnaka: ");
  fgets(str, 128, stdin);
  sscanf(str, "%d", &m);
  emaitz = faktorial(n) / faktorial(m) / faktorial(n - m);
  printf("%d elementu %d naka konbinatzeko %d aukera daude\n", n, m, emaitz);
  printf("Sakatu \"return\" amaitzeko .....");
  fgets(str, 128, stdin);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xea0(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xa0(%rbp),%rdi
mov    0x2e73(%rip),%rax
mov    (%rax),%edx
mov    $0x80,%esi
call   1040 <fgets@plt>
lea    -0xa0(%rbp),%rdi
lea    0xe9c(%rip),%rsi
lea    -0x14(%rbp),%rdx
call   1060 <sscanf@plt>
lea    0xe8f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xa0(%rbp),%rdi
mov    0x2e34(%rip),%rax
mov    (%rax),%edx
mov    $0x80,%esi
call   1040 <fgets@plt>
lea    -0xa0(%rbp),%rdi
lea    0xe5d(%rip),%rsi
lea    -0x18(%rbp),%rdx
call   1060 <sscanf@plt>
mov    -0x14(%rbp),%edi
call   1050 <faktorial@plt>
mov    %eax,-0xa8(%rbp)
mov    -0x18(%rbp),%edi
call   1050 <faktorial@plt>
mov    %eax,%ecx
mov    -0xa8(%rbp),%eax
cltd
idiv   %ecx
mov    %eax,-0xa4(%rbp)
mov    -0x14(%rbp),%edi
sub    -0x18(%rbp),%edi
call   1050 <faktorial@plt>
mov    %eax,%ecx
mov    -0xa4(%rbp),%eax
cltd
idiv   %ecx
mov    %eax,-0x1c(%rbp)
mov    -0x14(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x1c(%rbp),%ecx
lea    0xe14(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xe38(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    -0xa0(%rbp),%rdi
mov    0x2d9e(%rip),%rax
mov    (%rax),%edx
mov    $0x80,%esi
call   1040 <fgets@plt>
xor    %eax,%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0x90,%rsp
lea    0xead(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x2e87(%rip),%r15
mov    (%r15),%edx
lea    0x10(%rsp),%r14
mov    %r14,%rdi
mov    $0x80,%esi
call   1040 <fgets@plt>
lea    0xeae(%rip),%rbx
lea    0xc(%rsp),%rdx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <sscanf@plt>
lea    0xe9a(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%r15),%edx
mov    %r14,%rdi
mov    $0x80,%esi
call   1040 <fgets@plt>
lea    0x8(%rsp),%rdx
mov    %r14,%rdi
mov    %rbx,%rsi
call   1060 <sscanf@plt>
mov    0xc(%rsp),%edi
call   1050 <faktorial@plt>
mov    %eax,%ebx
mov    0x8(%rsp),%edi
call   1050 <faktorial@plt>
mov    %eax,%ecx
mov    %ebx,%eax
cltd
idiv   %ecx
mov    %eax,%ebx
mov    0xc(%rsp),%edi
sub    0x8(%rsp),%edi
call   1050 <faktorial@plt>
mov    %eax,%ecx
mov    %ebx,%eax
cltd
idiv   %ecx
mov    0xc(%rsp),%esi
mov    0x8(%rsp),%edx
lea    0xe40(%rip),%rdi
mov    %eax,%ecx
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xe62(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    (%r15),%edx
mov    %r14,%rdi
mov    $0x80,%esi
call   1040 <fgets@plt>
xor    %eax,%eax
add    $0x90,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [43 x i8] c"Zenbat elementu nahi zenituzke konbinatu: \00"
@stdin = global i32 0
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [13 x i8] c"zenbatnaka: \00"
@.str.3 = [50 x i8] c"%d elementu %d naka konbinatzeko %d aukera daude\0A\00"
@.str.4 = [32 x i8] c"Sakatu \22return\22 amaitzeko .....\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca [128 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%11 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%12 = load i32, i32* @stdin
%13 = call i32 @fgets(i8* %11, i32 128, i32 %12)
%14 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%15 = call i32 @sscanf(i8* %14, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %6)
%16 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%17 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%18 = load i32, i32* @stdin
%19 = call i32 @fgets(i8* %17, i32 128, i32 %18)
%20 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%21 = call i32 @sscanf(i8* %20, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %7)
%22 = load i32, i32* %6
%23 = call i32 @faktorial(i32 %22)
%24 = load i32, i32* %7
%25 = call i32 @faktorial(i32 %24)
%26 = sdiv i32 %23, %25
%27 = load i32, i32* %6
%28 = load i32, i32* %7
%29 = sub nsw i32 %27, %28
%30 = call i32 @faktorial(i32 %29)
%31 = sdiv i32 %26, %30
store i32 %31, i32* %8
%32 = load i32, i32* %6
%33 = load i32, i32* %7
%34 = load i32, i32* %8
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([50 x i8], [50 x i8]* @.str.3, i64 0, i64 0), i32 %32, i32 %33, i32 %34)
%36 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0))
%37 = getelementptr inbounds [128 x i8], [128 x i8]* %9, i64 0, i64 0
%38 = load i32, i32* @stdin
%39 = call i32 @fgets(i8* %37, i32 128, i32 %38)
ret i32 0
}

LLVM IR (-O2):
@.str = [43 x i8] c"Zenbat elementu nahi zenituzke konbinatu: \00"
@stdin = global i32 0
@.str.1 = [3 x i8] c"%d\00"
@.str.2 = [13 x i8] c"zenbatnaka: \00"
@.str.3 = [50 x i8] c"%d elementu %d naka konbinatzeko %d aukera daude\0A\00"
@.str.4 = [32 x i8] c"Sakatu \22return\22 amaitzeko .....\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca [128 x i8]
%6 = bitcast i32* %3 to i8*
%7 = bitcast i32* %4 to i8*
%8 = getelementptr inbounds [128 x i8], [128 x i8]* %5, i64 0, i64 0
%9 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([43 x i8], [43 x i8]* @.str, i64 0, i64 0))
%10 = load i32, i32* @stdin
%11 = call i32 @fgets(i8* %8, i32 128, i32 %10)
%12 = call i32 @sscanf(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %3)
%13 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @.str.2, i64 0, i64 0))
%14 = load i32, i32* @stdin
%15 = call i32 @fgets(i8* %8, i32 128, i32 %14)
%16 = call i32 @sscanf(i8* %8, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %4)
%17 = load i32, i32* %3
%18 = call i32 @faktorial(i32 %17)
%19 = load i32, i32* %4
%20 = call i32 @faktorial(i32 %19)
%21 = sdiv i32 %18, %20
%22 = load i32, i32* %3
%23 = load i32, i32* %4
%24 = sub nsw i32 %22, %23
%25 = call i32 @faktorial(i32 %24)
%26 = sdiv i32 %21, %25
%27 = load i32, i32* %3
%28 = load i32, i32* %4
%29 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([50 x i8], [50 x i8]* @.str.3, i64 0, i64 0), i32 %27, i32 %28, i32 %26)
%30 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([32 x i8], [32 x i8]* @.str.4, i64 0, i64 0))
%31 = load i32, i32* @stdin
%32 = call i32 @fgets(i8* %8, i32 128, i32 %31)
ret i32 0
}