#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, int, int);
int sscanf(char const *, char *, int *, int *);
int main(int argc, char *argv[]) {
  const char teststring[] = "<tag `word'>";
  int retc, a, b;
  retc = sscanf(teststring, "<%*s `%n%*s%n'>", &a, &b);
  printf("retc=%d a=%d b=%d\n", retc, a, b);
  return retc == -1 && a == 6 && b == 12 ? 0 : 1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xec3(%rip),%rax
mov    %rax,-0x1d(%rbp)
mov    0xec1(%rip),%eax
mov    %eax,-0x15(%rbp)
mov    0xebc(%rip),%al
mov    %al,-0x11(%rbp)
lea    -0x1d(%rbp),%rdi
lea    0xeaf(%rip),%rsi
lea    -0x28(%rbp),%rdx
lea    -0x2c(%rbp),%rcx
call   1040 <sscanf@plt>
mov    %eax,-0x24(%rbp)
mov    -0x24(%rbp),%esi
mov    -0x28(%rbp),%edx
mov    -0x2c(%rbp),%ecx
lea    0xe9f(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
cmpl   $0xffffffff,-0x24(%rbp)
mov    %al,-0x2d(%rbp)
jne    11ab <main+0x8b>
xor    %eax,%eax
cmpl   $0x6,-0x28(%rbp)
mov    %al,-0x2d(%rbp)
jne    11ab <main+0x8b>
cmpl   $0xc,-0x2c(%rbp)
sete   %al
mov    %al,-0x2d(%rbp)
mov    -0x2d(%rbp),%dl
mov    $0x1,%eax
xor    %ecx,%ecx
test   $0x1,%dl
cmovne %ecx,%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x20,%rsp
movabs $0x3e2764726f7760,%rax
mov    %rax,0x15(%rsp)
movabs $0x6f7760206761743c,%rax
60 77 6f
mov    %rax,0x10(%rsp)
lea    0xec3(%rip),%rsi
lea    0x10(%rsp),%rdi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
call   1040 <sscanf@plt>
mov    %eax,%ebx
mov    0xc(%rsp),%edx
mov    0x8(%rsp),%ecx
lea    0xeae(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
not    %ebx
mov    0xc(%rsp),%ecx
xor    $0x6,%ecx
or     %ebx,%ecx
mov    0x8(%rsp),%edx
xor    $0xc,%edx
xor    %eax,%eax
or     %ecx,%edx
setne  %al
add    $0x20,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.teststring = [13 x i8] c"<tag `word'>\00"
@.str = [16 x i8] c"<%*s `%n%*s%n'>\00"
@.str.1 = [19 x i8] c"retc=%d a=%d b=%d\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [13 x i8]
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = bitcast [13 x i8]* %6 to i8*
%11 = getelementptr inbounds [13 x i8], [13 x i8]* %6, i64 0, i64 0
%12 = call i32 @sscanf(i8* %11, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32* %8, i32* %9)
store i32 %12, i32* %7
%13 = load i32, i32* %7
%14 = load i32, i32* %8
%15 = load i32, i32* %9
%16 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %13, i32 %14, i32 %15)
%17 = load i32, i32* %7
%18 = icmp eq i32 %17, -1
br i1 %18, label %19, label %25
19: ; preds = %2
%20 = load i32, i32* %8
%21 = icmp eq i32 %20, 6
br i1 %21, label %22, label %25
22: ; preds = %19
%23 = load i32, i32* %9
%24 = icmp eq i32 %23, 12
br label %25
25: ; preds = %22, %19, %2
%26 = phi i1 [ false, %19 ], [ false, %2 ], [ %24, %22 ]
%27 = zext i1 %26 to i64
%28 = select i1 %26, i32 0, i32 1
ret i32 %28
}

LLVM IR (-O2):
@__const.main.teststring = [13 x i8] c"<tag `word'>\00"
@.str = [16 x i8] c"<%*s `%n%*s%n'>\00"
@.str.1 = [19 x i8] c"retc=%d a=%d b=%d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [13 x i8]
%4 = alloca i32
%5 = alloca i32
%6 = getelementptr inbounds [13 x i8], [13 x i8]* %3, i64 0, i64 0
%7 = bitcast i32* %4 to i8*
%8 = bitcast i32* %5 to i8*
%9 = call i32 @sscanf(i8* %6, i8* getelementptr inbounds ([16 x i8], [16 x i8]* @.str, i64 0, i64 0), i32* %4, i32* %5)
%10 = load i32, i32* %4
%11 = load i32, i32* %5
%12 = call i32 @printf(i8* getelementptr inbounds ([19 x i8], [19 x i8]* @.str.1, i64 0, i64 0), i32 %9, i32 %10, i32 %11)
%13 = icmp ne i32 %9, -1
%14 = load i32, i32* %4
%15 = icmp ne i32 %14, 6
%16 = select i1 %13, i1 true, i1 %15
%17 = load i32, i32* %5
%18 = icmp ne i32 %17, 12
%19 = select i1 %16, i1 true, i1 %18
%20 = zext i1 %19 to i32
ret i32 %20
}