#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 lese_f();
int mondphase(int, int, int);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ printmoon(int);
int main() {
  int tag = 0, monat = 0, jahr = 0, mphase = 0, amijahr = 0;
  printf("Geben Sie einen Tag (1-31): ");
  tag = lese_f();
  while (tag > 31 || tag < 1) {
    printf("Geben Sie bitte einen gültigen Tag ein(1-31): ");
    tag = lese_f();
  }
  printf("Geben Sie einen Monat (1-12): ");
  monat = lese_f();
  while (monat < 1 || monat > 12) {
    printf("Geben Sie bitte einen gültigen Monat ein (1-12): ");
    monat = lese_f();
  }
  printf("Geben Sie ein Jahr (im Format JJJJ): ");
  jahr = lese_f();
  amijahr = jahr % 1000;
  amijahr = amijahr % 100;
  mphase = mondphase(tag, monat, jahr);
  printf("Die Mondphase an das Datum (Deutscheformat) %d.%d.%d "
         "(Americanischeformat) %d/%d/%d ist:  %d \n\n",
         tag, monat, jahr, monat, tag, amijahr, mphase);
  printmoon(mphase);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
movl   $0x0,-0x18(%rbp)
lea    0xe87(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <lese_f@plt>
mov    %eax,-0x8(%rbp)
mov    $0x1,%al
cmpl   $0x1f,-0x8(%rbp)
mov    %al,-0x19(%rbp)
jg     11a3 <main+0x63>
cmpl   $0x1,-0x8(%rbp)
setl   %al
mov    %al,-0x19(%rbp)
mov    -0x19(%rbp),%al
test   $0x1,%al
jne    11b3 <main+0x73>
jmp    11d0 <main+0x90>
lea    0xe63(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <lese_f@plt>
mov    %eax,-0x8(%rbp)
jmp    118a <main+0x4a>
lea    0xe76(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <lese_f@plt>
mov    %eax,-0xc(%rbp)
mov    $0x1,%al
cmpl   $0x1,-0xc(%rbp)
mov    %al,-0x1a(%rbp)
jl     1201 <main+0xc1>
cmpl   $0xc,-0xc(%rbp)
setg   %al
mov    %al,-0x1a(%rbp)
mov    -0x1a(%rbp),%al
test   $0x1,%al
jne    1211 <main+0xd1>
jmp    122e <main+0xee>
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <lese_f@plt>
mov    %eax,-0xc(%rbp)
jmp    11e8 <main+0xa8>
lea    0xe6a(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x0,%al
call   1050 <lese_f@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %edx,-0x18(%rbp)
mov    -0x18(%rbp),%eax
mov    $0x64,%ecx
cltd
idiv   %ecx
mov    %edx,-0x18(%rbp)
mov    -0x8(%rbp),%edi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1060 <mondphase@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x10(%rbp),%ecx
mov    -0xc(%rbp),%r8d
mov    -0x8(%rbp),%r9d
mov    -0x18(%rbp),%r10d
mov    -0x14(%rbp),%eax
lea    0xe33(%rip),%rdi
mov    %r10d,(%rsp)
mov    %eax,0x8(%rsp)
mov    $0x0,%al
call   1040 <printf@plt>
mov    -0x14(%rbp),%edi
call   1030 <printmoon@plt>
xor    %eax,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
lea    0xeb0(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <lese_f@plt>
mov    %eax,%r14d
add    $0xffffffe0,%eax
cmp    $0xffffffe0,%eax
ja     118d <main+0x4d>
lea    0xead(%rip),%rbx
mov    %rbx,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <lese_f@plt>
mov    %eax,%r14d
lea    -0x20(%r14),%eax
cmp    $0xffffffe1,%eax
jb     1170 <main+0x30>
lea    0xeb9(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <lese_f@plt>
mov    %eax,%ebx
add    $0xfffffff3,%eax
cmp    $0xfffffff3,%eax
ja     11db <main+0x9b>
lea    0xeb9(%rip),%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <lese_f@plt>
mov    %eax,%ebx
lea    -0xd(%rbx),%eax
cmp    $0xfffffff4,%eax
jb     11c0 <main+0x80>
lea    0xebd(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
xor    %eax,%eax
call   1050 <lese_f@plt>
movslq %eax,%r15
imul   $0x10624dd3,%r15,%rax
mov    %rax,%rcx
shr    $0x3f,%rcx
sar    $0x26,%rax
add    %ecx,%eax
imul   $0x3e8,%eax,%eax
mov    %r15d,%ecx
sub    %eax,%ecx
movswl %cx,%eax
imul   $0x147b,%eax,%eax
mov    %eax,%edx
shr    $0x1f,%edx
sar    $0x13,%eax
add    %edx,%eax
imul   $0x64,%eax,%eax
sub    %eax,%ecx
movswl %cx,%r13d
mov    %r14d,%edi
mov    %ebx,%esi
mov    %r15d,%edx
call   1060 <mondphase@plt>
mov    %eax,%r12d
lea    0xe80(%rip),%rdi
mov    %r14d,%esi
mov    %ebx,%edx
mov    %r15d,%ecx
mov    %ebx,%r8d
mov    %r14d,%r9d
xor    %eax,%eax
push   %r12
push   %r13
call   1040 <printf@plt>
add    $0x10,%rsp
mov    %r12d,%edi
call   1030 <printmoon@plt>
xor    %eax,%eax
pop    %rbx
pop    %r12
pop    %r13
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [29 x i8] c"Geben Sie einen Tag (1-31): \00"
@.str.1 = [48 x i8] c"Geben Sie bitte einen g\C3\BCltigen Tag ein(1-31): \00"
@.str.2 = [31 x i8] c"Geben Sie einen Monat (1-12): \00"
@.str.3 = [51 x i8] c"Geben Sie bitte einen g\C3\BCltigen Monat ein (1-12): \00"
@.str.4 = [38 x i8] c"Geben Sie ein Jahr (im Format JJJJ): \00"
@.str.5 = [96 x i8] c"Die Mondphase an das Datum (Deutscheformat) %d.%d.%d (Americanischeformat) %d/%d/%d ist: %d \0A\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %4
store i32 0, i32* %5
store i32 0, i32* %6
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%8 = call i32 (...) @lese_f()
store i32 %8, i32* %2
br label %9
9: ; preds = %17, %0
%10 = load i32, i32* %2
%11 = icmp sgt i32 %10, 31
br i1 %11, label %15, label %12
12: ; preds = %9
%13 = load i32, i32* %2
%14 = icmp slt i32 %13, 1
br label %15
15: ; preds = %12, %9
%16 = phi i1 [ true, %9 ], [ %14, %12 ]
br i1 %16, label %17, label %20
17: ; preds = %15
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0))
%19 = call i32 (...) @lese_f()
store i32 %19, i32* %2
br label %9
20: ; preds = %15
%21 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%22 = call i32 (...) @lese_f()
store i32 %22, i32* %3
br label %23
23: ; preds = %31, %20
%24 = load i32, i32* %3
%25 = icmp slt i32 %24, 1
br i1 %25, label %29, label %26
26: ; preds = %23
%27 = load i32, i32* %3
%28 = icmp sgt i32 %27, 12
br label %29
29: ; preds = %26, %23
%30 = phi i1 [ true, %23 ], [ %28, %26 ]
br i1 %30, label %31, label %34
31: ; preds = %29
%32 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([51 x i8], [51 x i8]* @.str.3, i64 0, i64 0))
%33 = call i32 (...) @lese_f()
store i32 %33, i32* %3
br label %23
34: ; preds = %29
%35 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0))
%36 = call i32 (...) @lese_f()
store i32 %36, i32* %4
%37 = load i32, i32* %4
%38 = srem i32 %37, 1000
store i32 %38, i32* %6
%39 = load i32, i32* %6
%40 = srem i32 %39, 100
store i32 %40, i32* %6
%41 = load i32, i32* %2
%42 = load i32, i32* %3
%43 = load i32, i32* %4
%44 = call i32 @mondphase(i32 %41, i32 %42, i32 %43)
store i32 %44, i32* %5
%45 = load i32, i32* %2
%46 = load i32, i32* %3
%47 = load i32, i32* %4
%48 = load i32, i32* %3
%49 = load i32, i32* %2
%50 = load i32, i32* %6
%51 = load i32, i32* %5
%52 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([96 x i8], [96 x i8]* @.str.5, i64 0, i64 0), i32 %45, i32 %46, i32 %47, i32 %48, i32 %49, i32 %50, i32 %51)
%53 = load i32, i32* %5
%54 = call i32 @printmoon(i32 %53)
ret i32 0
}

LLVM IR (-O2):
@.str = [29 x i8] c"Geben Sie einen Tag (1-31): \00"
@.str.1 = [48 x i8] c"Geben Sie bitte einen g\C3\BCltigen Tag ein(1-31): \00"
@.str.2 = [31 x i8] c"Geben Sie einen Monat (1-12): \00"
@.str.3 = [51 x i8] c"Geben Sie bitte einen g\C3\BCltigen Monat ein (1-12): \00"
@.str.4 = [38 x i8] c"Geben Sie ein Jahr (im Format JJJJ): \00"
@.str.5 = [96 x i8] c"Die Mondphase an das Datum (Deutscheformat) %d.%d.%d (Americanischeformat) %d/%d/%d ist: %d \0A\0A\00"
define i32 @main() {
%1 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([29 x i8], [29 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 (...) @lese_f()
%3 = add i32 %2, -32
%4 = icmp ult i32 %3, -31
br i1 %4, label %5, label %10
5: ; preds = %0, %5
%6 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([48 x i8], [48 x i8]* @.str.1, i64 0, i64 0))
%7 = tail call i32 (...) @lese_f()
%8 = add i32 %7, -32
%9 = icmp ult i32 %8, -31
br i1 %9, label %5, label %10
10: ; preds = %5, %0
%11 = phi i32 [ %2, %0 ], [ %7, %5 ]
%12 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([31 x i8], [31 x i8]* @.str.2, i64 0, i64 0))
%13 = tail call i32 (...) @lese_f()
%14 = add i32 %13, -13
%15 = icmp ult i32 %14, -12
br i1 %15, label %16, label %21
16: ; preds = %10, %16
%17 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @.str.3, i64 0, i64 0))
%18 = tail call i32 (...) @lese_f()
%19 = add i32 %18, -13
%20 = icmp ult i32 %19, -12
br i1 %20, label %16, label %21
21: ; preds = %16, %10
%22 = phi i32 [ %13, %10 ], [ %18, %16 ]
%23 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([38 x i8], [38 x i8]* @.str.4, i64 0, i64 0))
%24 = tail call i32 (...) @lese_f()
%25 = srem i32 %24, 1000
%26 = trunc i32 %25 to i16
%27 = srem i16 %26, 100
%28 = sext i16 %27 to i32
%29 = tail call i32 @mondphase(i32 %11, i32 %22, i32 %24)
%30 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([96 x i8], [96 x i8]* @.str.5, i64 0, i64 0), i32 %11, i32 %22, i32 %24, i32 %22, i32 %11, i32 %28, i32 %29)
%31 = tail call i32 @printmoon(i32 %29)
ret i32 0
}