#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 /*<<< orphan*/ printf(char *, ...);
int scanf(char *, unsigned int *);
int main() {
  unsigned int rok;
  printf("Zadej rok: ");
  if (scanf("%u", &rok) != 1) {
    printf("Spatny vstup\n");
    return 1;
  }
  if (rok % 4 == 0) {
    if (rok % 100 != 0) {
      printf("Rok %u je prestupny\n", rok);
    } else if (rok % 400 == 0) {
      printf("Rok %u je prestupny\n", rok);
    } else {
      printf("Rok %u neni prestupny\n", rok);
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec8(%rip),%rdi
lea    -0x8(%rbp),%rsi
call   1040 <scanf@plt>
cmp    $0x1,%eax
je     1170 <main+0x50>
lea    0xeb2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11f7 <main+0xd7>
mov    -0x8(%rbp),%eax
and    $0x3,%eax
cmp    $0x0,%eax
jne    11f0 <main+0xd0>
mov    -0x8(%rbp),%eax
mov    $0x64,%ecx
xor    %edx,%edx
div    %ecx
cmp    $0x0,%edx
je     11aa <main+0x8a>
mov    -0x8(%rbp),%esi
lea    0xe7f(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11eb <main+0xcb>
mov    -0x8(%rbp),%eax
mov    $0x190,%ecx
xor    %edx,%edx
div    %ecx
cmp    $0x0,%edx
jne    11d5 <main+0xb5>
mov    -0x8(%rbp),%esi
lea    0xe54(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11e6 <main+0xc6>
mov    -0x8(%rbp),%esi
lea    0xe53(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    11eb <main+0xcb>
jmp    11f0 <main+0xd0>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0xec4(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <printf@plt>
lea    0xec0(%rip),%rdi
lea    0xc(%rsp),%rsi
call   1050 <scanf@plt>
cmp    $0x1,%eax
jne    1181 <main+0x51>
mov    0xc(%rsp),%esi
test   $0x3,%sil
jne    11ae <main+0x7e>
imul   $0xc28f5c29,%esi,%eax
mov    %eax,%ecx
ror    $0x2,%ecx
cmp    $0x28f5c29,%ecx
jb     1194 <main+0x64>
lea    0xe90(%rip),%rdi
jmp    11a5 <main+0x75>
lea    0xeb3(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%ebx
jmp    11ae <main+0x7e>
ror    $0x4,%eax
cmp    $0xa3d70a,%eax
jbe    1178 <main+0x48>
lea    0xe7f(%rip),%rdi
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <printf@plt>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [12 x i8] c"Zadej rok: \00"
@.str.1 = [3 x i8] c"%u\00"
@.str.2 = [14 x i8] c"Spatny vstup\0A\00"
@.str.3 = [21 x i8] c"Rok %u je prestupny\0A\00"
@.str.4 = [23 x i8] c"Rok %u neni prestupny\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %2)
%5 = icmp ne i32 %4, 1
br i1 %5, label %6, label %8
6: ; preds = %0
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0))
store i32 1, i32* %1
br label %32
8: ; preds = %0
%9 = load i32, i32* %2
%10 = urem i32 %9, 4
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %31
12: ; preds = %8
%13 = load i32, i32* %2
%14 = urem i32 %13, 100
%15 = icmp ne i32 %14, 0
br i1 %15, label %16, label %19
16: ; preds = %12
%17 = load i32, i32* %2
%18 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %17)
br label %30
19: ; preds = %12
%20 = load i32, i32* %2
%21 = urem i32 %20, 400
%22 = icmp eq i32 %21, 0
br i1 %22, label %23, label %26
23: ; preds = %19
%24 = load i32, i32* %2
%25 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %24)
br label %29
26: ; preds = %19
%27 = load i32, i32* %2
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i32 %27)
br label %29
29: ; preds = %26, %23
br label %30
30: ; preds = %29, %16
br label %31
31: ; preds = %30, %8
store i32 0, i32* %1
br label %32
32: ; preds = %31, %6
%33 = load i32, i32* %1
ret i32 %33
}

LLVM IR (-O2):
@.str = [12 x i8] c"Zadej rok: \00"
@.str.1 = [3 x i8] c"%u\00"
@.str.3 = [21 x i8] c"Rok %u je prestupny\0A\00"
@.str.4 = [23 x i8] c"Rok %u neni prestupny\0A\00"
@str = [13 x i8] c"Spatny vstup\00"
define i32 @main() {
%1 = alloca i32
%2 = bitcast i32* %1 to i8*
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
%4 = call i32 @scanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i32* %1)
%5 = icmp eq i32 %4, 1
br i1 %5, label %8, label %6
6: ; preds = %0
%7 = call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
br label %24
8: ; preds = %0
%9 = load i32, i32* %1
%10 = and i32 %9, 3
%11 = icmp eq i32 %10, 0
br i1 %11, label %12, label %24
12: ; preds = %8
%13 = urem i32 %9, 100
%14 = icmp eq i32 %13, 0
br i1 %14, label %17, label %15
15: ; preds = %12
%16 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %9)
br label %24
17: ; preds = %12
%18 = urem i32 %9, 400
%19 = icmp eq i32 %18, 0
br i1 %19, label %20, label %22
20: ; preds = %17
%21 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([21 x i8], [21 x i8]* @.str.3, i64 0, i64 0), i32 %9)
br label %24
22: ; preds = %17
%23 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str.4, i64 0, i64 0), i32 %9)
br label %24
24: ; preds = %8, %20, %22, %15, %6
%25 = phi i32 [ 1, %6 ], [ 0, %15 ], [ 0, %22 ], [ 0, %20 ], [ 0, %8 ]
ret i32 %25
}