#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 */
typedef int /*<<< orphan*/ str2;

/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, char, int /*<<< orphan*/);
int strncmp(char *, char *, int);
int main(int argc, char **argv) {
  int result = -1;
  char str1[32] = "iello world";
  char str2[32] = {
      '\0',
  };
  result = strncmp(str1, str2, sizeof(str2));
  printf("result=%d %d %d\n", result, 'i', '0');
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x60,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movl   $0xffffffff,-0x14(%rbp)
mov    0xeac(%rip),%rax
mov    %rax,-0x40(%rbp)
mov    0xea9(%rip),%rax
mov    %rax,-0x38(%rbp)
mov    0xea6(%rip),%rax
mov    %rax,-0x30(%rbp)
mov    0xea3(%rip),%rax
mov    %rax,-0x28(%rbp)
lea    -0x60(%rbp),%rdi
xor    %esi,%esi
mov    $0x20,%edx
call   1050 <memset@plt>
lea    -0x40(%rbp),%rdi
lea    -0x60(%rbp),%rsi
mov    $0x20,%edx
call   1030 <strncmp@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%esi
lea    0xe78(%rip),%rdi
mov    $0x69,%edx
mov    $0x30,%ecx
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x60,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x48,%rsp
movaps 0xee5(%rip),%xmm0
movaps %xmm0,0x30(%rsp)
movaps 0xec9(%rip),%xmm0
movaps %xmm0,0x20(%rsp)
xorps  %xmm0,%xmm0
movaps %xmm0,0x10(%rsp)
movaps %xmm0,(%rsp)
lea    0x20(%rsp),%rdi
mov    %rsp,%rsi
mov    $0x20,%edx
call   1030 <strncmp@plt>
lea    0xebf(%rip),%rdi
mov    %eax,%esi
mov    $0x69,%edx
mov    $0x30,%ecx
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x48,%rsp
ret

LLVM IR (-O0):
@__const.main.str1 = [32 x i8] c"iello world\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [17 x i8] c"result=%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 [32 x i8]
%8 = alloca [32 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i32 -1, i32* %6
%9 = bitcast [32 x i8]* %7 to i8*
%10 = bitcast [32 x i8]* %8 to i8*
%11 = getelementptr inbounds [32 x i8], [32 x i8]* %7, i64 0, i64 0
%12 = getelementptr inbounds [32 x i8], [32 x i8]* %8, i64 0, i64 0
%13 = call i32 @strncmp(i8* %11, i8* %12, i32 32)
store i32 %13, i32* %6
%14 = load i32, i32* %6
%15 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %14, i8 signext 105, i32 48)
ret i32 0
}

LLVM IR (-O2):
@__const.main.str1 = [32 x i8] c"iello world\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00\00"
@.str = [17 x i8] c"result=%d %d %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [32 x i8]
%4 = alloca [32 x i8]
%5 = getelementptr inbounds [32 x i8], [32 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [32 x i8], [32 x i8]* %4, i64 0, i64 0
%7 = call i32 @strncmp(i8* %5, i8* %6, i32 32)
%8 = call i32 @printf(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 %7, i8 signext 105, i32 48)
ret i32 0
}