#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 BUFSIZ;
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, int, char *);
int /*<<< orphan*/ fputs(char *, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ sprintf(char *, char *, int /*<<< orphan*/ *);
int sscanf(char *, char *, ...);
int /*<<< orphan*/ stdout;
scalar_t__ strcmp(char *, char *);
int main(int argc, char **argv) {
  char buf[BUFSIZ];
  int x;
  int result = 0;
  fputs("Test 1\n", stdout);
  if (sscanf("0", "%d", &x) != 1) {
    fputs("test failed!\n", stdout);
    result = 1;
  }
  fputs("Test 2\n", stdout);
  sscanf("conversion] Zero flag Ze]ro#\n", "%*[^]] %[^#]\n", buf);
  if (strcmp(buf, "] Zero flag Ze]ro") != 0) {
    fputs("test failed!\n", stdout);
    result = 1;
  }
  fputs("Test 3\n", stdout);
  {
    char name[50];
    fprintf(stdout,
            "sscanf (\"thompson\", \"%%s\", name) == %d, name == \"%s\"\n",
            sscanf("thompson", "%s", name), name);
    if (strcmp(name, "thompson") != 0) {
      fputs("test failed!\n", stdout);
      result = 1;
    }
  }
  fputs("Test 4:\n", stdout);
  {
    int res, val, n;
    res = sscanf("-242", "%3o%n", &val, &n);
    printf("res = %d, val = %d, n = %d\n", res, val, n);
    if (res != 1 || val != -20 || n != 3) {
      fputs("test failed!\n", stdout);
      result = 1;
    }
  }
  fputs("Test 5:\n", stdout);
  {
    char *p = (char *)-1;
    int res;
    sprintf(buf, "%p", NULL);
    res = sscanf(buf, "%p", &p);
    printf("sscanf (\"%s\", \"%%p\", &p) = %d, p == %p\n", buf, res, p);
    if (res != 1 || p != NULL) {
      fputs("test failed!\n", stdout);
      result = 1;
    }
  }
  fputs("Test 6:\n", stdout);
  {
    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) {
      fputs("test failed!\n", stdout);
      result = 1;
    }
  }
  exit(result);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0xa0,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0x2e50(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%rcx
mov    %rcx,-0x18(%rbp)
mov    %rax,%rdx
add    $0xf,%rdx
and    $0xfffffffffffffff0,%rdx
mov    %rsp,%rcx
sub    %rdx,%rcx
mov    %rcx,-0x90(%rbp)
mov    %rcx,%rsp
mov    %rax,-0x20(%rbp)
movl   $0x0,-0x28(%rbp)
mov    0x2e12(%rip),%rax
mov    (%rax),%esi
lea    0xe31(%rip),%rdi
call   1040 <fputs@plt>
lea    0xe2d(%rip),%rdi
lea    0xe28(%rip),%rsi
lea    -0x24(%rbp),%rdx
mov    $0x0,%al
call   1070 <sscanf@plt>
cmp    $0x1,%eax
je     1212 <main+0xa2>
mov    0x2ddb(%rip),%rax
mov    (%rax),%esi
lea    0xe07(%rip),%rdi
call   1040 <fputs@plt>
movl   $0x1,-0x28(%rbp)
mov    0x2dbf(%rip),%rax
mov    (%rax),%esi
lea    0xdf9(%rip),%rdi
call   1040 <fputs@plt>
mov    -0x90(%rbp),%rdx
lea    0xdee(%rip),%rdi
lea    0xe05(%rip),%rsi
mov    $0x0,%al
call   1070 <sscanf@plt>
mov    -0x90(%rbp),%rdi
lea    0xdfe(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     127c <main+0x10c>
mov    0x2d71(%rip),%rax
mov    (%rax),%esi
lea    0xd9d(%rip),%rdi
call   1040 <fputs@plt>
movl   $0x1,-0x28(%rbp)
mov    0x2d55(%rip),%rax
mov    (%rax),%esi
lea    0xdd5(%rip),%rdi
call   1040 <fputs@plt>
mov    0x2d40(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x94(%rbp)
lea    -0x60(%rbp),%rdx
lea    0xdf4(%rip),%rdi
lea    0xdf6(%rip),%rsi
mov    $0x0,%al
call   1070 <sscanf@plt>
mov    -0x94(%rbp),%edi
mov    %eax,%edx
lea    -0x60(%rbp),%rcx
lea    0xd9d(%rip),%rsi
call   1060 <fprintf@plt>
lea    -0x60(%rbp),%rdi
lea    0xdc3(%rip),%rsi
call   1050 <strcmp@plt>
cmp    $0x0,%rax
je     1307 <main+0x197>
mov    0x2ce6(%rip),%rax
mov    (%rax),%esi
lea    0xd12(%rip),%rdi
call   1040 <fputs@plt>
movl   $0x1,-0x28(%rbp)
mov    0x2cca(%rip),%rax
mov    (%rax),%esi
lea    0xd94(%rip),%rdi
call   1040 <fputs@plt>
lea    0xd91(%rip),%rdi
lea    0xd8f(%rip),%rsi
lea    -0x68(%rbp),%rdx
lea    -0x6c(%rbp),%rcx
mov    $0x0,%al
call   1070 <sscanf@plt>
mov    %eax,-0x64(%rbp)
mov    -0x64(%rbp),%esi
mov    -0x68(%rbp),%edx
mov    -0x6c(%rbp),%ecx
lea    0xd73(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x1,-0x64(%rbp)
jne    1371 <main+0x201>
cmpl   $0xffffffec,-0x68(%rbp)
jne    1371 <main+0x201>
cmpl   $0x3,-0x6c(%rbp)
je     138d <main+0x21d>
mov    0x2c60(%rip),%rax
mov    (%rax),%esi
lea    0xc8c(%rip),%rdi
call   1040 <fputs@plt>
movl   $0x1,-0x28(%rbp)
mov    0x2c44(%rip),%rax
mov    (%rax),%esi
lea    0xd3e(%rip),%rdi
call   1040 <fputs@plt>
mov    -0x90(%rbp),%rdi
mov    $0xffffffffffffffff,%rax
mov    %rax,-0x78(%rbp)
lea    0xd29(%rip),%rsi
xor    %eax,%eax
mov    %eax,%edx
call   1080 <sprintf@plt>
mov    -0x90(%rbp),%rdi
lea    0xd12(%rip),%rsi
lea    -0x78(%rbp),%rdx
mov    $0x0,%al
call   1070 <sscanf@plt>
mov    -0x90(%rbp),%rsi
mov    %eax,-0x7c(%rbp)
mov    -0x7c(%rbp),%edx
mov    -0x78(%rbp),%rcx
lea    0xcf2(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x1,-0x7c(%rbp)
jne    1411 <main+0x2a1>
cmpq   $0x0,-0x78(%rbp)
je     142d <main+0x2bd>
mov    0x2bc0(%rip),%rax
mov    (%rax),%esi
lea    0xbec(%rip),%rdi
call   1040 <fputs@plt>
movl   $0x1,-0x28(%rbp)
mov    0x2ba4(%rip),%rax
mov    (%rax),%esi
lea    0xcd2(%rip),%rdi
call   1040 <fputs@plt>
movl   $0xffffffff,-0x88(%rbp)
ff ff ff
movl   $0xffffffff,-0x80(%rbp)
movl   $0xffffffff,-0x84(%rbp)
ff ff ff
lea    0xcb4(%rip),%rdi
lea    0xcb6(%rip),%rsi
lea    -0x80(%rbp),%rdx
lea    -0x84(%rbp),%rcx
mov    $0x0,%al
call   1070 <sscanf@plt>
mov    %eax,-0x88(%rbp)
mov    -0x88(%rbp),%esi
mov    -0x84(%rbp),%edx
mov    -0x80(%rbp),%ecx
lea    0xc8d(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x1,-0x88(%rbp)
jne    14c7 <main+0x357>
cmpl   $0x4d2,-0x80(%rbp)
jne    14c7 <main+0x357>
cmpl   $0x4,-0x84(%rbp)
je     14e3 <main+0x373>
mov    0x2b0a(%rip),%rax
mov    (%rax),%esi
lea    0xb36(%rip),%rdi
call   1040 <fputs@plt>
movl   $0x1,-0x28(%rbp)
mov    -0x28(%rbp),%edi
call   1090 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbp
mov    %rsp,%rbp
push   %r15
push   %r14
push   %r13
push   %r12
push   %rbx
sub    $0x48,%rsp
mov    0x2e58(%rip),%rax
mov    (%rax),%eax
mov    %rsp,%r15
add    $0xf,%rax
and    $0xfffffffffffffff0,%rax
sub    %rax,%r15
mov    %r15,%rsp
mov    0x2e36(%rip),%rbx
mov    (%rbx),%esi
lea    0xe55(%rip),%rdi
call   1040 <fputs@plt>
lea    0xe51(%rip),%rdi
lea    0xe4c(%rip),%rsi
xor    %r14d,%r14d
lea    -0x30(%rbp),%rdx
xor    %eax,%eax
call   1070 <sscanf@plt>
cmp    $0x1,%eax
je     11e5 <main+0x75>
mov    (%rbx),%esi
lea    0xe33(%rip),%rdi
call   1040 <fputs@plt>
mov    $0x1,%r14d
mov    (%rbx),%esi
lea    0xe2d(%rip),%rdi
call   1040 <fputs@plt>
lea    0xe29(%rip),%rdi
lea    0xe40(%rip),%rsi
mov    %r15,%rdx
xor    %eax,%eax
call   1070 <sscanf@plt>
lea    0xe3d(%rip),%rsi
mov    %r15,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
je     1233 <main+0xc3>
mov    (%rbx),%esi
lea    0xde5(%rip),%rdi
call   1040 <fputs@plt>
mov    $0x1,%r14d
mov    (%rbx),%esi
lea    0xe25(%rip),%rdi
call   1040 <fputs@plt>
mov    (%rbx),%ebx
lea    0xe55(%rip),%r12
lea    0xe57(%rip),%rsi
lea    -0x70(%rbp),%r13
mov    %r12,%rdi
mov    %r13,%rdx
xor    %eax,%eax
call   1070 <sscanf@plt>
lea    0xe00(%rip),%rsi
mov    %ebx,%edi
mov    %eax,%edx
mov    %r13,%rcx
call   1060 <fprintf@plt>
mov    %r13,%rdi
mov    %r12,%rsi
mov    0x2d56(%rip),%r12
call   1050 <strcmp@plt>
test   %rax,%rax
je     12a2 <main+0x132>
mov    (%r12),%esi
lea    0xd76(%rip),%rdi
call   1040 <fputs@plt>
mov    $0x1,%r14d
mov    (%r12),%esi
lea    0xdfe(%rip),%rdi
call   1040 <fputs@plt>
lea    0xdfb(%rip),%rdi
lea    0xdf9(%rip),%rsi
lea    -0x70(%rbp),%rdx
lea    -0x2c(%rbp),%rcx
xor    %eax,%eax
call   1070 <sscanf@plt>
mov    %eax,%ebx
mov    -0x70(%rbp),%edx
mov    -0x2c(%rbp),%ecx
lea    0xde1(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmp    $0x1,%ebx
jne    12f8 <main+0x188>
cmpl   $0xffffffec,-0x70(%rbp)
jne    12f8 <main+0x188>
cmpl   $0x3,-0x2c(%rbp)
je     130e <main+0x19e>
mov    (%r12),%esi
lea    0xd0a(%rip),%rdi
call   1040 <fputs@plt>
mov    $0x1,%r14d
mov    (%r12),%esi
lea    0xdc2(%rip),%rdi
call   1040 <fputs@plt>
movq   $0xffffffffffffffff,-0x70(%rbp)
ff
lea    0xdb7(%rip),%rbx
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %edx,%edx
call   1080 <sprintf@plt>
lea    -0x70(%rbp),%rdx
mov    %r15,%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1070 <sscanf@plt>
mov    %eax,%ebx
mov    -0x70(%rbp),%rcx
lea    0xd8f(%rip),%rdi
mov    %r15,%rsi
mov    %eax,%edx
xor    %eax,%eax
call   1030 <printf@plt>
cmp    $0x1,%ebx
jne    1370 <main+0x200>
cmpq   $0x0,-0x70(%rbp)
je     1386 <main+0x216>
mov    (%r12),%esi
lea    0xc92(%rip),%rdi
call   1040 <fputs@plt>
mov    $0x1,%r14d
mov    (%r12),%esi
lea    0xd7e(%rip),%rdi
call   1040 <fputs@plt>
movl   $0xffffffff,-0x70(%rbp)
movl   $0xffffffff,-0x2c(%rbp)
lea    0xd6d(%rip),%rdi
lea    0xd6f(%rip),%rsi
lea    -0x70(%rbp),%rdx
lea    -0x2c(%rbp),%rcx
xor    %eax,%eax
call   1070 <sscanf@plt>
mov    %eax,%ebx
mov    -0x2c(%rbp),%edx
mov    -0x70(%rbp),%ecx
lea    0xd56(%rip),%rdi
mov    %eax,%esi
xor    %eax,%eax
call   1030 <printf@plt>
cmp    $0x1,%ebx
jne    13f5 <main+0x285>
cmpl   $0x4d2,-0x70(%rbp)
jne    13f5 <main+0x285>
cmpl   $0x4,-0x2c(%rbp)
jne    13f5 <main+0x285>
mov    %r14d,%edi
call   1090 <exit@plt>
mov    (%r12),%esi
lea    0xc0d(%rip),%rdi
call   1040 <fputs@plt>
mov    $0x1,%r14d
mov    %r14d,%edi
call   1090 <exit@plt>

LLVM IR (-O0):
@BUFSIZ = global i32 0
@.str = [8 x i8] c"Test 1\0A\00"
@stdout = global i32 0
@.str.1 = [2 x i8] c"0\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [14 x i8] c"test failed!\0A\00"
@.str.4 = [8 x i8] c"Test 2\0A\00"
@.str.5 = [30 x i8] c"conversion] Zero flag Ze]ro#\0A\00"
@.str.6 = [14 x i8] c"%*[^]] %[^#]\0A\00"
@.str.7 = [18 x i8] c"] Zero flag Ze]ro\00"
@.str.8 = [8 x i8] c"Test 3\0A\00"
@.str.9 = [54 x i8] c"sscanf (\22thompson\22, \22%%s\22, name) == %d, name == \22%s\22\0A\00"
@.str.10 = [9 x i8] c"thompson\00"
@.str.11 = [3 x i8] c"%s\00"
@.str.12 = [9 x i8] c"Test 4:\0A\00"
@.str.13 = [5 x i8] c"-242\00"
@.str.14 = [6 x i8] c"%3o%n\00"
@.str.15 = [28 x i8] c"res = %d, val = %d, n = %d\0A\00"
@.str.16 = [9 x i8] c"Test 5:\0A\00"
@.str.17 = [3 x i8] c"%p\00"
@.str.18 = [40 x i8] c"sscanf (\22%s\22, \22%%p\22, &p) = %d, p == %p\0A\00"
@.str.19 = [9 x i8] c"Test 6:\0A\00"
@.str.20 = [9 x i8] c"1234:567\00"
@.str.21 = [5 x i8] c"%d%n\00"
@.str.22 = [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 i8*
%7 = alloca i64
%8 = alloca i32
%9 = alloca i32
%10 = alloca [50 x i8]
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i8*
%15 = alloca i32
%16 = alloca i32
%17 = alloca i32
%18 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%19 = load i32, i32* @BUFSIZ
%20 = zext i32 %19 to i64
%21 = call i8* @llvm.stacksave()
store i8* %21, i8** %6
%22 = alloca i8, i64 %20
store i64 %20, i64* %7
store i32 0, i32* %9
%23 = load i32, i32* @stdout
%24 = call i32 @fputs(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %23)
%25 = call i32 (i8*, i8*, ...) @sscanf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %8)
%26 = icmp ne i32 %25, 1
br i1 %26, label %27, label %30
27: ; preds = %2
%28 = load i32, i32* @stdout
%29 = call i32 @fputs(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %28)
store i32 1, i32* %9
br label %30
30: ; preds = %27, %2
%31 = load i32, i32* @stdout
%32 = call i32 @fputs(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i32 %31)
%33 = call i32 (i8*, i8*, ...) @sscanf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i8* %22)
%34 = call i64 @strcmp(i8* %22, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0))
%35 = icmp ne i64 %34, 0
br i1 %35, label %36, label %39
36: ; preds = %30
%37 = load i32, i32* @stdout
%38 = call i32 @fputs(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %37)
store i32 1, i32* %9
br label %39
39: ; preds = %36, %30
%40 = load i32, i32* @stdout
%41 = call i32 @fputs(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i32 %40)
%42 = load i32, i32* @stdout
%43 = getelementptr inbounds [50 x i8], [50 x i8]* %10, i64 0, i64 0
%44 = call i32 (i8*, i8*, ...) @sscanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), i8* %43)
%45 = getelementptr inbounds [50 x i8], [50 x i8]* %10, i64 0, i64 0
%46 = call i32 @fprintf(i32 %42, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.9, i64 0, i64 0), i32 %44, i8* %45)
%47 = getelementptr inbounds [50 x i8], [50 x i8]* %10, i64 0, i64 0
%48 = call i64 @strcmp(i8* %47, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0))
%49 = icmp ne i64 %48, 0
br i1 %49, label %50, label %53
50: ; preds = %39
%51 = load i32, i32* @stdout
%52 = call i32 @fputs(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %51)
store i32 1, i32* %9
br label %53
53: ; preds = %50, %39
%54 = load i32, i32* @stdout
%55 = call i32 @fputs(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.12, i64 0, i64 0), i32 %54)
%56 = call i32 (i8*, i8*, ...) @sscanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0), i32* %12, i32* %13)
store i32 %56, i32* %11
%57 = load i32, i32* %11
%58 = load i32, i32* %12
%59 = load i32, i32* %13
%60 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str.15, i64 0, i64 0), i32 %57, i32 %58, i32 %59)
%61 = load i32, i32* %11
%62 = icmp ne i32 %61, 1
br i1 %62, label %69, label %63
63: ; preds = %53
%64 = load i32, i32* %12
%65 = icmp ne i32 %64, -20
br i1 %65, label %69, label %66
66: ; preds = %63
%67 = load i32, i32* %13
%68 = icmp ne i32 %67, 3
br i1 %68, label %69, label %72
69: ; preds = %66, %63, %53
%70 = load i32, i32* @stdout
%71 = call i32 @fputs(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %70)
store i32 1, i32* %9
br label %72
72: ; preds = %69, %66
%73 = load i32, i32* @stdout
%74 = call i32 @fputs(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.16, i64 0, i64 0), i32 %73)
store i8* inttoptr (i64 -1 to i8*), i8** %14
%75 = call i32 @sprintf(i8* %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.17, i64 0, i64 0), i32* null)
%76 = call i32 (i8*, i8*, ...) @sscanf(i8* %22, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.17, i64 0, i64 0), i8** %14)
store i32 %76, i32* %15
%77 = load i32, i32* %15
%78 = load i8*, i8** %14
%79 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([40 x i8], [40 x i8]* @.str.18, i64 0, i64 0), i8* %22, i32 %77, i8* %78)
%80 = load i32, i32* %15
%81 = icmp ne i32 %80, 1
br i1 %81, label %85, label %82
82: ; preds = %72
%83 = load i8*, i8** %14
%84 = icmp ne i8* %83, null
br i1 %84, label %85, label %88
85: ; preds = %82, %72
%86 = load i32, i32* @stdout
%87 = call i32 @fputs(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %86)
store i32 1, i32* %9
br label %88
88: ; preds = %85, %82
%89 = load i32, i32* @stdout
%90 = call i32 @fputs(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.19, i64 0, i64 0), i32 %89)
store i32 -1, i32* %18
store i32 -1, i32* %16
store i32 -1, i32* %17
%91 = call i32 (i8*, i8*, ...) @sscanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.20, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.21, i64 0, i64 0), i32* %16, i32* %17)
store i32 %91, i32* %18
%92 = load i32, i32* %18
%93 = load i32, i32* %17
%94 = load i32, i32* %16
%95 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.22, i64 0, i64 0), i32 %92, i32 %93, i32 %94)
%96 = load i32, i32* %18
%97 = icmp ne i32 %96, 1
br i1 %97, label %104, label %98
98: ; preds = %88
%99 = load i32, i32* %16
%100 = icmp ne i32 %99, 1234
br i1 %100, label %104, label %101
101: ; preds = %98
%102 = load i32, i32* %17
%103 = icmp ne i32 %102, 4
br i1 %103, label %104, label %107
104: ; preds = %101, %98, %88
%105 = load i32, i32* @stdout
%106 = call i32 @fputs(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %105)
store i32 1, i32* %9
br label %107
107: ; preds = %104, %101
%108 = load i32, i32* %9
%109 = call i32 @exit(i32 %108)
unreachable
}

