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


x86 assembly (clang, -O0):
<sscanf_t>:
push   %rbp
mov    %rsp,%rbp
sub    $0xb0,%rsp
lea    -0xb0(%rbp),%rdi
lea    0xeb7(%rip),%rsi
call   1030 <strcpy@plt>
lea    -0xb0(%rbp),%rdi
lea    -0x20(%rbp),%rdx
lea    -0x40(%rbp),%rcx
lea    0xeb3(%rip),%rsi
lea    -0x4(%rbp),%r8
lea    -0x8(%rbp),%r9
call   1050 <sscanf@plt>
lea    -0x40(%rbp),%rsi
mov    -0x4(%rbp),%edx
mov    -0x8(%rbp),%ecx
lea    -0x20(%rbp),%r8
lea    0xe9e(%rip),%rdi
call   1040 <printf@plt>
add    $0xb0,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sscanf_t>:
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    0xe9c(%rip),%rdi
mov    %r15,%rsi
mov    %r14,%r8
call   1040 <printf@plt>
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 = [13 x i8] c"%s %s %d %d\00"
@.str.2 = [16 x i8] c"%s %d, %d = %s\0A\00"
define void @sscanf_t() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca [20 x i8]
%4 = alloca [20 x i8]
%5 = alloca [100 x i8]
%6 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%7 = call i32 @strcpy(i8* %6, i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%8 = getelementptr inbounds [100 x i8], [100 x i8]* %5, i64 0, i64 0
%9 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%10 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%11 = call i32 @sscanf(i8* %8, i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str.1, i64 0, i64 0), i8* %9, i8* %10, i32* %1, i32* %2)
%12 = getelementptr inbounds [20 x i8], [20 x i8]* %4, i64 0, i64 0
%13 = load i32, i32* %1
%14 = load i32, i32* %2
%15 = getelementptr inbounds [20 x i8], [20 x i8]* %3, i64 0, i64 0
%16 = call i32 @printf(i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str.2, i64 0, i64 0), i8* %12, i32 %13, i32 %14, i8* %15)
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"Saturday March 25 1989\00"
@.str.1 = [13 x i8] c"%s %s %d %d\00"
@.str.2 = [16 x i8] c"%s %d, %d = %s\0A\00"
define void @sscanf_t() {
%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 ([13 x i8], [13 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 void
}