#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 /*<<< orphan*/ scanf(char *, int *, int *, int *);
int main(void) {
  int month, day, year;
  printf("Enter date (mm/dd/yy): ");
  scanf("%d/%d/%d", &month, &day, &year);
  printf("Dated this %d", day);
  switch (day) {
  case 1:
  case 21:
  case 31:
    printf("st");
    break;
  case 2:
  case 22:
    printf("nd");
    break;
  case 3:
  case 23:
    printf("rd");
    break;
  default:
    printf("th");
    break;
  }
  printf(", 20%.2d.\n", year);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeca(%rip),%rdi
xor    %eax,%eax
mov    %al,-0x15(%rbp)
call   1030 <printf@plt>
lea    0xed1(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
lea    -0x10(%rbp),%rcx
call   1040 <scanf@plt>
mov    -0x15(%rbp),%al
mov    -0xc(%rbp),%esi
lea    0xebc(%rip),%rdi
call   1030 <printf@plt>
mov    -0xc(%rbp),%eax
mov    %eax,-0x14(%rbp)
sub    $0x1,%eax
je     11e4 <main+0xc4>
jmp    117e <main+0x5e>
mov    -0x14(%rbp),%eax
sub    $0x2,%eax
je     11f7 <main+0xd7>
jmp    118f <main+0x6f>
mov    -0x14(%rbp),%eax
sub    $0x3,%eax
je     120a <main+0xea>
jmp    11a0 <main+0x80>
mov    -0x14(%rbp),%eax
sub    $0x15,%eax
je     11e4 <main+0xc4>
jmp    11b1 <main+0x91>
mov    -0x14(%rbp),%eax
sub    $0x16,%eax
je     11f7 <main+0xd7>
jmp    11c2 <main+0xa2>
mov    -0x14(%rbp),%eax
sub    $0x17,%eax
je     120a <main+0xea>
jmp    11d3 <main+0xb3>
mov    -0x14(%rbp),%eax
sub    $0x1f,%eax
jne    121d <main+0xfd>
jmp    11e4 <main+0xc4>
lea    0xe44(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    122b <main+0x10b>
lea    0xe34(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    122b <main+0x10b>
lea    0xe24(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
jmp    122b <main+0x10b>
lea    0xe14(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x10(%rbp),%esi
lea    0xe06(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
lea    0xed5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xedf(%rip),%rdi
lea    0x14(%rsp),%rsi
lea    0xc(%rsp),%rdx
lea    0x10(%rsp),%rcx
call   1040 <scanf@plt>
mov    0xc(%rsp),%esi
lea    0xec9(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0xc(%rsp),%eax
cmp    $0x1f,%eax
ja     11a1 <main+0x81>
mov    $0x80200002,%ecx
bt     %eax,%ecx
jb     118f <main+0x6f>
mov    $0x400004,%ecx
bt     %eax,%ecx
jb     1198 <main+0x78>
mov    $0x800008,%ecx
bt     %eax,%ecx
jae    11a1 <main+0x81>
lea    0xea8(%rip),%rdi
jmp    11a8 <main+0x88>
lea    0xe99(%rip),%rdi
jmp    11a8 <main+0x88>
lea    0xe93(%rip),%rdi
jmp    11a8 <main+0x88>
lea    0xe90(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
mov    0x10(%rsp),%esi
lea    0xe81(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@.str = [24 x i8] c"Enter date (mm/dd/yy): \00"
@.str.1 = [9 x i8] c"%d/%d/%d\00"
@.str.2 = [14 x i8] c"Dated this %d\00"
@.str.3 = [3 x i8] c"st\00"
@.str.4 = [3 x i8] c"nd\00"
@.str.5 = [3 x i8] c"rd\00"
@.str.6 = [3 x i8] c"th\00"
@.str.7 = [11 x i8] c", 20%.2d.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3, i32* %4)
%7 = load i32, i32* %3
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %7)
%9 = load i32, i32* %3
switch i32 %9, label %16 [
i32 1, label %10
i32 21, label %10
i32 31, label %10
i32 2, label %12
i32 22, label %12
i32 3, label %14
i32 23, label %14
]
10: ; preds = %0, %0, %0
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0))
br label %18
12: ; preds = %0, %0
%13 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0))
br label %18
14: ; preds = %0, %0
%15 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0))
br label %18
16: ; preds = %0
%17 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0))
br label %18
18: ; preds = %16, %14, %12, %10
%19 = load i32, i32* %4
%20 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i32 %19)
ret i32 0
}

LLVM IR (-O2):
@.str = [24 x i8] c"Enter date (mm/dd/yy): \00"
@.str.1 = [9 x i8] c"%d/%d/%d\00"
@.str.2 = [14 x i8] c"Dated this %d\00"
@.str.3 = [3 x i8] c"st\00"
@.str.4 = [3 x i8] c"nd\00"
@.str.5 = [3 x i8] c"rd\00"
@.str.6 = [3 x i8] c"th\00"
@.str.7 = [11 x i8] c", 20%.2d.\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32* %3 to i8*
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2, i32* %3)
%9 = load i32, i32* %2
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %9)
%11 = load i32, i32* %2
switch i32 %11, label %14 [
i32 1, label %15
i32 21, label %15
i32 31, label %15
i32 2, label %12
i32 22, label %12
i32 3, label %13
i32 23, label %13
]
12: ; preds = %0, %0
br label %15
13: ; preds = %0, %0
br label %15
14: ; preds = %0
br label %15
15: ; preds = %0, %0, %0, %14, %13, %12
%16 = phi i8* [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.6, i64 0, i64 0), %14 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.5, i64 0, i64 0), %13 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.4, i64 0, i64 0), %12 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), %0 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), %0 ], [ getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), %0 ]
%17 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) %16)
%18 = load i32, i32* %3
%19 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([11 x i8], [11 x i8]* @.str.7, i64 0, i64 0), i32 %18)
ret i32 0
}