#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 */
typedef long int32_t;
typedef int int16_t;

/* Variables and functions */
long L_add(long, int /*<<< orphan*/);
int /*<<< orphan*/ L_deposit_l(int /*<<< orphan*/);
long L_shr(long, int);
int /*<<< orphan*/ Random(int *);
int extract_l(long);
int16_t Gauss(int16_t *seed) {
  int16_t i;
  int16_t temp;
  int32_t L_acc;
  L_acc = 0L;
  for (i = 0; i < 12; i++) {
    L_acc = L_add(L_acc, L_deposit_l(Random(seed)));
  }
  L_acc = L_shr(L_acc, 7);
  temp = extract_l(L_acc);
  return (temp);
}


x86 assembly (clang, -O0):
<Gauss>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x18(%rbp)
movl   $0x0,-0xc(%rbp)
cmpl   $0xc,-0xc(%rbp)
jge    11aa <Gauss+0x5a>
mov    -0x18(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <Random@plt>
mov    %eax,%edi
call   1050 <L_deposit_l@plt>
mov    -0x20(%rbp),%rdi
mov    %eax,%esi
call   1060 <L_add@plt>
mov    %rax,-0x18(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    116b <Gauss+0x1b>
mov    -0x18(%rbp),%rdi
mov    $0x7,%esi
call   1070 <L_shr@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <extract_l@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Gauss>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%rbx
call   1040 <Random@plt>
mov    %eax,%edi
call   1050 <L_deposit_l@plt>
xor    %edi,%edi
mov    %eax,%esi
call   1060 <L_add@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1040 <Random@plt>
mov    %eax,%edi
call   1050 <L_deposit_l@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1060 <L_add@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1040 <Random@plt>
mov    %eax,%edi
call   1050 <L_deposit_l@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1060 <L_add@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1040 <Random@plt>
mov    %eax,%edi
call   1050 <L_deposit_l@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1060 <L_add@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1040 <Random@plt>
mov    %eax,%edi
call   1050 <L_deposit_l@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1060 <L_add@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1040 <Random@plt>
mov    %eax,%edi
call   1050 <L_deposit_l@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1060 <L_add@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1040 <Random@plt>
mov    %eax,%edi
call   1050 <L_deposit_l@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1060 <L_add@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1040 <Random@plt>
mov    %eax,%edi
call   1050 <L_deposit_l@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1060 <L_add@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1040 <Random@plt>
mov    %eax,%edi
call   1050 <L_deposit_l@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1060 <L_add@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1040 <Random@plt>
mov    %eax,%edi
call   1050 <L_deposit_l@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1060 <L_add@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1040 <Random@plt>
mov    %eax,%edi
call   1050 <L_deposit_l@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1060 <L_add@plt>
mov    %rax,%r14
mov    %rbx,%rdi
call   1040 <Random@plt>
mov    %eax,%edi
call   1050 <L_deposit_l@plt>
mov    %r14,%rdi
mov    %eax,%esi
call   1060 <L_add@plt>
mov    %rax,%rdi
mov    $0x7,%esi
call   1070 <L_shr@plt>
mov    %rax,%rdi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <extract_l@plt>

LLVM IR (-O0):
define i32 @Gauss(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i64
store i32* %0, i32** %2
store i64 0, i64* %5
store i32 0, i32* %3
br label %6
6: ; preds = %15, %1
%7 = load i32, i32* %3
%8 = icmp slt i32 %7, 12
br i1 %8, label %9, label %18
9: ; preds = %6
%10 = load i64, i64* %5
%11 = load i32*, i32** %2
%12 = call i32 @Random(i32* %11)
%13 = call i32 @L_deposit_l(i32 %12)
%14 = call i64 @L_add(i64 %10, i32 %13)
store i64 %14, i64* %5
br label %15
15: ; preds = %9
%16 = load i32, i32* %3
%17 = add nsw i32 %16, 1
store i32 %17, i32* %3
br label %6
18: ; preds = %6
%19 = load i64, i64* %5
%20 = call i64 @L_shr(i64 %19, i32 7)
store i64 %20, i64* %5
%21 = load i64, i64* %5
%22 = call i32 @extract_l(i64 %21)
store i32 %22, i32* %4
%23 = load i32, i32* %4
ret i32 %23
}

LLVM IR (-O2):
define i32 @Gauss(i32* %0) {
%2 = tail call i32 @Random(i32* %0)
%3 = tail call i32 @L_deposit_l(i32 %2)
%4 = tail call i64 @L_add(i64 0, i32 %3)
%5 = tail call i32 @Random(i32* %0)
%6 = tail call i32 @L_deposit_l(i32 %5)
%7 = tail call i64 @L_add(i64 %4, i32 %6)
%8 = tail call i32 @Random(i32* %0)
%9 = tail call i32 @L_deposit_l(i32 %8)
%10 = tail call i64 @L_add(i64 %7, i32 %9)
%11 = tail call i32 @Random(i32* %0)
%12 = tail call i32 @L_deposit_l(i32 %11)
%13 = tail call i64 @L_add(i64 %10, i32 %12)
%14 = tail call i32 @Random(i32* %0)
%15 = tail call i32 @L_deposit_l(i32 %14)
%16 = tail call i64 @L_add(i64 %13, i32 %15)
%17 = tail call i32 @Random(i32* %0)
%18 = tail call i32 @L_deposit_l(i32 %17)
%19 = tail call i64 @L_add(i64 %16, i32 %18)
%20 = tail call i32 @Random(i32* %0)
%21 = tail call i32 @L_deposit_l(i32 %20)
%22 = tail call i64 @L_add(i64 %19, i32 %21)
%23 = tail call i32 @Random(i32* %0)
%24 = tail call i32 @L_deposit_l(i32 %23)
%25 = tail call i64 @L_add(i64 %22, i32 %24)
%26 = tail call i32 @Random(i32* %0)
%27 = tail call i32 @L_deposit_l(i32 %26)
%28 = tail call i64 @L_add(i64 %25, i32 %27)
%29 = tail call i32 @Random(i32* %0)
%30 = tail call i32 @L_deposit_l(i32 %29)
%31 = tail call i64 @L_add(i64 %28, i32 %30)
%32 = tail call i32 @Random(i32* %0)
%33 = tail call i32 @L_deposit_l(i32 %32)
%34 = tail call i64 @L_add(i64 %31, i32 %33)
%35 = tail call i32 @Random(i32* %0)
%36 = tail call i32 @L_deposit_l(i32 %35)
%37 = tail call i64 @L_add(i64 %34, i32 %36)
%38 = tail call i64 @L_shr(i64 %37, i32 7)
%39 = tail call i32 @extract_l(i64 %38)
ret i32 %39
}