#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, char *);
int /*<<< orphan*/ sscanf(char *, char *, int *, ...);
int main(void) {
  char str[100] = "";
  int i = 0;
  sscanf("6 six", "%d %s", &i, &str);
  printf("Might be '6 six': %d %s\n", i, str);
  sscanf("6 six", "%d %s", &i, str);
  printf("Will be '6 six': %d %s\n", i, str);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x80,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0x70(%rbp),%rdi
xor    %esi,%esi
mov    $0x64,%edx
call   1040 <memset@plt>
movl   $0x0,-0x74(%rbp)
lea    0xea0(%rip),%rdi
lea    0xe9f(%rip),%rsi
lea    -0x74(%rbp),%rdx
lea    -0x70(%rbp),%rcx
mov    $0x0,%al
call   1050 <sscanf@plt>
mov    -0x74(%rbp),%esi
lea    -0x70(%rbp),%rdx
lea    0xe88(%rip),%rdi
call   1030 <printf@plt>
lea    -0x70(%rbp),%rcx
lea    0xe6c(%rip),%rdi
lea    0xe6b(%rip),%rsi
lea    -0x74(%rbp),%rdx
mov    $0x0,%al
call   1050 <sscanf@plt>
mov    -0x74(%rbp),%esi
lea    -0x70(%rbp),%rdx
lea    0xe71(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x80,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r15
push   %r14
push   %r12
push   %rbx
sub    $0x78,%rsp
xorps  %xmm0,%xmm0
movaps %xmm0,0x60(%rsp)
movaps %xmm0,0x50(%rsp)
movaps %xmm0,0x40(%rsp)
movaps %xmm0,0x30(%rsp)
movaps %xmm0,0x20(%rsp)
movaps %xmm0,0x10(%rsp)
movl   $0x0,0x70(%rsp)
movl   $0x0,0xc(%rsp)
lea    0xe9d(%rip),%r15
lea    0xe9c(%rip),%r14
lea    0xc(%rsp),%r12
lea    0x10(%rsp),%rbx
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r12,%rdx
mov    %rbx,%rcx
xor    %eax,%eax
call   1040 <sscanf@plt>
mov    0xc(%rsp),%esi
lea    0xe7a(%rip),%rdi
mov    %rbx,%rdx
call   1030 <printf@plt>
mov    %r15,%rdi
mov    %r14,%rsi
mov    %r12,%rdx
mov    %rbx,%rcx
xor    %eax,%eax
call   1040 <sscanf@plt>
mov    0xc(%rsp),%esi
lea    0xe6d(%rip),%rdi
mov    %rbx,%rdx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x78,%rsp
pop    %rbx
pop    %r12
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [6 x i8] c"6 six\00"
@.str.1 = [6 x i8] c"%d %s\00"
@.str.2 = [25 x i8] c"Might be '6 six': %d %s\0A\00"
@.str.3 = [24 x i8] c"Will be '6 six': %d %s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [100 x i8]
%3 = alloca i32
store i32 0, i32* %1
%4 = bitcast [100 x i8]* %2 to i8*
store i32 0, i32* %3
%5 = call i32 (i8*, i8*, i32*, ...) @sscanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %3, [100 x i8]* %2)
%6 = load i32, i32* %3
%7 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%8 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %6, i8* %7)
%9 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%10 = call i32 (i8*, i8*, i32*, ...) @sscanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %3, i8* %9)
%11 = load i32, i32* %3
%12 = getelementptr inbounds [100 x i8], [100 x i8]* %2, i64 0, i64 0
%13 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i32 %11, i8* %12)
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"6 six\00"
@.str.1 = [6 x i8] c"%d %s\00"
@.str.2 = [25 x i8] c"Might be '6 six': %d %s\0A\00"
@.str.3 = [24 x i8] c"Will be '6 six': %d %s\0A\00"
define i32 @main() {
%1 = alloca [100 x i8]
%2 = alloca i32
%3 = getelementptr inbounds [100 x i8], [100 x i8]* %1, i64 0, i64 0
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = call i32 (i8*, i8*, i32*, ...) @sscanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %2, [100 x i8]* %1)
%6 = load i32, i32* %2
%7 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %6, i8* %3)
%8 = call i32 (i8*, i8*, i32*, ...) @sscanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %2, i8* %3)
%9 = load i32, i32* %2
%10 = call i32 @printf(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.3, i64 0, i64 0), i32 %9, i8* %3)
ret i32 0
}