#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 *, char *);
int /*<<< orphan*/ sscanf(char *, char *, char *);
int q1n() {
  char a[32] = "0123456789";
  printf("\n%s\n", "q1n ------");
  sscanf("hi", "%s", a + 4);
  printf("%s\n", a + 2);
  return 1;
}


x86 assembly (clang, -O0):
<q1n>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    0xed1(%rip),%rax
mov    %rax,-0x20(%rbp)
mov    0xece(%rip),%rax
mov    %rax,-0x18(%rbp)
mov    0xecb(%rip),%rax
mov    %rax,-0x10(%rbp)
mov    0xec8(%rip),%rax
mov    %rax,-0x8(%rbp)
lea    0xec5(%rip),%rdi
lea    0xec3(%rip),%rsi
call   1030 <printf@plt>
lea    -0x20(%rbp),%rdx
add    $0x4,%rdx
lea    0xeba(%rip),%rdi
lea    0xeb6(%rip),%rsi
call   1040 <sscanf@plt>
lea    -0x20(%rbp),%rsi
add    $0x2,%rsi
lea    0xe90(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<q1n>:
sub    $0x28,%rsp
movaps 0xee5(%rip),%xmm0
movaps %xmm0,0x10(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,(%rsp)
lea    0xede(%rip),%rdi
lea    0xedc(%rip),%rsi
call   1030 <printf@plt>
lea    0x4(%rsp),%rdx
lea    0xed6(%rip),%rdi
lea    0xed2(%rip),%rsi
call   1040 <sscanf@plt>
lea    0x2(%rsp),%rsi
lea    0xeaf(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%eax
add    $0x28,%rsp
ret

LLVM IR (-O0):
@__const.q1n.a = [32 x i8] c"0123456789\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [5 x i8] c"\0A%s\0A\00"
@.str.1 = [11 x i8] c"q1n ------\00"
@.str.2 = [3 x i8] c"hi\00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [4 x i8] c"%s\0A\00"
define i32 @q1n() {
%1 = alloca [32 x i8]
%2 = bitcast [32 x i8]* %1 to i8*
%3 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%4 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 0
%5 = getelementptr inbounds i8, i8* %4, i64 4
%6 = call i32 @sscanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %5)
%7 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 0
%8 = getelementptr inbounds i8, i8* %7, i64 2
%9 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %8)
ret i32 1
}

LLVM IR (-O2):
@__const.q1n.a = [32 x i8] c"0123456789\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [5 x i8] c"\0A%s\0A\00"
@.str.1 = [11 x i8] c"q1n ------\00"
@.str.2 = [3 x i8] c"hi\00"
@.str.3 = [3 x i8] c"%s\00"
@.str.4 = [4 x i8] c"%s\0A\00"
define i32 @q1n() {
%1 = alloca [32 x i8]
%2 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 0
%3 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
%4 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 4
%5 = call i32 @sscanf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.2, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.3, i64 0, i64 0), i8* %4)
%6 = getelementptr inbounds [32 x i8], [32 x i8]* %1, i64 0, i64 2
%7 = call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.4, i64 0, i64 0), i8* %6)
ret i32 1
}