#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 sscanf(char *, char *, int *, int *, int *, int *, int *, int *);
int main(int argc, char *argv[]) {
  int nr;
  int ii;
  int subs[6];
  char buff[] = "010912282004.33";
  if (argc != 2) {
    printf("Usage:  main MMDDhhmm[[CC]YY][.ss]\n\n");
    return 1;
  }
  subs[5] = 9999;
  nr = sscanf(argv[1], "%2d%2d%2d%2d%d.%2d", &(subs[0]), &(subs[1]), &(subs[2]),
              &(subs[3]), &(subs[4]), &(subs[5]));
  printf("Matched %d substitutions.\n", nr);
  for (ii = 0; ii < nr; ++ii) {
    printf("%d\n", subs[ii]);
  }
  printf("subs[5] = %d\n", subs[5]);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x50,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xec3(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xec0(%rip),%rax
mov    %rax,-0x38(%rbp)
cmpl   $0x2,-0x8(%rbp)
je     1170 <main+0x50>
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x1,-0x4(%rbp)
jmp    1223 <main+0x103>
movl   $0x270f,-0x1c(%rbp)
mov    -0x10(%rbp),%rax
mov    0x8(%rax),%rdi
lea    -0x30(%rbp),%rdx
lea    -0x30(%rbp),%rcx
add    $0x4,%rcx
lea    -0x30(%rbp),%r8
add    $0x8,%r8
lea    -0x30(%rbp),%r9
add    $0xc,%r9
lea    -0x30(%rbp),%r10
add    $0x10,%r10
lea    -0x30(%rbp),%rax
add    $0x14,%rax
lea    0xe83(%rip),%rsi
mov    %r10,(%rsp)
mov    %rax,0x8(%rsp)
call   1040 <sscanf@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe7b(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    120b <main+0xeb>
movslq -0x18(%rbp),%rax
mov    -0x30(%rbp,%rax,4),%esi
lea    0xe77(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
mov    -0x18(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x18(%rbp)
jmp    11db <main+0xbb>
mov    -0x1c(%rbp),%esi
lea    0xe4e(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x50,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbp
push   %r15
push   %r14
push   %rbx
sub    $0x18,%rsp
cmp    $0x2,%edi
jne    11da <main+0xaa>
lea    0x14(%rsp),%rax
movl   $0x270f,0x14(%rsp)
mov    0x8(%rsi),%rdi
lea    0x4(%rsp),%rcx
lea    0x8(%rsp),%r8
lea    0xc(%rsp),%r9
lea    0x10(%rsp),%rbp
lea    0xe91(%rip),%rsi
mov    %rsp,%rdx
push   %rax
push   %rbp
call   1050 <sscanf@plt>
add    $0x10,%rsp
mov    %eax,%ebx
lea    0xe8d(%rip),%rdi
xor    %r14d,%r14d
mov    %eax,%esi
xor    %eax,%eax
call   1040 <printf@plt>
test   %ebx,%ebx
jle    11c6 <main+0x96>
mov    %ebx,%ebp
lea    0xe99(%rip),%r15
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%rsp,%rbx,4),%esi
mov    %r15,%rdi
xor    %eax,%eax
call   1040 <printf@plt>
add    $0x1,%rbx
cmp    %rbx,%rbp
jne    11b0 <main+0x80>
mov    0x14(%rsp),%esi
lea    0xe5d(%rip),%rdi
xor    %eax,%eax
call   1040 <printf@plt>
jmp    11ec <main+0xbc>
lea    0xe5b(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%r14d
mov    %r14d,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@__const.main.buff = [16 x i8] c"010912282004.33\00"
@.str = [37 x i8] c"Usage: main MMDDhhmm[[CC]YY][.ss]\0A\0A\00"
@.str.1 = [19 x i8] c"%2d%2d%2d%2d%d.%2d\00"
@.str.2 = [27 x i8] c"Matched %d substitutions.\0A\00"
@.str.3 = [4 x i8] c"%d\0A\00"
@.str.4 = [14 x i8] c"subs[5] = %d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca [6 x i32]
%9 = alloca [16 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = bitcast [16 x i8]* %9 to i8*
%11 = load i32, i32* %4
%12 = icmp ne i32 %11, 2
br i1 %12, label %13, label %15
13: ; preds = %2
%14 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %3
br label %46
15: ; preds = %2
%16 = getelementptr inbounds [6 x i32], [6 x i32]* %8, i64 0, i64 5
store i32 9999, i32* %16
%17 = load i8**, i8*** %5
%18 = getelementptr inbounds i8*, i8** %17, i64 1
%19 = load i8*, i8** %18
%20 = getelementptr inbounds [6 x i32], [6 x i32]* %8, i64 0, i64 0
%21 = getelementptr inbounds [6 x i32], [6 x i32]* %8, i64 0, i64 1
%22 = getelementptr inbounds [6 x i32], [6 x i32]* %8, i64 0, i64 2
%23 = getelementptr inbounds [6 x i32], [6 x i32]* %8, i64 0, i64 3
%24 = getelementptr inbounds [6 x i32], [6 x i32]* %8, i64 0, i64 4
%25 = getelementptr inbounds [6 x i32], [6 x i32]* %8, i64 0, i64 5
%26 = call i32 @sscanf(i8* %19, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32* %20, i32* %21, i32* %22, i32* %23, i32* %24, i32* %25)
store i32 %26, i32* %6
%27 = load i32, i32* %6
%28 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32 %27)
store i32 0, i32* %7
br label %29
29: ; preds = %39, %15
%30 = load i32, i32* %7
%31 = load i32, i32* %6
%32 = icmp slt i32 %30, %31
br i1 %32, label %33, label %42
33: ; preds = %29
%34 = load i32, i32* %7
%35 = sext i32 %34 to i64
%36 = getelementptr inbounds [6 x i32], [6 x i32]* %8, i64 0, i64 %35
%37 = load i32, i32* %36
%38 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %37)
br label %39
39: ; preds = %33
%40 = load i32, i32* %7
%41 = add nsw i32 %40, 1
store i32 %41, i32* %7
br label %29
42: ; preds = %29
%43 = getelementptr inbounds [6 x i32], [6 x i32]* %8, i64 0, i64 5
%44 = load i32, i32* %43
%45 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 %44)
store i32 0, i32* %3
br label %46
46: ; preds = %42, %13
%47 = load i32, i32* %3
ret i32 %47
}

LLVM IR (-O2):
@.str.1 = [19 x i8] c"%2d%2d%2d%2d%d.%2d\00"
@.str.2 = [27 x i8] c"Matched %d substitutions.\0A\00"
@.str.3 = [4 x i8] c"%d\0A\00"
@.str.4 = [14 x i8] c"subs[5] = %d\0A\00"
@str = [36 x i8] c"Usage: main MMDDhhmm[[CC]YY][.ss]\0A\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = alloca [6 x i32]
%4 = bitcast [6 x i32]* %3 to i8*
%5 = icmp eq i32 %0, 2
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([36 x i8], [36 x i8]* @str, i64 0, i64 0))
br label %32
8: ; preds = %2
%9 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 5
store i32 9999, i32* %9
%10 = getelementptr inbounds i8*, i8** %1, i64 1
%11 = load i8*, i8** %10
%12 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 0
%13 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 1
%14 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 2
%15 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 3
%16 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 4
%17 = call i32 @sscanf(i8* %11, i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32* %12, i32* %13, i32* %14, i32* %15, i32* %16, i32* %9)
%18 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([27 x i8], [27 x i8]* @.str.2, i64 0, i64 0), i32 %17)
%19 = icmp sgt i32 %17, 0
br i1 %19, label %20, label %29
20: ; preds = %8
%21 = zext i32 %17 to i64
br label %22
22: ; preds = %20, %22
%23 = phi i64 [ 0, %20 ], [ %27, %22 ]
%24 = getelementptr inbounds [6 x i32], [6 x i32]* %3, i64 0, i64 %23
%25 = load i32, i32* %24
%26 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([4 x i8], [4 x i8]* @.str.3, i64 0, i64 0), i32 %25)
%27 = add nuw nsw i64 %23, 1
%28 = icmp eq i64 %27, %21
br i1 %28, label %29, label %22
29: ; preds = %22, %8
%30 = load i32, i32* %9
%31 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.4, i64 0, i64 0), i32 %30)
br label %32
32: ; preds = %29, %6
%33 = phi i32 [ 1, %6 ], [ 0, %29 ]
ret i32 %33
}