xunge/DecIR huggingface dataset:
int main(int argc, const char *argv[]) {
  char *ptr = &main;
  int i;
  for (i = 0;; i++) {
    putchar(*(ptr + i));
  }
  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    0x2ebb(%rip),%rax
mov    %rax,-0x18(%rbp)
movl   $0x0,-0x1c(%rbp)
mov    -0x18(%rbp),%rax
movslq -0x1c(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
mov    $0x0,%al
call   1030 <putchar@plt>
mov    -0x1c(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x1c(%rbp)
jmp    1138 <main+0x28>

x86 assembly (clang, -O2):
<main>:
push   %rbx
mov    0x2ed0(%rip),%rbx
nopl   0x0(%rax,%rax,1)
movsbl (%rbx),%edi
xor    %eax,%eax
call   1030 <putchar@plt>
add    $0x1,%rbx
jmp    1120 <main+0x10>

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i8*
%7 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
store i8* bitcast (i32 (i32, i8**)* @main to i8*), i8** %6
store i32 0, i32* %7
br label %8
8: ; preds = %16, %2
%9 = load i8*, i8** %6
%10 = load i32, i32* %7
%11 = sext i32 %10 to i64
%12 = getelementptr inbounds i8, i8* %9, i64 %11
%13 = load i8, i8* %12
%14 = sext i8 %13 to i32
%15 = call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 %14)
br label %16
16: ; preds = %8
%17 = load i32, i32* %7
%18 = add nsw i32 %17, 1
store i32 %18, i32* %7
br label %8
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i64 [ %9, %3 ], [ 0, %2 ]
%5 = getelementptr inbounds i8, i8* bitcast (i32 (i32, i8**)* @main to i8*), i64 %4
%6 = load i8, i8* %5
%7 = sext i8 %6 to i32
%8 = tail call i32 (i32, ...) bitcast (i32 (...)* @putchar to i32 (i32, ...)*)(i32 %7)
%9 = add nuw i64 %4, 1
br label %3
}
/* Variables and functions */
int /*<<< orphan*/ close(int);
void cleanup_close(void *_fd) {
  int fd = *(int *)_fd;
  close(fd);
}


x86 assembly (clang, -O0):
<cleanup_close>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
call   1030 <close@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cleanup_close>:
mov    (%rdi),%edi
jmp    1030 <close@plt>

LLVM IR (-O0):
define void @cleanup_close(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = bitcast i8* %4 to i32*
%6 = load i32, i32* %5
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = call i32 @close(i32 %7)
ret void
}

LLVM IR (-O2):
define void @cleanup_close(i8* nocapture %0) {
%2 = bitcast i8* %0 to i32*
%3 = load i32, i32* %2
%4 = tail call i32 @close(i32 %3)
ret void
}
int isenc(int ch) { return 0x21 <= ch && ch < 0x7f && ch != '?'; }


x86 assembly (clang, -O0):
<isenc>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
xor    %eax,%eax
mov    $0x21,%ecx
cmp    -0x4(%rbp),%ecx
mov    %al,-0x5(%rbp)
jg     1133 <isenc+0x33>
xor    %eax,%eax
cmpl   $0x7f,-0x4(%rbp)
mov    %al,-0x5(%rbp)
jge    1133 <isenc+0x33>
cmpl   $0x3f,-0x4(%rbp)
setne  %al
mov    %al,-0x5(%rbp)
mov    -0x5(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<isenc>:
lea    -0x21(%rdi),%eax
cmp    $0x5e,%eax
setb   %al
cmp    $0x3f,%edi
setne  %cl
and    %al,%cl
movzbl %cl,%eax
ret

LLVM IR (-O0):
define i32 @isenc(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp sle i32 33, %3
br i1 %4, label %5, label %11
5: ; preds = %1
%6 = load i32, i32* %2
%7 = icmp slt i32 %6, 127
br i1 %7, label %8, label %11
8: ; preds = %5
%9 = load i32, i32* %2
%10 = icmp ne i32 %9, 63
br label %11
11: ; preds = %8, %5, %1
%12 = phi i1 [ false, %5 ], [ false, %1 ], [ %10, %8 ]
%13 = zext i1 %12 to i32
ret i32 %13
}

LLVM IR (-O2):
define i32 @isenc(i32 %0) {
%2 = add i32 %0, -33
%3 = icmp ult i32 %2, 94
%4 = icmp ne i32 %0, 63
%5 = and i1 %4, %3
%6 = zext i1 %5 to i32
ret i32 %6
}
char *strcpy(char *dest, const char *src) {
  char *p = dest;
  while ((*dest++ = *src++))
    ;
  return p;
}


x86 assembly (clang, -O0):
<strcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    -0x8(%rbp),%rcx
mov    %rcx,%rdx
add    $0x1,%rdx
mov    %rdx,-0x8(%rbp)
mov    %al,(%rcx)
cmp    $0x0,%al
je     1143 <strcpy+0x43>
jmp    1114 <strcpy+0x14>
mov    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<strcpy>:
mov    %rdi,%rax
xor    %ecx,%ecx
cs nopw 0x0(%rax,%rax,1)
nop
movzbl (%rsi,%rcx,1),%edx
mov    %dl,(%rax,%rcx,1)
add    $0x1,%rcx
test   %dl,%dl
jne    1110 <strcpy+0x10>
ret

LLVM IR (-O0):
define i8* @strcpy(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %3
store i8* %6, i8** %5
br label %7
7: ; preds = %14, %2
%8 = load i8*, i8** %4
%9 = getelementptr inbounds i8, i8* %8, i32 1
store i8* %9, i8** %4
%10 = load i8, i8* %8
%11 = load i8*, i8** %3
%12 = getelementptr inbounds i8, i8* %11, i32 1
store i8* %12, i8** %3
store i8 %10, i8* %11
%13 = icmp ne i8 %10, 0
br i1 %13, label %14, label %15
14: ; preds = %7
br label %7
15: ; preds = %7
%16 = load i8*, i8** %5
ret i8* %16
}

LLVM IR (-O2):
define i8* @strcpy(i8* returned writeonly %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %1, %2 ], [ %6, %3 ]
%5 = phi i8* [ %0, %2 ], [ %8, %3 ]
%6 = getelementptr inbounds i8, i8* %4, i64 1
%7 = load i8, i8* %4
%8 = getelementptr inbounds i8, i8* %5, i64 1
store i8 %7, i8* %5
%9 = icmp eq i8 %7, 0
br i1 %9, label %10, label %3
10: ; preds = %3
ret i8* %0
}
void net_save32(unsigned char data[4], unsigned int num) {
  data[0] = num >> 24;
  data[1] = num >> 16;
  data[2] = num >> 8;
  data[3] = num >> 0;
}


x86 assembly (clang, -O0):
<net_save32>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
shr    $0x18,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0xc(%rbp),%eax
shr    $0x10,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x1(%rax)
mov    -0xc(%rbp),%eax
shr    $0x8,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x2(%rax)
mov    -0xc(%rbp),%eax
shr    $0x0,%eax
mov    %al,%cl
mov    -0x8(%rbp),%rax
mov    %cl,0x3(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<net_save32>:
bswap  %esi
mov    %esi,(%rdi)
ret

LLVM IR (-O0):
define void @net_save32(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = lshr i32 %5, 24
%7 = trunc i32 %6 to i8
%8 = load i8*, i8** %3
%9 = getelementptr inbounds i8, i8* %8, i64 0
store i8 %7, i8* %9
%10 = load i32, i32* %4
%11 = lshr i32 %10, 16
%12 = trunc i32 %11 to i8
%13 = load i8*, i8** %3
%14 = getelementptr inbounds i8, i8* %13, i64 1
store i8 %12, i8* %14
%15 = load i32, i32* %4
%16 = lshr i32 %15, 8
%17 = trunc i32 %16 to i8
%18 = load i8*, i8** %3
%19 = getelementptr inbounds i8, i8* %18, i64 2
store i8 %17, i8* %19
%20 = load i32, i32* %4
%21 = lshr i32 %20, 0
%22 = trunc i32 %21 to i8
%23 = load i8*, i8** %3
%24 = getelementptr inbounds i8, i8* %23, i64 3
store i8 %22, i8* %24
ret void
}

LLVM IR (-O2):
define void @net_save32(i8* nocapture writeonly %0, i32 %1) {
%3 = lshr i32 %1, 24
%4 = trunc i32 %3 to i8
store i8 %4, i8* %0
%5 = lshr i32 %1, 16
%6 = trunc i32 %5 to i8
%7 = getelementptr inbounds i8, i8* %0, i64 1
store i8 %6, i8* %7
%8 = lshr i32 %1, 8
%9 = trunc i32 %8 to i8
%10 = getelementptr inbounds i8, i8* %0, i64 2
store i8 %9, i8* %10
%11 = trunc i32 %1 to i8
%12 = getelementptr inbounds i8, i8* %0, i64 3
store i8 %11, i8* %12
ret void
}
void XListInstalledColormaps() {}


x86 assembly (clang, -O0):
<XListInstalledColormaps>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<XListInstalledColormaps>:
ret

LLVM IR (-O0):
define void @XListInstalledColormaps() {
ret void
}

LLVM IR (-O2):
define void @XListInstalledColormaps() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uid_t;
typedef int /*<<< orphan*/ gid_t;

/* Variables and functions */
int fchown(int fildes, uid_t owner, gid_t group) { return 0; }


x86 assembly (clang, -O0):
<fchown>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fchown>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @fchown(i32 %0, i32 %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
store i32 %2, i32* %6
ret i32 0
}

LLVM IR (-O2):
define i32 @fchown(i32 %0, i32 %1, i32 %2) {
ret i32 0
}
void XcmsFormatOfPrefix() {}


x86 assembly (clang, -O0):
<XcmsFormatOfPrefix>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<XcmsFormatOfPrefix>:
ret

LLVM IR (-O0):
define void @XcmsFormatOfPrefix() {
ret void
}

LLVM IR (-O2):
define void @XcmsFormatOfPrefix() {
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int service_mysql_init(char *ip, int sp, unsigned char options, char *miscptr,
                       FILE *fp, int port) {
  return 0;
}


x86 assembly (clang, -O0):
<service_mysql_init>:
push   %rbp
mov    %rsp,%rbp
mov    %dl,%al
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %al,-0xd(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %r8,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<service_mysql_init>:
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @service_mysql_init(i8* %0, i32 %1, i8 zeroext %2, i8* %3, i32* %4, i32 %5) {
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i8
%10 = alloca i8*
%11 = alloca i32*
%12 = alloca i32
store i8* %0, i8** %7
store i32 %1, i32* %8
store i8 %2, i8* %9
store i8* %3, i8** %10
store i32* %4, i32** %11
store i32 %5, i32* %12
ret i32 0
}

LLVM IR (-O2):
define i32 @service_mysql_init(i8* nocapture readnone %0, i32 %1, i8 zeroext %2, i8* nocapture readnone %3, i32* nocapture readnone %4, i32 %5) {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ __m128d;

/* Variables and functions */
int /*<<< orphan*/ _mm_cmpnle_sd(int /*<<< orphan*/, int /*<<< orphan*/);
__m128d test_mm_cmpnle_sd(__m128d A, __m128d B) { return _mm_cmpnle_sd(A, B); }


x86 assembly (clang, -O0):
<test_mm_cmpnle_sd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <_mm_cmpnle_sd@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_mm_cmpnle_sd>:
jmp    1030 <_mm_cmpnle_sd@plt>

LLVM IR (-O0):
define i32 @test_mm_cmpnle_sd(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = load i32, i32* %4
%7 = call i32 @_mm_cmpnle_sd(i32 %5, i32 %6)
ret i32 %7
}

LLVM IR (-O2):
define i32 @test_mm_cmpnle_sd(i32 %0, i32 %1) {
%3 = tail call i32 @_mm_cmpnle_sd(i32 %0, i32 %1)
ret i32 %3
}
/* Variables and functions */
int /*<<< orphan*/ debug(char *, ...);
int M81_f(char *s) {
  debug("M81_f(const char *s) is not yet implemented!\n");
  debug("%s\n", s);
  return 1;
}


x86 assembly (clang, -O0):
<M81_f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
lea    0xedd(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    -0x8(%rbp),%rsi
lea    0xef9(%rip),%rdi
mov    $0x0,%al
call   1030 <debug@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<M81_f>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
xor    %eax,%eax
call   1030 <debug@plt>
lea    0xf05(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <debug@plt>
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [46 x i8] c"M81_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M81_f(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%4 = load i8*, i8** %2
%5 = call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %4)
ret i32 1
}

LLVM IR (-O2):
@.str = [46 x i8] c"M81_f(const char *s) is not yet implemented!\0A\00"
@.str.1 = [4 x i8] c"%s\0A\00"
define i32 @M81_f(i8* %0) {
%2 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 (i8*, ...) @debug(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret i32 1
}
void foo_1_1_1_1_2_1_1_2_2() {}


x86 assembly (clang, -O0):
<foo_1_1_1_1_2_1_1_2_2>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo_1_1_1_1_2_1_1_2_2>:
ret

LLVM IR (-O0):
define void @foo_1_1_1_1_2_1_1_2_2() {
ret void
}

LLVM IR (-O2):
define void @foo_1_1_1_1_2_1_1_2_2() {
ret void
}
/* Variables and functions */
char *strchr(char *, int);
void clean(char *string) {
  char *p;
  if ((p = strchr(string, 10)))
    *p = '\0';
  if ((p = strchr(string, 13)))
    *p = '\0';
}


x86 assembly (clang, -O0):
<clean>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0xa,%esi
call   1030 <strchr@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     113f <clean+0x2f>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
mov    -0x8(%rbp),%rdi
mov    $0xd,%esi
call   1030 <strchr@plt>
mov    %rax,-0x10(%rbp)
cmp    $0x0,%rax
je     1162 <clean+0x52>
mov    -0x10(%rbp),%rax
movb   $0x0,(%rax)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clean>:
push   %rbx
mov    %rdi,%rbx
mov    $0xa,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     1126 <clean+0x16>
movb   $0x0,(%rax)
mov    %rbx,%rdi
mov    $0xd,%esi
call   1030 <strchr@plt>
test   %rax,%rax
je     113b <clean+0x2b>
movb   $0x0,(%rax)
pop    %rbx
ret

LLVM IR (-O0):
define void @clean(i8* %0) {
%2 = alloca i8*
%3 = alloca i8*
store i8* %0, i8** %2
%4 = load i8*, i8** %2
%5 = call i8* @strchr(i8* %4, i32 10)
store i8* %5, i8** %3
%6 = icmp ne i8* %5, null
br i1 %6, label %7, label %9
7: ; preds = %1
%8 = load i8*, i8** %3
store i8 0, i8* %8
br label %9
9: ; preds = %7, %1
%10 = load i8*, i8** %2
%11 = call i8* @strchr(i8* %10, i32 13)
store i8* %11, i8** %3
%12 = icmp ne i8* %11, null
br i1 %12, label %13, label %15
13: ; preds = %9
%14 = load i8*, i8** %3
store i8 0, i8* %14
br label %15
15: ; preds = %13, %9
ret void
}

LLVM IR (-O2):
define void @clean(i8* %0) {
%2 = tail call i8* @strchr(i8* dereferenceable(1) %0, i32 10)
%3 = icmp eq i8* %2, null
br i1 %3, label %5, label %4
4: ; preds = %1
store i8 0, i8* %2
br label %5
5: ; preds = %4, %1
%6 = tail call i8* @strchr(i8* dereferenceable(1) %0, i32 13)
%7 = icmp eq i8* %6, null
br i1 %7, label %9, label %8
8: ; preds = %5
store i8 0, i8* %6
br label %9
9: ; preds = %8, %5
ret void
}
/* Variables and functions */
scalar_t__ rand();
unsigned randint(const unsigned low, const unsigned high) {
  return low + (unsigned)rand() % (high - low + 1);
}


x86 assembly (clang, -O0):
<randint>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0xc(%rbp)
mov    $0x0,%al
call   1030 <rand@plt>
mov    -0x8(%rbp),%ecx
sub    -0x4(%rbp),%ecx
add    $0x1,%ecx
xor    %edx,%edx
div    %ecx
mov    -0xc(%rbp),%eax
add    %edx,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<randint>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
xor    %eax,%eax
call   1030 <rand@plt>
sub    %ebp,%ebx
add    $0x1,%ebx
xor    %edx,%edx
div    %ebx
add    %edx,%ebp
mov    %ebp,%eax
add    $0x8,%rsp
pop    %rbx
pop    %rbp
ret

LLVM IR (-O0):
define i32 @randint(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = load i32, i32* %3
%6 = call i64 (...) @rand()
%7 = trunc i64 %6 to i32
%8 = load i32, i32* %4
%9 = load i32, i32* %3
%10 = sub i32 %8, %9
%11 = add i32 %10, 1
%12 = urem i32 %7, %11
%13 = add i32 %5, %12
ret i32 %13
}

LLVM IR (-O2):
define i32 @randint(i32 %0, i32 %1) {
%3 = tail call i64 (...) @rand()
%4 = trunc i64 %3 to i32
%5 = sub i32 1, %0
%6 = add i32 %5, %1
%7 = urem i32 %4, %6
%8 = add i32 %7, %0
ret i32 %8
}
void foo_1_2_1_1_1_1_1_1_2() {}


x86 assembly (clang, -O0):
<foo_1_2_1_1_1_1_1_1_2>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<foo_1_2_1_1_1_1_1_1_2>:
ret

LLVM IR (-O0):
define void @foo_1_2_1_1_1_1_1_1_2() {
ret void
}

LLVM IR (-O2):
define void @foo_1_2_1_1_1_1_1_1_2() {
ret void
}
double bot_vector_magnitude_squared_2d(const double v[2]) {
  return v[0] * v[0] + v[1] * v[1];
}


x86 assembly (clang, -O0):
<bot_vector_magnitude_squared_2d>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm2
mov    -0x8(%rbp),%rax
movsd  0x8(%rax),%xmm1
mov    -0x8(%rbp),%rax
mulsd  0x8(%rax),%xmm1
mulsd  %xmm2,%xmm0
addsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<bot_vector_magnitude_squared_2d>:
movsd  (%rdi),%xmm0
movsd  0x8(%rdi),%xmm1
mulsd  %xmm1,%xmm1
mulsd  %xmm0,%xmm0
addsd  %xmm1,%xmm0
ret

LLVM IR (-O0):
define double @bot_vector_magnitude_squared_2d(double* %0) {
%2 = alloca double*
store double* %0, double** %2
%3 = load double*, double** %2
%4 = getelementptr inbounds double, double* %3, i64 0
%5 = load double, double* %4
%6 = load double*, double** %2
%7 = getelementptr inbounds double, double* %6, i64 0
%8 = load double, double* %7
%9 = load double*, double** %2
%10 = getelementptr inbounds double, double* %9, i64 1
%11 = load double, double* %10
%12 = load double*, double** %2
%13 = getelementptr inbounds double, double* %12, i64 1
%14 = load double, double* %13
%15 = fmul double %11, %14
%16 = call double @llvm.fmuladd.f64(double %5, double %8, double %15)
ret double %16
}

LLVM IR (-O2):
define double @bot_vector_magnitude_squared_2d(double* nocapture %0) {
%2 = load double, double* %0
%3 = getelementptr inbounds double, double* %0, i64 1
%4 = load double, double* %3
%5 = fmul double %4, %4
%6 = tail call double @llvm.fmuladd.f64(double %2, double %2, double %5)
ret double %6
}
/* Variables and functions */
long double atan2l(long double, int /*<<< orphan*/);
int /*<<< orphan*/ sqrtl(int);
long double asinl(long double x) { return atan2l(x, sqrtl((1 + x) * (1 - x))); }


x86 assembly (clang, -O0):
<asinl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x40,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
fld    %st(0)
fstpt  -0x24(%rbp)
fld1
fld    %st(1)
fadd   %st(1),%st
fxch   %st(1)
fsubp  %st,%st(2)
fmulp  %st,%st(1)
fnstcw -0x16(%rbp)
movzwl -0x16(%rbp),%eax
or     $0xc00,%eax
mov    %ax,-0x18(%rbp)
fldcw  -0x18(%rbp)
fistpl -0x14(%rbp)
fldcw  -0x16(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <sqrtl@plt>
fldt   -0x24(%rbp)
mov    %eax,%edi
mov    %rsp,%rax
fstpt  (%rax)
call   1040 <atan2l@plt>
fld    %st(0)
fstp   %st(0)
add    $0x40,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<asinl>:
push   %rax
fldt   0x10(%rsp)
fld1
fld    %st(1)
fadd   %st(1),%st
fxch   %st(1)
fsubp  %st,%st(2)
fmulp  %st,%st(1)
fnstcw (%rsp)
movzwl (%rsp),%eax
or     $0xc00,%eax
mov    %ax,0x2(%rsp)
fldcw  0x2(%rsp)
fistpl 0x4(%rsp)
fldcw  (%rsp)
mov    0x4(%rsp),%edi
call   1030 <sqrtl@plt>
mov    %eax,%edi
pop    %rax
jmp    1040 <atan2l@plt>

LLVM IR (-O0):
define x86_fp80 @asinl(x86_fp80 %0) {
%2 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %2
%3 = load x86_fp80, x86_fp80* %2
%4 = load x86_fp80, x86_fp80* %2
%5 = fadd x86_fp80 0xK3FFF8000000000000000, %4
%6 = load x86_fp80, x86_fp80* %2
%7 = fsub x86_fp80 0xK3FFF8000000000000000, %6
%8 = fmul x86_fp80 %5, %7
%9 = fptosi x86_fp80 %8 to i32
%10 = call i32 @sqrtl(i32 %9)
%11 = call x86_fp80 @atan2l(x86_fp80 %3, i32 %10)
ret x86_fp80 %11
}

LLVM IR (-O2):
define x86_fp80 @asinl(x86_fp80 %0) {
%2 = fadd x86_fp80 %0, 0xK3FFF8000000000000000
%3 = fsub x86_fp80 0xK3FFF8000000000000000, %0
%4 = fmul x86_fp80 %2, %3
%5 = fptosi x86_fp80 %4 to i32
%6 = tail call i32 @sqrtl(i32 %5)
%7 = tail call x86_fp80 @atan2l(x86_fp80 %0, i32 %6)
ret x86_fp80 %7
}
int toascii(int c) { return (((unsigned char)(c)) & 0x7f); }


x86 assembly (clang, -O0):
<toascii>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
movzbl %al,%eax
and    $0x7f,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<toascii>:
mov    %edi,%eax
and    $0x7f,%eax
ret

LLVM IR (-O0):
define i32 @toascii(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = trunc i32 %3 to i8
%5 = zext i8 %4 to i32
%6 = and i32 %5, 127
ret i32 %6
}

LLVM IR (-O2):
define i32 @toascii(i32 %0) {
%2 = and i32 %0, 127
ret i32 %2
}
double sinh(x)
double x;
{ return (exp(x) - exp(-x)) / 2; }


x86 assembly (clang, -O0):
<sinh>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <exp@plt>
movsd  %xmm0,-0x10(%rbp)
movsd  -0x8(%rbp),%xmm0
movq   %xmm0,%rax
movabs $0x8000000000000000,%rcx
xor    %rcx,%rax
movq   %rax,%xmm0
call   1030 <exp@plt>
movaps %xmm0,%xmm1
movsd  -0x10(%rbp),%xmm0
subsd  %xmm1,%xmm0
movsd  0xe9f(%rip),%xmm1
divsd  %xmm1,%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sinh>:
sub    $0x28,%rsp
movaps %xmm0,0x10(%rsp)
call   1030 <exp@plt>
movsd  %xmm0,0x8(%rsp)
movapd 0x10(%rsp),%xmm0
xorpd  0xece(%rip),%xmm0
call   1030 <exp@plt>
movsd  0x8(%rsp),%xmm1
subsd  %xmm0,%xmm1
mulsd  0xec7(%rip),%xmm1
movapd %xmm1,%xmm0
add    $0x28,%rsp
ret

LLVM IR (-O0):
define double @sinh(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call double @exp(double %3)
%5 = load double, double* %2
%6 = fneg double %5
%7 = call double @exp(double %6)
%8 = fsub double %4, %7
%9 = fdiv double %8, 2.000000e+00
ret double %9
}

LLVM IR (-O2):
define double @sinh(double %0) {
%2 = tail call double @exp(double %0)
%3 = fneg double %0
%4 = tail call double @exp(double %3)
%5 = fsub double %2, %4
%6 = fmul double %5, 5.000000e-01
ret double %6
}
void clear_thread_io_bitmap(struct task_struct *p) {}


x86 assembly (clang, -O0):
<clear_thread_io_bitmap>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<clear_thread_io_bitmap>:
ret

LLVM IR (-O0):
%struct.task_struct = type opaque
define void @clear_thread_io_bitmap(%struct.task_struct* %0) {
%2 = alloca %struct.task_struct*
store %struct.task_struct* %0, %struct.task_struct** %2
ret void
}

LLVM IR (-O2):
%struct.task_struct = type opaque
define void @clear_thread_io_bitmap(%struct.task_struct* nocapture %0) {
ret void
}
void updateEverything2() {
  int (*func)(void) = (int (*)(void))0x08007189;
  func();
  int (*func2)(void) = (int (*)(void))0x0800742D;
  func2();
  int (*func3)(void) = (int (*)(void))0x080A19DD;
  func3();
}


x86 assembly (clang, -O0):
<updateEverything2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    $0x8007189,%eax
mov    %rax,-0x8(%rbp)
call   *-0x8(%rbp)
mov    $0x800742d,%eax
mov    %rax,-0x10(%rbp)
call   *-0x10(%rbp)
mov    $0x80a19dd,%eax
mov    %rax,-0x18(%rbp)
call   *-0x18(%rbp)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<updateEverything2>:
push   %rax
mov    $0x8007189,%eax
call   *%rax
mov    $0x800742d,%eax
call   *%rax
mov    $0x80a19dd,%eax
pop    %rcx
jmp    *%rax

LLVM IR (-O0):
define void @updateEverything2() {
%1 = alloca i32 ()*
%2 = alloca i32 ()*
%3 = alloca i32 ()*
store i32 ()* inttoptr (i64 134246793 to i32 ()*), i32 ()** %1
%4 = load i32 ()*, i32 ()** %1
%5 = call i32 %4()
store i32 ()* inttoptr (i64 134247469 to i32 ()*), i32 ()** %2
%6 = load i32 ()*, i32 ()** %2
%7 = call i32 %6()
store i32 ()* inttoptr (i64 134879709 to i32 ()*), i32 ()** %3
%8 = load i32 ()*, i32 ()** %3
%9 = call i32 %8()
ret void
}

LLVM IR (-O2):
define void @updateEverything2() {
%1 = tail call i32 inttoptr (i64 134246793 to i32 ()*)()
%2 = tail call i32 inttoptr (i64 134247469 to i32 ()*)()
%3 = tail call i32 inttoptr (i64 134879709 to i32 ()*)()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void showVersion(int showAll) {
  (void)printf("MySecureShell is version "
               "xxx"
               " build on "
               "Mar 18 2022"
               "%s",
               " with DEBUG");
  if (showAll == 1) {
    (void)printf("\n\nOptions:\n  ACL support: "
                 "no"
                 "\n  UTF-8 support: "
                 "no"
                 "\n\nSftp Extensions:\n"
                 "  Disk Usage\n"
                 "  Disk Usage (OpenSSH)\n");
  }
}


x86 assembly (clang, -O0):
<showVersion>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xede(%rip),%rdi
lea    0xf0b(%rip),%rsi
mov    $0x0,%al
call   1030 <printf@plt>
cmpl   $0x1,-0x4(%rbp)
jne    1148 <showVersion+0x38>
lea    0xeff(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<showVersion>:
push   %rbx
mov    %edi,%ebx
lea    0xed6(%rip),%rdi
lea    0xf03(%rip),%rsi
xor    %eax,%eax
call   1040 <printf@plt>
cmp    $0x1,%ebx
jne    114a <showVersion+0x2a>
lea    0xefc(%rip),%rdi
pop    %rbx
jmp    1030 <puts@plt>
pop    %rbx
ret

LLVM IR (-O0):
@.str = [52 x i8] c"MySecureShell is version xxx build on Mar 18 2022%s\00"
@.str.1 = [12 x i8] c" with DEBUG\00"
@.str.2 = [104 x i8] c"\0A\0AOptions:\0A ACL support: no\0A UTF-8 support: no\0A\0ASftp Extensions:\0A Disk Usage\0A Disk Usage (OpenSSH)\0A\00"
define void @showVersion(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%4 = load i32, i32* %2
%5 = icmp eq i32 %4, 1
br i1 %5, label %6, label %8
6: ; preds = %1
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([104 x i8], [104 x i8]* @.str.2, i64 0, i64 0))
br label %8
8: ; preds = %6, %1
ret void
}

LLVM IR (-O2):
@.str = [52 x i8] c"MySecureShell is version xxx build on Mar 18 2022%s\00"
@.str.1 = [12 x i8] c" with DEBUG\00"
@str = [103 x i8] c"\0A\0AOptions:\0A ACL support: no\0A UTF-8 support: no\0A\0ASftp Extensions:\0A Disk Usage\0A Disk Usage (OpenSSH)\00"
define void @showVersion(i32 %0) {
%2 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str.1, i64 0, i64 0))
%3 = icmp eq i32 %0, 1
br i1 %3, label %4, label %6
4: ; preds = %1
%5 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([103 x i8], [103 x i8]* @str, i64 0, i64 0))
br label %6
6: ; preds = %4, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ DoSQV(int /*<<< orphan*/);
void DoSQV1(void) { DoSQV(0); }


x86 assembly (clang, -O0):
<DoSQV1>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <DoSQV@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<DoSQV1>:
xor    %edi,%edi
jmp    1030 <DoSQV@plt>

LLVM IR (-O0):
define void @DoSQV1() {
%1 = call i32 @DoSQV(i32 0)
ret void
}

LLVM IR (-O2):
define void @DoSQV1() {
%1 = tail call i32 @DoSQV(i32 0)
ret void
}
void setNoError_MBR(int no_error) {}


x86 assembly (clang, -O0):
<setNoError_MBR>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<setNoError_MBR>:
ret

LLVM IR (-O0):
define void @setNoError_MBR(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
ret void
}

LLVM IR (-O2):
define void @setNoError_MBR(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
void DieWithError(char *errorMessage) {
  perror(errorMessage);
  exit(-1);
}


x86 assembly (clang, -O0):
<DieWithError>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <perror@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<DieWithError>:
push   %rax
call   1030 <perror@plt>
mov    $0xffffffff,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
define void @DieWithError(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @perror(i8* %3)
%5 = call i32 @exit(i32 -1)
unreachable
}

LLVM IR (-O2):
define void @DieWithError(i8* nocapture %0) {
%2 = tail call i32 @perror(i8* %0)
%3 = tail call i32 @exit(i32 -1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ clang_analyzer_eval(int);
int /*<<< orphan*/ memset(char *, int, int);
scalar_t__ strlen(char *);
void memset26_upper_UCHAR_MAX() {
  char array[10] = {1};
  memset(array, 1024, 10);
  clang_analyzer_eval(strlen(array) == 0);
  clang_analyzer_eval(array[4] == 0);
}


x86 assembly (clang, -O0):
<memset26_upper_UCHAR_MAX>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0xec1(%rip),%rax
mov    %rax,-0xa(%rbp)
mov    0xebe(%rip),%ax
mov    %ax,-0x2(%rbp)
lea    -0xa(%rbp),%rdi
mov    $0x400,%esi
mov    $0xa,%edx
call   1040 <memset@plt>
lea    -0xa(%rbp),%rdi
call   1030 <strlen@plt>
cmp    $0x0,%rax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <clang_analyzer_eval@plt>
movsbl -0x6(%rbp),%eax
cmp    $0x0,%eax
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <clang_analyzer_eval@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<memset26_upper_UCHAR_MAX>:
sub    $0x18,%rsp
movzwl 0xedd(%rip),%eax
mov    %ax,0x10(%rsp)
mov    0xec9(%rip),%rax
mov    %rax,0x8(%rsp)
lea    0x8(%rsp),%rdi
mov    $0x400,%esi
mov    $0xa,%edx
call   1030 <memset@plt>
xor    %edi,%edi
cmpb   $0x0,0x8(%rsp)
sete   %dil
call   1040 <clang_analyzer_eval@plt>
xor    %edi,%edi
cmpb   $0x0,0xc(%rsp)
sete   %dil
call   1040 <clang_analyzer_eval@plt>
add    $0x18,%rsp
ret

LLVM IR (-O0):
@__const.memset26_upper_UCHAR_MAX.array = <{ i8, [9 x i8] }> <{ i8 1, [9 x i8] zeroinitializer }>
define void @memset26_upper_UCHAR_MAX() {
%1 = alloca [10 x i8]
%2 = bitcast [10 x i8]* %1 to i8*
%3 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%4 = call i32 @memset(i8* %3, i32 1024, i32 10)
%5 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%6 = call i64 @strlen(i8* %5)
%7 = icmp eq i64 %6, 0
%8 = zext i1 %7 to i32
%9 = call i32 @clang_analyzer_eval(i32 %8)
%10 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 4
%11 = load i8, i8* %10
%12 = sext i8 %11 to i32
%13 = icmp eq i32 %12, 0
%14 = zext i1 %13 to i32
%15 = call i32 @clang_analyzer_eval(i32 %14)
ret void
}

LLVM IR (-O2):
@__const.memset26_upper_UCHAR_MAX.array = <{ i8, [9 x i8] }> <{ i8 1, [9 x i8] zeroinitializer }>
define void @memset26_upper_UCHAR_MAX() {
%1 = alloca [10 x i8]
%2 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 0
%3 = call i32 @memset(i8* %2, i32 1024, i32 10)
%4 = load i8, i8* %2
%5 = icmp eq i8 %4, 0
%6 = zext i1 %5 to i32
%7 = call i32 @clang_analyzer_eval(i32 %6)
%8 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 4
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 0
%11 = zext i1 %10 to i32
%12 = call i32 @clang_analyzer_eval(i32 %11)
ret void
}
/* Variables and functions */
double acos(int /*<<< orphan*/);
int /*<<< orphan*/ luaL_check_number(int);
int /*<<< orphan*/ lua_pushnumber(double);
void math_acos(void) {
  lua_pushnumber(
      ((acos(luaL_check_number(1))) / ((3.14159265358979323846) / 180.0)));
}


x86 assembly (clang, -O0):
<math_acos>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <luaL_check_number@plt>
mov    %eax,%edi
call   1040 <acos@plt>
movsd  0xeb3(%rip),%xmm1
divsd  %xmm1,%xmm0
call   1050 <lua_pushnumber@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<math_acos>:
push   %rax
mov    $0x1,%edi
call   1030 <luaL_check_number@plt>
mov    %eax,%edi
call   1040 <acos@plt>
divsd  0xeb6(%rip),%xmm0
pop    %rax
jmp    1050 <lua_pushnumber@plt>

LLVM IR (-O0):
define void @math_acos() {
%1 = call i32 @luaL_check_number(i32 1)
%2 = call double @acos(i32 %1)
%3 = fdiv double %2, 0x3F91DF46A2529D39
%4 = call i32 @lua_pushnumber(double %3)
ret void
}

LLVM IR (-O2):
define void @math_acos() {
%1 = tail call i32 @luaL_check_number(i32 1)
%2 = tail call double @acos(i32 %1)
%3 = fdiv double %2, 0x3F91DF46A2529D39
%4 = tail call i32 @lua_pushnumber(double %3)
ret void
}
/* Variables and functions */
int *malloc(int);
int *mistake3() {
  int *buf = malloc(sizeof(int) * 4);
  buf[0] = 3;
  return buf;
}


x86 assembly (clang, -O0):
<mistake3>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x10,%edi
call   1030 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movl   $0x3,(%rax)
mov    -0x8(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<mistake3>:
push   %rax
mov    $0x10,%edi
call   1030 <malloc@plt>
movl   $0x3,(%rax)
pop    %rcx
ret

LLVM IR (-O0):
define i32* @mistake3() {
%1 = alloca i32*
%2 = call i32* @malloc(i32 16)
store i32* %2, i32** %1
%3 = load i32*, i32** %1
%4 = getelementptr inbounds i32, i32* %3, i64 0
store i32 3, i32* %4
%5 = load i32*, i32** %1
ret i32* %5
}

LLVM IR (-O2):
define noalias i32* @mistake3() {
%1 = tail call i32* @malloc(i32 16)
store i32 3, i32* %1
ret i32* %1
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ printf(char *);
void usage() {
  printf("Usage: fixperms [-f 644] [-d 755] <directory>|<-h>\n");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [52 x i8] c"Usage: fixperms [-f 644] [-d 755] <directory>|<-h>\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([52 x i8], [52 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@str = [51 x i8] c"Usage: fixperms [-f 644] [-d 755] <directory>|<-h>\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([51 x i8], [51 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int logicalShift(int, int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int main() {
  int x = -1;
  x = logicalShift(x, 0);
  printf("x : %x", x);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0xffffffff,-0x8(%rbp)
mov    -0x8(%rbp),%edi
xor    %esi,%esi
call   1040 <logicalShift@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
lea    0xeb3(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0xffffffff,%edi
xor    %esi,%esi
call   1040 <logicalShift@plt>
lea    0xecc(%rip),%rdi
mov    %eax,%esi
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [7 x i8] c"x : %x\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 -1, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @logicalShift(i32 %3, i32 0)
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %5)
ret i32 0
}

LLVM IR (-O2):
@.str = [7 x i8] c"x : %x\00"
define i32 @main() {
%1 = tail call i32 @logicalShift(i32 -1, i32 0)
%2 = tail call i32 @printf(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i32 %1)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  (void)fprintf(stderr, "%s\n%s\n",
                "usage: c99 [-cEgs] [-D name[=value]] ... [-I directory] ... "
                "[-L directory] ...",
                "       [-o outfile] [-O optlevel] [-U name] ... operand ...");
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
lea    0xecc(%rip),%rdx
lea    0xf14(%rip),%rcx
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
lea    0xecf(%rip),%rsi
lea    0xecf(%rip),%rdx
lea    0xf17(%rip),%rcx
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [7 x i8] c"%s\0A%s\0A\00"
@.str.1 = [79 x i8] c"usage: c99 [-cEgs] [-D name[=value]] ... [-I directory] ... [-L directory] ...\00"
@.str.2 = [60 x i8] c" [-o outfile] [-O optlevel] [-U name] ... operand ...\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.2, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [7 x i8] c"%s\0A%s\0A\00"
@.str.1 = [79 x i8] c"usage: c99 [-cEgs] [-D name[=value]] ... [-I directory] ... [-L directory] ...\00"
@.str.2 = [60 x i8] c" [-o outfile] [-O optlevel] [-U name] ... operand ...\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([79 x i8], [79 x i8]* @.str.1, i64 0, i64 0), i8* getelementptr inbounds ([60 x i8], [60 x i8]* @.str.2, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
void pmsav7_setup(void) {}


x86 assembly (clang, -O0):
<pmsav7_setup>:
push   %rbp
mov    %rsp,%rbp
pop    %rbp
ret

x86 assembly (clang, -O2):
<pmsav7_setup>:
ret

LLVM IR (-O0):
define void @pmsav7_setup() {
ret void
}

LLVM IR (-O2):
define void @pmsav7_setup() {
ret void
}
int test_07(int *vec) {
  int z = vec[0];
  int vi = vec[1];
  int zi = vec[2];
  if (zi != 0 && z < -1)
    vi -= (((vi >> 7) & 0x01) << 1) - 1;
  return vi;
}


x86 assembly (clang, -O0):
<test_07>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    0x4(%rax),%eax
mov    %eax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    0x8(%rax),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
je     1150 <test_07+0x50>
cmpl   $0xffffffff,-0xc(%rbp)
jge    1150 <test_07+0x50>
mov    -0x10(%rbp),%ecx
sar    $0x7,%ecx
and    $0x1,%ecx
shl    $0x1,%ecx
sub    $0x1,%ecx
mov    -0x10(%rbp),%eax
sub    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_07>:
mov    0x4(%rdi),%eax
mov    0x8(%rdi),%ecx
mov    %eax,%edx
shr    $0x6,%edx
and    $0x2,%edx
add    $0xffffffff,%edx
xor    %esi,%esi
cmpl   $0xffffffff,(%rdi)
cmovl  %edx,%esi
test   %ecx,%ecx
cmove  %ecx,%esi
sub    %esi,%eax
ret

LLVM IR (-O0):
define i32 @test_07(i32* %0) {
%2 = alloca i32*
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32* %0, i32** %2
%6 = load i32*, i32** %2
%7 = getelementptr inbounds i32, i32* %6, i64 0
%8 = load i32, i32* %7
store i32 %8, i32* %3
%9 = load i32*, i32** %2
%10 = getelementptr inbounds i32, i32* %9, i64 1
%11 = load i32, i32* %10
store i32 %11, i32* %4
%12 = load i32*, i32** %2
%13 = getelementptr inbounds i32, i32* %12, i64 2
%14 = load i32, i32* %13
store i32 %14, i32* %5
%15 = load i32, i32* %5
%16 = icmp ne i32 %15, 0
br i1 %16, label %17, label %28
17: ; preds = %1
%18 = load i32, i32* %3
%19 = icmp slt i32 %18, -1
br i1 %19, label %20, label %28
20: ; preds = %17
%21 = load i32, i32* %4
%22 = ashr i32 %21, 7
%23 = and i32 %22, 1
%24 = shl i32 %23, 1
%25 = sub nsw i32 %24, 1
%26 = load i32, i32* %4
%27 = sub nsw i32 %26, %25
store i32 %27, i32* %4
br label %28
28: ; preds = %20, %17, %1
%29 = load i32, i32* %4
ret i32 %29
}

LLVM IR (-O2):
define i32 @test_07(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = getelementptr inbounds i32, i32* %0, i64 1
%4 = load i32, i32* %3
%5 = getelementptr inbounds i32, i32* %0, i64 2
%6 = load i32, i32* %5
%7 = icmp ne i32 %6, 0
%8 = icmp slt i32 %2, -1
%9 = select i1 %7, i1 %8, i1 false
%10 = lshr i32 %4, 6
%11 = and i32 %10, 2
%12 = add nsw i32 %11, -1
%13 = select i1 %9, i32 %12, i32 0
%14 = sub nsw i32 %4, %13
ret i32 %14
}
/* Variables and functions */
int /*<<< orphan*/ schedule_delay_us(int);
void schedule_delay_ms(unsigned int ms) {
  int i = 0;
  for (i = 0; i < ms; i++)
    schedule_delay_us(1000);
  return;
}


x86 assembly (clang, -O0):
<schedule_delay_ms>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
cmp    -0x4(%rbp),%eax
jae    114d <schedule_delay_ms+0x3d>
mov    $0x3e8,%edi
call   1030 <schedule_delay_us@plt>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1129 <schedule_delay_ms+0x19>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<schedule_delay_ms>:
push   %rbx
test   %edi,%edi
je     112f <schedule_delay_ms+0x1f>
mov    %edi,%ebx
nopw   0x0(%rax,%rax,1)
mov    $0x3e8,%edi
call   1030 <schedule_delay_us@plt>
add    $0xffffffff,%ebx
jne    1120 <schedule_delay_ms+0x10>
pop    %rbx
ret

LLVM IR (-O0):
define void @schedule_delay_ms(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
store i32 0, i32* %3
store i32 0, i32* %3
br label %4
4: ; preds = %10, %1
%5 = load i32, i32* %3
%6 = load i32, i32* %2
%7 = icmp ult i32 %5, %6
br i1 %7, label %8, label %13
8: ; preds = %4
%9 = call i32 @schedule_delay_us(i32 1000)
br label %10
10: ; preds = %8
%11 = load i32, i32* %3
%12 = add nsw i32 %11, 1
store i32 %12, i32* %3
br label %4
13: ; preds = %4
ret void
}

LLVM IR (-O2):
define void @schedule_delay_ms(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %8, label %3
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ 0, %1 ]
%5 = tail call i32 @schedule_delay_us(i32 1000)
%6 = add nuw i32 %4, 1
%7 = icmp eq i32 %6, %0
br i1 %7, label %8, label %3
8: ; preds = %3, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ errno;
int /*<<< orphan*/ fatal(char *, char *, int /*<<< orphan*/);
scalar_t__ mkdir(char *, int);
int /*<<< orphan*/ strerror(int /*<<< orphan*/);
void xmkdir(char *p) {
  if (mkdir(p, 0777) < 0)
    fatal("mkdir %s: %s", p, strerror(errno));
}


x86 assembly (clang, -O0):
<xmkdir>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x1ff,%esi
call   1030 <mkdir@plt>
cmp    $0x0,%rax
jge    117c <xmkdir+0x4c>
mov    -0x8(%rbp),%rax
mov    %rax,-0x10(%rbp)
mov    0x2e7d(%rip),%rax
mov    (%rax),%edi
call   1040 <strerror@plt>
mov    -0x10(%rbp),%rsi
mov    %eax,%edx
lea    0xe89(%rip),%rdi
call   1050 <fatal@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xmkdir>:
push   %rbx
mov    %rdi,%rbx
mov    $0x1ff,%esi
call   1030 <mkdir@plt>
test   %rax,%rax
js     1145 <xmkdir+0x15>
pop    %rbx
ret
mov    0x2e94(%rip),%rax
mov    (%rax),%edi
call   1040 <strerror@plt>
lea    0xea6(%rip),%rdi
mov    %rbx,%rsi
mov    %eax,%edx
pop    %rbx
jmp    1050 <fatal@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"mkdir %s: %s\00"
@errno = global i32 0
define void @xmkdir(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @mkdir(i8* %3, i32 511)
%5 = icmp slt i64 %4, 0
br i1 %5, label %6, label %11
6: ; preds = %1
%7 = load i8*, i8** %2
%8 = load i32, i32* @errno
%9 = call i32 @strerror(i32 %8)
%10 = call i32 @fatal(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %7, i32 %9)
br label %11
11: ; preds = %6, %1
ret void
}

LLVM IR (-O2):
@.str = [13 x i8] c"mkdir %s: %s\00"
@errno = global i32 0
define void @xmkdir(i8* %0) {
%2 = tail call i64 @mkdir(i8* %0, i32 511)
%3 = icmp slt i64 %2, 0
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = load i32, i32* @errno
%6 = tail call i32 @strerror(i32 %5)
%7 = tail call i32 @fatal(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i8* %0, i32 %6)
br label %8
8: ; preds = %4, %1
ret void
}
int fun1278() { return 1278; }


x86 assembly (clang, -O0):
<fun1278>:
push   %rbp
mov    %rsp,%rbp
mov    $0x4fe,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fun1278>:
mov    $0x4fe,%eax
ret

LLVM IR (-O0):
define i32 @fun1278() {
ret i32 1278
}

LLVM IR (-O2):
define i32 @fun1278() {
ret i32 1278
}
/* Variables and functions */
int floor(float);
countNumTens(float x) {
  return floor(x) > 9 ? 1 + countNumTens(floor(x / 10)) : 0;
}


x86 assembly (clang, -O0):
<countNumTens>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movss  %xmm0,-0x4(%rbp)
movss  -0x4(%rbp),%xmm0
call   1040 <floor@plt>
cmp    $0x9,%eax
jle    116a <countNumTens+0x4a>
movss  -0x4(%rbp),%xmm0
movss  0xeb3(%rip),%xmm1
divss  %xmm1,%xmm0
call   1040 <floor@plt>
cvtsi2ss %eax,%xmm0
call   1030 <countNumTens@plt>
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1174 <countNumTens+0x54>
xor    %eax,%eax
mov    %eax,-0x8(%rbp)
jmp    1174 <countNumTens+0x54>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<countNumTens>:
push   %rbx
sub    $0x10,%rsp
movss  %xmm0,0xc(%rsp)
call   1030 <floor@plt>
xor    %ebx,%ebx
cmp    $0xa,%eax
jl     115d <countNumTens+0x4d>
xor    %ebx,%ebx
nopl   0x0(%rax)
movss  0xc(%rsp),%xmm0
divss  0xec2(%rip),%xmm0
call   1030 <floor@plt>
xorps  %xmm0,%xmm0
cvtsi2ss %eax,%xmm0
add    $0x1,%ebx
movss  %xmm0,0xc(%rsp)
call   1030 <floor@plt>
cmp    $0x9,%eax
jg     1130 <countNumTens+0x20>
mov    %ebx,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define i32 @countNumTens(float %0) {
%2 = alloca float
store float %0, float* %2
%3 = load float, float* %2
%4 = call i32 @floor(float %3)
%5 = icmp sgt i32 %4, 9
br i1 %5, label %6, label %13
6: ; preds = %1
%7 = load float, float* %2
%8 = fdiv float %7, 1.000000e+01
%9 = call i32 @floor(float %8)
%10 = sitofp i32 %9 to float
%11 = call i32 @countNumTens(float %10)
%12 = add nsw i32 1, %11
br label %14
13: ; preds = %1
br label %14
14: ; preds = %13, %6
%15 = phi i32 [ %12, %6 ], [ 0, %13 ]
ret i32 %15
}

LLVM IR (-O2):
define i32 @countNumTens(float %0) {
%2 = tail call i32 @floor(float %0)
%3 = icmp sgt i32 %2, 9
br i1 %3, label %4, label %13
4: ; preds = %1, %4
%5 = phi float [ %9, %4 ], [ %0, %1 ]
%6 = phi i32 [ %10, %4 ], [ 0, %1 ]
%7 = fdiv float %5, 1.000000e+01
%8 = tail call i32 @floor(float %7)
%9 = sitofp i32 %8 to float
%10 = add nuw nsw i32 %6, 1
%11 = tail call i32 @floor(float %9)
%12 = icmp sgt i32 %11, 9
br i1 %12, label %4, label %13
13: ; preds = %4, %1
%14 = phi i32 [ 0, %1 ], [ %10, %4 ]
ret i32 %14
}
/* Type definitions */
struct ssh_host {
  int dummy;
};

/* Variables and functions */
struct ssh_host *parse_hosts_file(char const *, int *);
char *ssh_hosts_filename();
struct ssh_host *parse_unix_hosts_file(int *nhosts) {
  const char *hosts_file = ssh_hosts_filename();
  return parse_hosts_file(hosts_file, nhosts);
}


x86 assembly (clang, -O0):
<parse_unix_hosts_file>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    $0x0,%al
call   1030 <ssh_hosts_filename@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1040 <parse_hosts_file@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_unix_hosts_file>:
push   %rbx
mov    %rdi,%rbx
xor    %eax,%eax
call   1030 <ssh_hosts_filename@plt>
mov    %rax,%rdi
mov    %rbx,%rsi
pop    %rbx
jmp    1040 <parse_hosts_file@plt>

LLVM IR (-O0):
%struct.ssh_host = type { i32 }
define %struct.ssh_host* @parse_unix_hosts_file(i32* %0) {
%2 = alloca i32*
%3 = alloca i8*
store i32* %0, i32** %2
%4 = call i8* (...) @ssh_hosts_filename()
store i8* %4, i8** %3
%5 = load i8*, i8** %3
%6 = load i32*, i32** %2
%7 = call %struct.ssh_host* @parse_hosts_file(i8* %5, i32* %6)
ret %struct.ssh_host* %7
}

LLVM IR (-O2):
%struct.ssh_host = type { i32 }
define %struct.ssh_host* @parse_unix_hosts_file(i32* %0) {
%2 = tail call i8* (...) @ssh_hosts_filename()
%3 = tail call %struct.ssh_host* @parse_hosts_file(i8* %2, i32* %0)
ret %struct.ssh_host* %3
}