#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 strcpy(char *, char *);
int main(int argc, char const *argv[]) {
  char str1[] = "hello";
  char str2[10];
  if (strcpy(str1, str2) == 6) {
    if (str2[0] == 'h') {
      if (str2[4] == 'o') {
        return 0;
      }
      return 3;
    }
    return 2;
  }
  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)
mov    0xed4(%rip),%eax
mov    %eax,-0x16(%rbp)
mov    0xece(%rip),%ax
mov    %ax,-0x12(%rbp)
lea    -0x16(%rbp),%rdi
lea    -0x20(%rbp),%rsi
call   1030 <strcpy@plt>
cmp    $0x6,%eax
jne    118e <main+0x7e>
movsbl -0x20(%rbp),%eax
cmp    $0x68,%eax
jne    1182 <main+0x72>
movsbl -0x1c(%rbp),%eax
cmp    $0x6f,%eax
jne    1176 <main+0x66>
movl   $0x0,-0x4(%rbp)
jmp    1195 <main+0x85>
movl   $0x3,-0x4(%rbp)
jmp    1195 <main+0x85>
movl   $0x2,-0x4(%rbp)
jmp    1195 <main+0x85>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
sub    $0x18,%rsp
movw   $0x6f,0xc(%rsp)
movl   $0x6c6c6568,0x8(%rsp)
6c
lea    0x8(%rsp),%rdi
lea    0xe(%rsp),%rsi
call   1030 <strcpy@plt>
mov    %eax,%ecx
xor    %eax,%eax
cmp    $0x6,%ecx
jne    1154 <main+0x44>
mov    $0x2,%eax
cmpb   $0x68,0xe(%rsp)
jne    1154 <main+0x44>
xor    %eax,%eax
cmpb   $0x6f,0x12(%rsp)
setne  %al
lea    (%rax,%rax,2),%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.main.str1 = [6 x i8] c"hello\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca [6 x i8]
%7 = alloca [10 x i8]
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%8 = bitcast [6 x i8]* %6 to i8*
%9 = getelementptr inbounds [6 x i8], [6 x i8]* %6, i64 0, i64 0
%10 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%11 = call i32 @strcpy(i8* %9, i8* %10)
%12 = icmp eq i32 %11, 6
br i1 %12, label %13, label %26
13: ; preds = %2
%14 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 0
%15 = load i8, i8* %14
%16 = sext i8 %15 to i32
%17 = icmp eq i32 %16, 104
br i1 %17, label %18, label %25
18: ; preds = %13
%19 = getelementptr inbounds [10 x i8], [10 x i8]* %7, i64 0, i64 4
%20 = load i8, i8* %19
%21 = sext i8 %20 to i32
%22 = icmp eq i32 %21, 111
br i1 %22, label %23, label %24
23: ; preds = %18
store i32 0, i32* %3
br label %27
24: ; preds = %18
store i32 3, i32* %3
br label %27
25: ; preds = %13
store i32 2, i32* %3
br label %27
26: ; preds = %2
store i32 0, i32* %3
br label %27
27: ; preds = %26, %25, %24, %23
%28 = load i32, i32* %3
ret i32 %28
}

LLVM IR (-O2):
@__const.main.str1 = [6 x i8] c"hello\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [6 x i8]
%4 = alloca [10 x i8]
%5 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 0
%6 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 0
%7 = call i32 @strcpy(i8* %5, i8* %6)
%8 = icmp eq i32 %7, 6
br i1 %8, label %9, label %17
9: ; preds = %2
%10 = load i8, i8* %6
%11 = icmp eq i8 %10, 104
br i1 %11, label %12, label %17
12: ; preds = %9
%13 = getelementptr inbounds [10 x i8], [10 x i8]* %4, i64 0, i64 4
%14 = load i8, i8* %13
%15 = icmp eq i8 %14, 111
%16 = select i1 %15, i32 0, i32 3
br label %17
17: ; preds = %2, %9, %12
%18 = phi i32 [ %16, %12 ], [ 2, %9 ], [ 0, %2 ]
ret i32 %18
}