#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*/ exit(int /*<<< orphan*/);
scalar_t__ memcmp(char *, char *, int);
int test1(char *, int);
int /*<<< orphan*/ test2(char *);
int main(void) {
  char buf[10];
  if (test1(buf, 7) != 8 || memcmp(buf, "az", 3))
    abort();
  test2(buf);
  if (memcmp(buf, "baz", 4))
    abort();
  exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    -0xe(%rbp),%rdi
mov    $0x7,%esi
call   1040 <test1@plt>
cmp    $0x8,%eax
jne    1195 <main+0x45>
lea    -0xe(%rbp),%rdi
lea    0xe80(%rip),%rsi
mov    $0x3,%edx
call   1050 <memcmp@plt>
cmp    $0x0,%rax
je     119c <main+0x4c>
mov    $0x0,%al
call   1030 <abort@plt>
lea    -0xe(%rbp),%rdi
call   1060 <test2@plt>
lea    -0xe(%rbp),%rdi
lea    0xe50(%rip),%rsi
mov    $0x4,%edx
call   1050 <memcmp@plt>
cmp    $0x0,%rax
je     11cb <main+0x7b>
mov    $0x0,%al
call   1030 <abort@plt>
xor    %edi,%edi
call   1070 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
lea    0x6(%rsp),%rdi
mov    $0x7,%esi
call   1040 <test1@plt>
cmp    $0x8,%eax
jne    11b1 <main+0x61>
lea    0xe91(%rip),%rsi
lea    0x6(%rsp),%rdi
mov    $0x3,%edx
call   1050 <memcmp@plt>
test   %rax,%rax
jne    11b1 <main+0x61>
lea    0x6(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <test2@plt>
lea    0xe68(%rip),%rsi
mov    %rbx,%rdi
mov    $0x4,%edx
call   1050 <memcmp@plt>
test   %rax,%rax
jne    11b1 <main+0x61>
xor    %edi,%edi
call   1070 <exit@plt>
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"az\00"
@.str.1 = [4 x i8] c"baz\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [10 x i8]
store i32 0, i32* %1
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%4 = call i32 @test1(i8* %3, i32 7)
%5 = icmp ne i32 %4, 8
br i1 %5, label %10, label %6
6: ; preds = %0
%7 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%8 = call i64 @memcmp(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 3)
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %12
10: ; preds = %6, %0
%11 = call i32 (...) @abort()
unreachable
12: ; preds = %6
%13 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%14 = call i32 @test2(i8* %13)
%15 = getelementptr inbounds [10 x i8], [10 x i8]* %2, i64 0, i64 0
%16 = call i64 @memcmp(i8* %15, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 4)
%17 = icmp ne i64 %16, 0
br i1 %17, label %18, label %20
18: ; preds = %12
%19 = call i32 (...) @abort()
unreachable
20: ; preds = %12
%21 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [3 x i8] c"az\00"
@.str.1 = [4 x i8] c"baz\00"
define i32 @main() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%3 = call i32 @test1(i8* %2, i32 7)
%4 = icmp eq i32 %3, 8
br i1 %4, label %5, label %8
5: ; preds = %0
%6 = call i64 @memcmp(i8* %2, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 3)
%7 = icmp eq i64 %6, 0
br i1 %7, label %10, label %8
8: ; preds = %5, %0
%9 = call i32 (...) @abort()
unreachable
10: ; preds = %5
%11 = call i32 @test2(i8* %2)
%12 = call i64 @memcmp(i8* %2, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 4)
%13 = icmp eq i64 %12, 0
br i1 %13, label %16, label %14
14: ; preds = %10
%15 = call i32 (...) @abort()
unreachable
16: ; preds = %10
%17 = call i32 @exit(i32 0)
unreachable
}