LLVM IR (-O2):
@BUFSIZ = global i32 0
@.str = [8 x i8] c"Test 1\0A\00"
@stdout = global i32 0
@.str.1 = [2 x i8] c"0\00"
@.str.2 = [3 x i8] c"%d\00"
@.str.3 = [14 x i8] c"test failed!\0A\00"
@.str.4 = [8 x i8] c"Test 2\0A\00"
@.str.5 = [30 x i8] c"conversion] Zero flag Ze]ro#\0A\00"
@.str.6 = [14 x i8] c"%*[^]] %[^#]\0A\00"
@.str.7 = [18 x i8] c"] Zero flag Ze]ro\00"
@.str.8 = [8 x i8] c"Test 3\0A\00"
@.str.9 = [54 x i8] c"sscanf (\22thompson\22, \22%%s\22, name) == %d, name == \22%s\22\0A\00"
@.str.10 = [9 x i8] c"thompson\00"
@.str.11 = [3 x i8] c"%s\00"
@.str.12 = [9 x i8] c"Test 4:\0A\00"
@.str.13 = [5 x i8] c"-242\00"
@.str.14 = [6 x i8] c"%3o%n\00"
@.str.15 = [28 x i8] c"res = %d, val = %d, n = %d\0A\00"
@.str.16 = [9 x i8] c"Test 5:\0A\00"
@.str.17 = [3 x i8] c"%p\00"
@.str.18 = [40 x i8] c"sscanf (\22%s\22, \22%%p\22, &p) = %d, p == %p\0A\00"
@.str.19 = [9 x i8] c"Test 6:\0A\00"
@.str.20 = [9 x i8] c"1234:567\00"
@.str.21 = [5 x i8] c"%d%n\00"
@.str.22 = [10 x i8] c"%d %d %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca i32
%4 = alloca [50 x i8]
%5 = alloca i32
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
%10 = load i32, i32* @BUFSIZ
%11 = zext i32 %10 to i64
%12 = alloca i8, i64 %11
%13 = bitcast i32* %3 to i8*
%14 = load i32, i32* @stdout
%15 = tail call i32 @fputs(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %14)
%16 = call i32 (i8*, i8*, ...) @sscanf(i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i32* %3)
%17 = icmp eq i32 %16, 1
br i1 %17, label %21, label %18
18: ; preds = %2
%19 = load i32, i32* @stdout
%20 = call i32 @fputs(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %19)
br label %21
21: ; preds = %18, %2
%22 = phi i32 [ 1, %18 ], [ 0, %2 ]
%23 = load i32, i32* @stdout
%24 = call i32 @fputs(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.4, i64 0, i64 0), i32 %23)
%25 = call i32 (i8*, i8*, ...) @sscanf(i8* getelementptr inbounds ([30 x i8], [30 x i8]* @.str.5, i64 0, i64 0), i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.6, i64 0, i64 0), i8* %12)
%26 = call i64 @strcmp(i8* %12, i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.7, i64 0, i64 0))
%27 = icmp eq i64 %26, 0
br i1 %27, label %31, label %28
28: ; preds = %21
%29 = load i32, i32* @stdout
%30 = call i32 @fputs(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %29)
br label %31
31: ; preds = %28, %21
%32 = phi i32 [ 1, %28 ], [ %22, %21 ]
%33 = load i32, i32* @stdout
%34 = call i32 @fputs(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.8, i64 0, i64 0), i32 %33)
%35 = getelementptr inbounds [50 x i8], [50 x i8]* %4, i64 0, i64 0
%36 = load i32, i32* @stdout
%37 = call i32 (i8*, i8*, ...) @sscanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.11, i64 0, i64 0), i8* %35)
%38 = call i32 @fprintf(i32 %36, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.9, i64 0, i64 0), i32 %37, i8* %35)
%39 = call i64 @strcmp(i8* %35, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.10, i64 0, i64 0))
%40 = icmp eq i64 %39, 0
br i1 %40, label %44, label %41
41: ; preds = %31
%42 = load i32, i32* @stdout
%43 = call i32 @fputs(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %42)
br label %44
44: ; preds = %41, %31
%45 = phi i32 [ 1, %41 ], [ %32, %31 ]
%46 = load i32, i32* @stdout
%47 = call i32 @fputs(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.12, i64 0, i64 0), i32 %46)
%48 = bitcast i32* %5 to i8*
%49 = bitcast i32* %6 to i8*
%50 = call i32 (i8*, i8*, ...) @sscanf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.13, i64 0, i64 0), i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.14, i64 0, i64 0), i32* %5, i32* %6)
%51 = load i32, i32* %5
%52 = load i32, i32* %6
%53 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([28 x i8], [28 x i8]* @.str.15, i64 0, i64 0), i32 %50, i32 %51, i32 %52)
%54 = icmp ne i32 %50, 1
%55 = load i32, i32* %5
%56 = icmp ne i32 %55, -20
%57 = select i1 %54, i1 true, i1 %56
%58 = load i32, i32* %6
%59 = icmp ne i32 %58, 3
%60 = select i1 %57, i1 true, i1 %59
br i1 %60, label %61, label %64
61: ; preds = %44
%62 = load i32, i32* @stdout
%63 = call i32 @fputs(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %62)
br label %64
64: ; preds = %44, %61
%65 = phi i32 [ 1, %61 ], [ %45, %44 ]
%66 = load i32, i32* @stdout
%67 = call i32 @fputs(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.16, i64 0, i64 0), i32 %66)
%68 = bitcast i8** %7 to i8*
store i8* inttoptr (i64 -1 to i8*), i8** %7
%69 = call i32 @sprintf(i8* %12, i8* dereferenceable(1) getelementptr inbounds ([3 x i8], [3 x i8]* @.str.17, i64 0, i64 0), i32* null)
%70 = call i32 (i8*, i8*, ...) @sscanf(i8* %12, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.17, i64 0, i64 0), i8** %7)
%71 = load i8*, i8** %7
%72 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @.str.18, i64 0, i64 0), i8* %12, i32 %70, i8* %71)
%73 = icmp ne i32 %70, 1
%74 = load i8*, i8** %7
%75 = icmp ne i8* %74, null
%76 = select i1 %73, i1 true, i1 %75
br i1 %76, label %77, label %80
77: ; preds = %64
%78 = load i32, i32* @stdout
%79 = call i32 @fputs(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %78)
br label %80
80: ; preds = %64, %77
%81 = phi i32 [ 1, %77 ], [ %65, %64 ]
%82 = load i32, i32* @stdout
%83 = call i32 @fputs(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.19, i64 0, i64 0), i32 %82)
%84 = bitcast i32* %8 to i8*
%85 = bitcast i32* %9 to i8*
store i32 -1, i32* %8
store i32 -1, i32* %9
%86 = call i32 (i8*, i8*, ...) @sscanf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str.20, i64 0, i64 0), i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.21, i64 0, i64 0), i32* %8, i32* %9)
%87 = load i32, i32* %9
%88 = load i32, i32* %8
%89 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.22, i64 0, i64 0), i32 %86, i32 %87, i32 %88)
%90 = icmp ne i32 %86, 1
%91 = load i32, i32* %8
%92 = icmp ne i32 %91, 1234
%93 = select i1 %90, i1 true, i1 %92
%94 = load i32, i32* %9
%95 = icmp ne i32 %94, 4
%96 = select i1 %93, i1 true, i1 %95
br i1 %96, label %97, label %100
97: ; preds = %80
%98 = load i32, i32* @stdout
%99 = call i32 @fputs(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.3, i64 0, i64 0), i32 %98)
br label %100
100: ; preds = %80, %97
%101 = phi i32 [ 1, %97 ], [ %81, %80 ]
%102 = call i32 @exit(i32 %101)
unreachable
}