#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*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ printf(char *);
int /*<<< orphan*/ stderr;
int tlib7func();
int main(int ac, char *av[]) {
  if (ac > 1000) {
    return *av[0];
  }
  printf("This is T9. This one should work.\n");
  if (tlib7func() != 7) {
    fprintf(stderr, "Something wrong with T7\n");
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpl   $0x3e8,-0x8(%rbp)
jle    1165 <main+0x35>
mov    -0x10(%rbp),%rax
mov    (%rax),%rax
movsbl (%rax),%eax
mov    %eax,-0x4(%rbp)
jmp    11a9 <main+0x79>
lea    0xe94(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1050 <tlib7func@plt>
cmp    $0x7,%eax
je     11a2 <main+0x72>
mov    0x2e58(%rip),%rax
mov    (%rax),%edi
lea    0xe92(%rip),%rsi
call   1040 <fprintf@plt>
movl   $0x1,-0x4(%rbp)
jmp    11a9 <main+0x79>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
cmp    $0x3e9,%edi
jl     1141 <main+0x11>
mov    (%rsi),%rax
movsbl (%rax),%ebx
jmp    1175 <main+0x45>
lea    0xed1(%rip),%rdi
call   1030 <puts@plt>
xor    %ebx,%ebx
xor    %eax,%eax
call   1050 <tlib7func@plt>
cmp    $0x7,%eax
je     1175 <main+0x45>
mov    0x2e7e(%rip),%rax
mov    (%rax),%edi
lea    0xe95(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [35 x i8] c"This is T9. This one should work.\0A\00"
@stderr = global i32 0
@.str.1 = [25 x i8] c"Something wrong with T7\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = load i32, i32* %4
%7 = icmp sgt i32 %6, 1000
br i1 %7, label %8, label %14
8: ; preds = %2
%9 = load i8**, i8*** %5
%10 = getelementptr inbounds i8*, i8** %9, i64 0
%11 = load i8*, i8** %10
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
store i32 %13, i32* %3
br label %22
14: ; preds = %2
%15 = call i32 @printf(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%16 = call i32 (...) @tlib7func()
%17 = icmp ne i32 %16, 7
br i1 %17, label %18, label %21
18: ; preds = %14
%19 = load i32, i32* @stderr
%20 = call i32 @fprintf(i32 %19, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
store i32 1, i32* %3
br label %22
21: ; preds = %14
store i32 0, i32* %3
br label %22
22: ; preds = %21, %18, %8
%23 = load i32, i32* %3
ret i32 %23
}

LLVM IR (-O2):
@stderr = global i32 0
@.str.1 = [25 x i8] c"Something wrong with T7\0A\00"
@str = [34 x i8] c"This is T9. This one should work.\00"
define i32 @main(i32 %0, i8** nocapture %1) {
%3 = icmp sgt i32 %0, 1000
br i1 %3, label %4, label %8
4: ; preds = %2
%5 = load i8*, i8** %1
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
br label %15
8: ; preds = %2
%9 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([34 x i8], [34 x i8]* @str, i64 0, i64 0))
%10 = tail call i32 (...) @tlib7func()
%11 = icmp eq i32 %10, 7
br i1 %11, label %15, label %12
12: ; preds = %8
%13 = load i32, i32* @stderr
%14 = tail call i32 @fprintf(i32 %13, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.1, i64 0, i64 0))
br label %15
15: ; preds = %8, %12, %4
%16 = phi i32 [ %7, %4 ], [ 1, %12 ], [ 0, %8 ]
ret i32 %16
}