#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*/ abort();
int /*<<< orphan*/ printf(char *, int, int, int);
int sscanf(char *, char *, int *, int *);
int main(int argc, char *argv[]) {
  int i, n, r;
  n = i = r = -1;
  r = sscanf("1234:567", "%d%n", &i, &n);
  printf("%d %d %d\n", r, n, i);
  if (r != 1 || i != 1234 || n != 4)
    abort();
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xffffffff,-0x1c(%rbp)
movl   $0xffffffff,-0x14(%rbp)
movl   $0xffffffff,-0x18(%rbp)
lea    0xe9e(%rip),%rdi
lea    0xea0(%rip),%rsi
lea    -0x14(%rbp),%rdx
lea    -0x18(%rbp),%rcx
call   1050 <sscanf@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%esi
mov    -0x18(%rbp),%edx
mov    -0x14(%rbp),%ecx
lea    0xe85(%rip),%rdi
call   1040 <printf@plt>
cmpl   $0x1,-0x1c(%rbp)
jne    11af <main+0x7f>
cmpl   $0x4d2,-0x14(%rbp)
jne    11af <main+0x7f>
cmpl   $0x4,-0x18(%rbp)
je     11b6 <main+0x86>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movl   $0xffffffff,0xc(%rsp)
ff
movl   $0xffffffff,0x8(%rsp)
ff
lea    0xeb4(%rip),%rdi
lea    0xeb6(%rip),%rsi
lea    0xc(%rsp),%rdx
lea    0x8(%rsp),%rcx
call   1050 <sscanf@plt>
mov    %eax,%ebx
mov    0x8(%rsp),%edx
mov    0xc(%rsp),%ecx
lea    0xe9b(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
cmp    $0x1,%ebx
jne    1198 <main+0x68>
cmpl   $0x4d2,0xc(%rsp)
jne    1198 <main+0x68>
cmpl   $0x4,0x8(%rsp)
jne    1198 <main+0x68>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [9 x i8] c"1234:567\00"
@.str.1 = [5 x i8] c"%d%n\00"
@.str.2 = [10 x i8] c"%d %d %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 i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 -1, i32* %8
store i32 -1, i32* %6
store i32 -1, i32* %7
%9 = call i32 @sscanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %6, i32* %7)
store i32 %9, i32* %8
%10 = load i32, i32* %8
%11 = load i32, i32* %7
%12 = load i32, i32* %6
%13 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %10, i32 %11, i32 %12)
%14 = load i32, i32* %8
%15 = icmp ne i32 %14, 1
br i1 %15, label %22, label %16
16: ; preds = %2
%17 = load i32, i32* %6
%18 = icmp ne i32 %17, 1234
br i1 %18, label %22, label %19
19: ; preds = %16
%20 = load i32, i32* %7
%21 = icmp ne i32 %20, 4
br i1 %21, label %22, label %24
22: ; preds = %19, %16, %2
%23 = call i32 (...) @abort()
unreachable
24: ; preds = %19
ret i32 0
}

LLVM IR (-O2):
@.str = [9 x i8] c"1234:567\00"
@.str.1 = [5 x i8] c"%d%n\00"
@.str.2 = [10 x i8] c"%d %d %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32* %4 to i8*
store i32 -1, i32* %3
store i32 -1, i32* %4
%7 = call i32 @sscanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.1, i64 0, i64 0), i32* %3, i32* %4)
%8 = load i32, i32* %4
%9 = load i32, i32* %3
%10 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i32 %7, i32 %8, i32 %9)
%11 = icmp ne i32 %7, 1
%12 = load i32, i32* %3
%13 = icmp ne i32 %12, 1234
%14 = select i1 %11, i1 true, i1 %13
%15 = load i32, i32* %4
%16 = icmp ne i32 %15, 4
%17 = select i1 %14, i1 true, i1 %16
br i1 %17, label %18, label %20
18: ; preds = %2
%19 = call i32 (...) @abort()
unreachable
20: ; preds = %2
ret i32 0
}