#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 *, char *, int, int, char *);
int /*<<< orphan*/ sscanf(char *, char *, char *, char *, int *, int *);
int /*<<< orphan*/ strcpy(char *, char *);
int main() {
  int day, year;
  char weekday[20], month[20], dtm[100];
  strcpy(dtm, "Saturday March 25 1989");
  sscanf(dtm, "%s %s %d  %d\n", weekday, month, &day, &year);
  printf("%s %d, %d = %s\n", month, day, year, weekday);
  return (0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xb0(%rbp),%rdi
lea    0xeb0(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0xb0(%rbp),%rdi
lea    -0x20(%rbp),%rdx
lea    -0x40(%rbp),%rcx
lea    0xeac(%rip),%rsi
lea    -0x8(%rbp),%r8
lea    -0xc(%rbp),%r9
call   1050 <sscanf@plt>
lea    -0x40(%rbp),%rsi
mov    -0x8(%rbp),%edx
mov    -0xc(%rbp),%ecx
lea    -0x20(%rbp),%r8
lea    0xe98(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %rbx
sub    $0xc0,%rsp
lea    0xebd(%rip),%rsi
lea    0x50(%rsp),%rbx
mov    %rbx,%rdi
call   1030 <strcpy@plt>
lea    0xec0(%rip),%rsi
lea    0x30(%rsp),%r14
lea    0x10(%rsp),%r15
lea    0xc(%rsp),%r8
lea    0x8(%rsp),%r9
mov    %rbx,%rdi
mov    %r14,%rdx
mov    %r15,%rcx
call   1050 <sscanf@plt>
mov    0xc(%rsp),%edx
mov    0x8(%rsp),%ecx
lea    0xe9d(%rip),%rdi
mov    %r15,%rsi
mov    %r14,%r8
call   1040 <printf@plt>
xor    %eax,%eax
add    $0xc0,%rsp
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Saturday March 25 1989\00"
@.str.1 = [14 x i8] c"%s %s %d %d\0A\00"
@.str.2 = [16 x i8] c"%s %d, %d = %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca [20 x i8]
%5 = alloca [20 x i8]
%6 = alloca [100 x i8]
store i32 0, i32* %1
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%8 = call i32 @strcpy(i8* %7, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %6, i64 0, i64 0
%10 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%11 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 0
%12 = call i32 @sscanf(i8* %9, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %10, i8* %11, i32* %2, i32* %3)
%13 = getelementptr inbounds [20 x i8], [20 x i8]* %5, i64 0, i64 0
%14 = load i32, i32* %2
%15 = load i32, i32* %3
%16 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%17 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %13, i32 %14, i32 %15, i8* %16)
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"Saturday March 25 1989\00"
@.str.1 = [14 x i8] c"%s %s %d %d\0A\00"
@.str.2 = [16 x i8] c"%s %d, %d = %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [20 x i8]
%4 = alloca [20 x i8]
%5 = alloca [100 x i8]
%6 = bitcast i32* %1 to i8*
%7 = bitcast i32* %2 to i8*
%8 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%9 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%10 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%11 = call i32 @strcpy(i8* %10, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%12 = call i32 @sscanf(i8* %10, i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %8, i8* %9, i32* %1, i32* %2)
%13 = load i32, i32* %1
%14 = load i32, i32* %2
%15 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %9, i32 %13, i32 %14, i8* %8)
ret i32 0
}