xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main() {
  int a = 0;
  int b = 0;
  printf("请输入两个整数:");
  scanf("%d %d", &a, &b);
  printf("%d + %d = %d\n", a, b, a + b);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
lea    0xebc(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xec5(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1040 <scanf@plt>
mov    -0x8(%rbp),%esi
mov    -0xc(%rbp),%edx
mov    -0x8(%rbp),%ecx
add    -0xc(%rbp),%ecx
lea    0xeab(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
movl   $0x0,0x4(%rsp)
movl   $0x0,(%rsp)
lea    0xec9(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xed2(%rip),%rdi
lea    0x4(%rsp),%rsi
mov    %rsp,%rdx
call   1040 <scanf@plt>
mov    0x4(%rsp),%esi
mov    (%rsp),%edx
lea    (%rdx,%rsi,1),%ecx
lea    0xeba(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [23 x i8] c"\E8\AF\B7\E8\BE\93\E5\85\A5\E4\B8\A4\E4\B8\AA\E6\95\B4\E6\95\B0:\00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [14 x i8] c"%d + %d = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
store i32 0, i32* %1
store i32 0, i32* %2
store i32 0, i32* %3
%4 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%5 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
%6 = load i32, i32* %2
%7 = load i32, i32* %3
%8 = load i32, i32* %2
%9 = load i32, i32* %3
%10 = add nsw i32 %8, %9
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %6, i32 %7, i32 %10)
ret i32 0
}

LLVM IR (-O2):
@.str = [23 x i8] c"\E8\AF\B7\E8\BE\93\E5\85\A5\E4\B8\A4\E4\B8\AA\E6\95\B4\E6\95\B0:\00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [14 x i8] c"%d + %d = %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = bitcast i32* %1 to i8*
store i32 0, i32* %1
%4 = bitcast i32* %2 to i8*
store i32 0, i32* %2
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%7 = load i32, i32* %1
%8 = load i32, i32* %2
%9 = add nsw i32 %8, %7
%10 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.2, i64 0, i64 0), i32 %7, i32 %8, i32 %9)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr, "regdefs\n");
  exit(1);
}


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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [9 x i8] c"regdefs\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%3 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [9 x i8] c"regdefs\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ sprintf(char *, char *, char *, char *, char *);
int /*<<< orphan*/ system(char *);
void reaver(char *inmon, char *bssid, char *can) {
  char cmd[256];
  sprintf(cmd,
          "xterm 2> /dev/null -T Reaver -e \"reaver -i %s -b %s -c %s -S -L "
          "-vv ; read\" &",
          inmon, bssid, can);
  system(cmd);
}


x86 assembly (clang, -O0):
<reaver>:
push   %rbp
mov    %rsp,%rbp
sub    $0x120,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
lea    -0x120(%rbp),%rdi
mov    -0x8(%rbp),%rdx
mov    -0x10(%rbp),%rcx
mov    -0x18(%rbp),%r8
lea    0xeaf(%rip),%rsi
call   1040 <sprintf@plt>
lea    -0x120(%rbp),%rdi
call   1030 <system@plt>
add    $0x120,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<reaver>:
push   %rbx
sub    $0x100,%rsp
mov    %rdx,%r8
mov    %rsi,%rcx
mov    %rdi,%rdx
lea    0xec8(%rip),%rsi
mov    %rsp,%rbx
mov    %rbx,%rdi
call   1040 <sprintf@plt>
mov    %rbx,%rdi
call   1030 <system@plt>
add    $0x100,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [78 x i8] c"xterm 2> /dev/null -T Reaver -e \22reaver -i %s -b %s -c %s -S -L -vv ; read\22 &\00"
define void @reaver(i8* %0, i8* %1, i8* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i8*
%7 = alloca [256 x i8]
store i8* %0, i8** %4
store i8* %1, i8** %5
store i8* %2, i8** %6
%8 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%9 = load i8*, i8** %4
%10 = load i8*, i8** %5
%11 = load i8*, i8** %6
%12 = call i32 @sprintf(i8* %8, i8* getelementptr inbounds ([78 x i8], [78 x i8]* @.str, i64 0, i64 0), i8* %9, i8* %10, i8* %11)
%13 = getelementptr inbounds [256 x i8], [256 x i8]* %7, i64 0, i64 0
%14 = call i32 @system(i8* %13)
ret void
}

LLVM IR (-O2):
@.str = [78 x i8] c"xterm 2> /dev/null -T Reaver -e \22reaver -i %s -b %s -c %s -S -L -vv ; read\22 &\00"
define void @reaver(i8* %0, i8* %1, i8* %2) {
%4 = alloca [256 x i8]
%5 = getelementptr inbounds [256 x i8], [256 x i8]* %4, i64 0, i64 0
%6 = call i32 @sprintf(i8* %5, i8* dereferenceable(1) getelementptr inbounds ([78 x i8], [78 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %1, i8* %2)
%7 = call i32 @system(i8* %5)
ret void
}
__attribute__((always_)) void mpol_shared_policy_init(struct shared_policy *sp,
                                                      struct mempolicy *mpol) {}


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

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

LLVM IR (-O0):
%struct.shared_policy = type opaque
%struct.mempolicy = type opaque
define void @mpol_shared_policy_init(%struct.shared_policy* %0, %struct.mempolicy* %1) {
%3 = alloca %struct.shared_policy*
%4 = alloca %struct.mempolicy*
store %struct.shared_policy* %0, %struct.shared_policy** %3
store %struct.mempolicy* %1, %struct.mempolicy** %4
ret void
}

LLVM IR (-O2):
%struct.shared_policy = type opaque
%struct.mempolicy = type opaque
define void @mpol_shared_policy_init(%struct.shared_policy* nocapture %0, %struct.mempolicy* nocapture %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ Buffer2Stg(char *, char *, int, int, int);
char *ecvt(double, int, int *, int *);
void Double2Stg(char *lps, double factor) {
  int decimal, sign, precision;
  char *buffer;
  precision = 16;
  buffer = ecvt(factor, precision, &decimal, &sign);
  Buffer2Stg(lps, buffer, decimal, sign, precision);
}


x86 assembly (clang, -O0):
<Double2Stg>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
movsd  %xmm0,-0x10(%rbp)
movl   $0x10,-0x1c(%rbp)
movsd  -0x10(%rbp),%xmm0
mov    -0x1c(%rbp),%edi
lea    -0x14(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1040 <ecvt@plt>
mov    %rax,-0x28(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x28(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x18(%rbp),%ecx
mov    -0x1c(%rbp),%r8d
call   1030 <Buffer2Stg@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Double2Stg>:
push   %rbx
sub    $0x10,%rsp
mov    %rdi,%rbx
lea    0xc(%rsp),%rsi
lea    0x8(%rsp),%rdx
mov    $0x10,%edi
call   1040 <ecvt@plt>
mov    0xc(%rsp),%edx
mov    0x8(%rsp),%ecx
mov    %rbx,%rdi
mov    %rax,%rsi
mov    $0x10,%r8d
call   1030 <Buffer2Stg@plt>
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
define void @Double2Stg(i8* %0, double %1) {
%3 = alloca i8*
%4 = alloca double
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i8*
store i8* %0, i8** %3
store double %1, double* %4
store i32 16, i32* %7
%9 = load double, double* %4
%10 = load i32, i32* %7
%11 = call i8* @ecvt(double %9, i32 %10, i32* %5, i32* %6)
store i8* %11, i8** %8
%12 = load i8*, i8** %3
%13 = load i8*, i8** %8
%14 = load i32, i32* %5
%15 = load i32, i32* %6
%16 = load i32, i32* %7
%17 = call i32 @Buffer2Stg(i8* %12, i8* %13, i32 %14, i32 %15, i32 %16)
ret void
}

LLVM IR (-O2):
define void @Double2Stg(i8* %0, double %1) {
%3 = alloca i32
%4 = alloca i32
%5 = bitcast i32* %3 to i8*
%6 = bitcast i32* %4 to i8*
%7 = call i8* @ecvt(double %1, i32 16, i32* %3, i32* %4)
%8 = load i32, i32* %3
%9 = load i32, i32* %4
%10 = call i32 @Buffer2Stg(i8* %0, i8* %7, i32 %8, i32 %9, i32 16)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ load_rumoured_servers();
void init_servers() { load_rumoured_servers(); }


x86 assembly (clang, -O0):
<init_servers>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <load_rumoured_servers@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<init_servers>:
xor    %eax,%eax
jmp    1030 <load_rumoured_servers@plt>

LLVM IR (-O0):
define void @init_servers() {
%1 = call i32 (...) @load_rumoured_servers()
ret void
}

LLVM IR (-O2):
define void @init_servers() {
%1 = tail call i32 (...) @load_rumoured_servers()
ret void
}
void buzzerInit() {}


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

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

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

LLVM IR (-O2):
define void @buzzerInit() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void think(int i) {
  printf("\tFilosofo#%d esta PENSANDO\n", i);
  return;
}


x86 assembly (clang, -O0):
<think>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xedb(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<think>:
mov    %edi,%esi
lea    0xee7(%rip),%rdi
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [28 x i8] c"\09Filosofo#%d esta PENSANDO\0A\00"
define void @think(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %3)
ret void
}

LLVM IR (-O2):
@.str = [28 x i8] c"\09Filosofo#%d esta PENSANDO\0A\00"
define void @think(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([28 x i8], [28 x i8]* @.str, i64 0, i64 0), i32 %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void failQuit(char *message) {
  fprintf(stderr, "Error, aborting: %s\n", message);
  _exit(1);
}


x86 assembly (clang, -O0):
<failQuit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    0x2ead(%rip),%rax
mov    (%rax),%edi
mov    -0x8(%rbp),%rdx
lea    0xec0(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1030 <_exit@plt>

x86 assembly (clang, -O2):
<failQuit>:
push   %rax
mov    %rdi,%rdx
mov    0x2eb5(%rip),%rax
mov    (%rax),%edi
lea    0xecc(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1030 <_exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [21 x i8] c"Error, aborting: %s\0A\00"
define void @failQuit(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %4)
%6 = call i32 @_exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [21 x i8] c"Error, aborting: %s\0A\00"
define void @failQuit(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([21 x i8], [21 x i8]* @.str, i64 0, i64 0), i8* %0)
%4 = tail call i32 @_exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void msg_error_there_are_no_sentences() {
  printf("Error: there are no sentences in this block.\n");
}


x86 assembly (clang, -O0):
<msg_error_there_are_no_sentences>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
call   1030 <printf@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<msg_error_there_are_no_sentences>:
lea    0xee9(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [46 x i8] c"Error: there are no sentences in this block.\0A\00"
define void @msg_error_there_are_no_sentences() {
%1 = call i32 @printf(i8* getelementptr inbounds ([46 x i8], [46 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [45 x i8] c"Error: there are no sentences in this block.\00"
define void @msg_error_there_are_no_sentences() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([45 x i8], [45 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *, int);
int /*<<< orphan*/ release_work_area();
void sigcatch(int signo) {
  printf("good bye%d\n", signo);
  release_work_area();
  exit(0);
}


x86 assembly (clang, -O0):
<sigcatch>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%esi
lea    0xebb(%rip),%rdi
call   1030 <printf@plt>
mov    $0x0,%al
call   1040 <release_work_area@plt>
xor    %edi,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<sigcatch>:
push   %rax
mov    %edi,%esi
lea    0xec6(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
call   1040 <release_work_area@plt>
xor    %edi,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@.str = [12 x i8] c"good bye%d\0A\00"
define void @sigcatch(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = call i32 (...) @release_work_area()
%6 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@.str = [12 x i8] c"good bye%d\0A\00"
define void @sigcatch(i32 %0) {
%2 = tail call i32 @printf(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0), i32 %0)
%3 = tail call i32 (...) @release_work_area()
%4 = tail call i32 @exit(i32 0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ chdir(char *);
int /*<<< orphan*/ system(char *);
int main() {
  chdir("/mnt/user/code/MotorDriveTrain/bin");
  system("/mnt/user/jvm/java Main");
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <chdir@plt>
lea    0xeec(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <chdir@plt>
lea    0xeef(%rip),%rdi
call   1040 <system@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [35 x i8] c"/mnt/user/code/MotorDriveTrain/bin\00"
@.str.1 = [24 x i8] c"/mnt/user/jvm/java Main\00"
define i32 @main() {
%1 = call i32 @chdir(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @system(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [35 x i8] c"/mnt/user/code/MotorDriveTrain/bin\00"
@.str.1 = [24 x i8] c"/mnt/user/jvm/java Main\00"
define i32 @main() {
%1 = tail call i32 @chdir(i8* getelementptr inbounds ([35 x i8], [35 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @system(i8* getelementptr inbounds ([24 x i8], [24 x i8]* @.str.1, i64 0, i64 0))
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
__attribute__((always_)) void xfree(void *mem) { free(mem); }


x86 assembly (clang, -O0):
<xfree>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<xfree>:
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @xfree(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @free(i8* %3)
ret void
}

LLVM IR (-O2):
define void @xfree(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ usleep(int);
void thSleep(int ms) { usleep(ms * 1000); }


x86 assembly (clang, -O0):
<thSleep>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
imul   $0x3e8,-0x4(%rbp),%edi
call   1030 <usleep@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<thSleep>:
imul   $0x3e8,%edi,%edi
jmp    1030 <usleep@plt>

LLVM IR (-O0):
define void @thSleep(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = mul nsw i32 %3, 1000
%5 = call i32 @usleep(i32 %4)
ret void
}

LLVM IR (-O2):
define void @thSleep(i32 %0) {
%2 = mul nsw i32 %0, 1000
%3 = tail call i32 @usleep(i32 %2)
ret void
}
/* Variables and functions */
int cbuf(int, int, int);
cbuf23(int f, int n) { return (cbuf(f, n, 23)); }


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

x86 assembly (clang, -O2):
<cbuf23>:
mov    $0x17,%edx
jmp    1030 <cbuf@plt>

LLVM IR (-O0):
define i32 @cbuf23(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 @cbuf(i32 %5, i32 %6, i32 23)
ret i32 %7
}

LLVM IR (-O2):
define i32 @cbuf23(i32 %0, i32 %1) {
%3 = tail call i32 @cbuf(i32 %0, i32 %1, i32 23)
ret i32 %3
}
int net_count(int mask) {
  int i;
  int temp;
  i = mask - mask / 8 * 8;
  for (temp = 1; i > 0; i--) {
    temp = temp * 2;
  }
  return temp;
}


x86 assembly (clang, -O0):
<net_count>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x10(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x10(%rbp),%eax
shl    $0x3,%ecx
sub    %ecx,%eax
mov    %eax,-0x8(%rbp)
movl   $0x1,-0xc(%rbp)
cmpl   $0x0,-0x8(%rbp)
jle    114d <net_count+0x4d>
mov    -0xc(%rbp),%eax
shl    $0x1,%eax
mov    %eax,-0xc(%rbp)
mov    -0x8(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x8(%rbp)
jmp    112c <net_count+0x2c>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<net_count>:
lea    0x7(%rdi),%eax
test   %edi,%edi
cmovns %edi,%eax
and    $0xfffffff8,%eax
sub    %eax,%edi
test   %edi,%edi
jle    1125 <net_count+0x25>
lea    -0x1(%rdi),%eax
mov    %edi,%ecx
and    $0x7,%ecx
cmp    $0x7,%eax
jae    112b <net_count+0x2b>
mov    $0x1,%eax
jmp    1148 <net_count+0x48>
mov    $0x1,%eax
ret
and    $0xfffffff8,%edi
mov    $0x1,%eax
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
shl    $0x8,%eax
add    $0xfffffff8,%edi
jne    1140 <net_count+0x40>
test   %ecx,%ecx
je     1157 <net_count+0x57>
nopl   0x0(%rax)
add    %eax,%eax
add    $0xffffffff,%ecx
jne    1150 <net_count+0x50>
ret

LLVM IR (-O0):
define i32 @net_count(i32 %0) {
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %2
%5 = load i32, i32* %2
%6 = load i32, i32* %2
%7 = sdiv i32 %6, 8
%8 = mul nsw i32 %7, 8
%9 = sub nsw i32 %5, %8
store i32 %9, i32* %3
store i32 1, i32* %4
br label %10
10: ; preds = %16, %1
%11 = load i32, i32* %3
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %19
13: ; preds = %10
%14 = load i32, i32* %4
%15 = mul nsw i32 %14, 2
store i32 %15, i32* %4
br label %16
16: ; preds = %13
%17 = load i32, i32* %3
%18 = add nsw i32 %17, -1
store i32 %18, i32* %3
br label %10
19: ; preds = %10
%20 = load i32, i32* %4
ret i32 %20
}

LLVM IR (-O2):
define i32 @net_count(i32 %0) {
%2 = srem i32 %0, 8
%3 = icmp sgt i32 %2, 0
br i1 %3, label %4, label %26
4: ; preds = %1
%5 = add nsw i32 %2, -1
%6 = and i32 %2, 7
%7 = icmp ult i32 %5, 7
br i1 %7, label %16, label %8
8: ; preds = %4
%9 = and i32 %2, -8
br label %10
10: ; preds = %10, %8
%11 = phi i32 [ 1, %8 ], [ %13, %10 ]
%12 = phi i32 [ 0, %8 ], [ %14, %10 ]
%13 = shl i32 %11, 8
%14 = add i32 %12, 8
%15 = icmp eq i32 %14, %9
br i1 %15, label %16, label %10
16: ; preds = %10, %4
%17 = phi i32 [ undef, %4 ], [ %13, %10 ]
%18 = phi i32 [ 1, %4 ], [ %13, %10 ]
%19 = icmp eq i32 %6, 0
br i1 %19, label %26, label %20
20: ; preds = %16, %20
%21 = phi i32 [ %23, %20 ], [ %18, %16 ]
%22 = phi i32 [ %24, %20 ], [ 0, %16 ]
%23 = shl nsw i32 %21, 1
%24 = add i32 %22, 1
%25 = icmp eq i32 %24, %6
br i1 %25, label %26, label %20
26: ; preds = %16, %20, %1
%27 = phi i32 [ 1, %1 ], [ %17, %16 ], [ %23, %20 ]
ret i32 %27
}
long s_madd(long a, long b, long c) { return (a * b) + c; }


x86 assembly (clang, -O0):
<s_madd>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
imul   -0x10(%rbp),%rax
add    -0x18(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<s_madd>:
imul   %rsi,%rdi
lea    (%rdi,%rdx,1),%rax
ret

LLVM IR (-O0):
define i64 @s_madd(i64 %0, i64 %1, i64 %2) {
%4 = alloca i64
%5 = alloca i64
%6 = alloca i64
store i64 %0, i64* %4
store i64 %1, i64* %5
store i64 %2, i64* %6
%7 = load i64, i64* %4
%8 = load i64, i64* %5
%9 = mul nsw i64 %7, %8
%10 = load i64, i64* %6
%11 = add nsw i64 %9, %10
ret i64 %11
}

LLVM IR (-O2):
define i64 @s_madd(i64 %0, i64 %1, i64 %2) {
%4 = mul nsw i64 %1, %0
%5 = add nsw i64 %4, %2
ret i64 %5
}
void vmars_atomic_store_seq_cst_int(int *field, int value) {
  __asm__ volatile("lock; xchg %0, %1" : "+q"(value), "+m"(*field));
}


x86 assembly (clang, -O0):
<vmars_atomic_store_seq_cst_int>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
mov    -0x8(%rbp),%rcx
lock xchg %eax,(%rcx)
mov    %eax,-0xc(%rbp)
pop    %rbp
ret

x86 assembly (clang, -O2):
<vmars_atomic_store_seq_cst_int>:
lock xchg %esi,(%rdi)
ret

LLVM IR (-O0):
define void @vmars_atomic_store_seq_cst_int(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
%5 = load i32, i32* %4
%6 = load i32*, i32** %3
%7 = call i32 asm sideeffect "lock; xchg $0, $1", "=q,=*m,0,*m,~{dirflag},~{fpsr},~{flags}"(i32* elementtype(i32) %6, i32 %5, i32* elementtype(i32) %6)
store i32 %7, i32* %4
ret void
}

LLVM IR (-O2):
define void @vmars_atomic_store_seq_cst_int(i32* %0, i32 %1) {
%3 = tail call i32 asm sideeffect "lock; xchg $0, $1", "=q,=*m,0,*m,~{dirflag},~{fpsr},~{flags}"(i32* elementtype(i32) %0, i32 %1, i32* elementtype(i32) %0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;

/* Variables and functions */
void st_u8_le(void *x, uint8_t u) { ((uint8_t *)x)[0] = u; }


x86 assembly (clang, -O0):
<st_u8_le>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%ecx
mov    -0x8(%rbp),%rax
mov    %ecx,(%rax)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @st_u8_le(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 = load i8*, i8** %3
%7 = bitcast i8* %6 to i32*
%8 = getelementptr inbounds i32, i32* %7, i64 0
store i32 %5, i32* %8
ret void
}

LLVM IR (-O2):
define void @st_u8_le(i8* nocapture writeonly %0, i32 %1) {
%3 = bitcast i8* %0 to i32*
store i32 %1, i32* %3
ret void
}
/* Variables and functions */
int /*<<< orphan*/ _HibernateWriteComplete();
void HibernateTamperLock(void) {
  _HibernateWriteComplete();
  (*((volatile unsigned long *)(0x400FC360))) = 0;
  _HibernateWriteComplete();
}


x86 assembly (clang, -O0):
<HibernateTamperLock>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <_HibernateWriteComplete@plt>
mov    $0x400fc360,%eax
movq   $0x0,(%rax)
mov    $0x0,%al
call   1030 <_HibernateWriteComplete@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<HibernateTamperLock>:
push   %rax
xor    %eax,%eax
call   1030 <_HibernateWriteComplete@plt>
movq   $0x0,0x400fc360
xor    %eax,%eax
pop    %rcx
jmp    1030 <_HibernateWriteComplete@plt>

LLVM IR (-O0):
define void @HibernateTamperLock() {
%1 = call i32 (...) @_HibernateWriteComplete()
store volatile i64 0, i64* inttoptr (i64 1074774880 to i64*)
%2 = call i32 (...) @_HibernateWriteComplete()
ret void
}

LLVM IR (-O2):
define void @HibernateTamperLock() {
%1 = tail call i32 (...) @_HibernateWriteComplete()
store volatile i64 0, i64* inttoptr (i64 1074774880 to i64*)
%2 = tail call i32 (...) @_HibernateWriteComplete()
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
char *getenv(char *);
int /*<<< orphan*/ printf(char *, ...);
int main() {
  char *p;
  p = getenv("SHELL");
  if (p == NULL) {
    printf("getenv error\n");
    exit(1);
  } else {
    printf("SHELL=%s\n", p);
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
call   1030 <getenv@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1172 <main+0x42>
lea    0xea5(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rsi
lea    0xe97(%rip),%rdi
mov    $0x0,%al
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xeb8(%rip),%rdi
call   1030 <getenv@plt>
test   %rax,%rax
je     1167 <main+0x27>
lea    0xead(%rip),%rdi
mov    %rax,%rsi
xor    %eax,%eax
call   1050 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret
lea    0xea2(%rip),%rdi
call   1040 <puts@plt>
mov    $0x1,%edi
call   1060 <exit@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"SHELL\00"
@.str.1 = [14 x i8] c"getenv error\0A\00"
@.str.2 = [10 x i8] c"SHELL=%s\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i8*
store i32 0, i32* %1
%3 = call i8* @getenv(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
store i8* %3, i8** %2
%4 = load i8*, i8** %2
%5 = icmp eq i8* %4, null
br i1 %5, label %6, label %9
6: ; preds = %0
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0))
%8 = call i32 @exit(i32 1)
unreachable
9: ; preds = %0
%10 = load i8*, i8** %2
%11 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %10)
br label %12
12: ; preds = %9
ret i32 0
}

LLVM IR (-O2):
@.str = [6 x i8] c"SHELL\00"
@.str.2 = [10 x i8] c"SHELL=%s\0A\00"
@str = [13 x i8] c"getenv error\00"
define i32 @main() {
%1 = tail call i8* @getenv(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%2 = icmp eq i8* %1, null
br i1 %2, label %3, label %6
3: ; preds = %0
%4 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([13 x i8], [13 x i8]* @str, i64 0, i64 0))
%5 = tail call i32 @exit(i32 1)
unreachable
6: ; preds = %0
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([10 x i8], [10 x i8]* @.str.2, i64 0, i64 0), i8* %1)
ret i32 0
}
const char *crush_hash_name(int type) {
  switch (type) {
  case 0:
    return "rjenkins1";
  default:
    return "unknown";
  }
}


x86 assembly (clang, -O0):
<crush_hash_name>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0xc(%rbp)
mov    -0xc(%rbp),%eax
test   %eax,%eax
jne    1127 <crush_hash_name+0x27>
jmp    1117 <crush_hash_name+0x17>
lea    0xee2(%rip),%rax
mov    %rax,-0x8(%rbp)
jmp    1132 <crush_hash_name+0x32>
lea    0xedc(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<crush_hash_name>:
test   %edi,%edi
lea    0xef7(%rip),%rcx
lea    0xefa(%rip),%rax
cmove  %rcx,%rax
ret

LLVM IR (-O0):
@.str = [10 x i8] c"rjenkins1\00"
@.str.1 = [8 x i8] c"unknown\00"
define i8* @crush_hash_name(i32 %0) {
%2 = alloca i8*
%3 = alloca i32
store i32 %0, i32* %3
%4 = load i32, i32* %3
switch i32 %4, label %6 [
i32 0, label %5
]
5: ; preds = %1
store i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8** %2
br label %7
6: ; preds = %1
store i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0), i8** %2
br label %7
7: ; preds = %6, %5
%8 = load i8*, i8** %2
ret i8* %8
}

LLVM IR (-O2):
@.str = [10 x i8] c"rjenkins1\00"
@.str.1 = [8 x i8] c"unknown\00"
define i8* @crush_hash_name(i32 %0) {
%2 = icmp eq i32 %0, 0
%3 = select i1 %2, i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.1, i64 0, i64 0)
ret i8* %3
}
/* Type definitions */
typedef int /*<<< orphan*/ va_list;

/* Variables and functions */
int vsnprintf(char *, size_t, char const *, int /*<<< orphan*/);
int zvsnprintf(char *str, size_t size, const char *fmt, va_list ap) {
  int ret = vsnprintf((str), (size), (fmt), (ap));
  return ((ret < size) ? ret : (size - 1));
}


x86 assembly (clang, -O0):
<zvsnprintf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
call   1030 <vsnprintf@plt>
mov    %eax,-0x20(%rbp)
movslq -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1159 <zvsnprintf+0x49>
movslq -0x20(%rbp),%rax
mov    %rax,-0x28(%rbp)
jmp    1165 <zvsnprintf+0x55>
mov    -0x10(%rbp),%rax
sub    $0x1,%rax
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<zvsnprintf>:
push   %rbx
mov    %rsi,%rbx
call   1030 <vsnprintf@plt>
cltq
lea    -0x1(%rbx),%ecx
cmp    %rbx,%rax
cmovae %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @zvsnprintf(i8* %0, i64 %1, i8* %2, i32 %3) {
%5 = alloca i8*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i32
%9 = alloca i32
store i8* %0, i8** %5
store i64 %1, i64* %6
store i8* %2, i8** %7
store i32 %3, i32* %8
%10 = load i8*, i8** %5
%11 = load i64, i64* %6
%12 = load i8*, i8** %7
%13 = load i32, i32* %8
%14 = call i32 @vsnprintf(i8* %10, i64 %11, i8* %12, i32 %13)
store i32 %14, i32* %9
%15 = load i32, i32* %9
%16 = sext i32 %15 to i64
%17 = load i64, i64* %6
%18 = icmp ult i64 %16, %17
br i1 %18, label %19, label %22
19: ; preds = %4
%20 = load i32, i32* %9
%21 = sext i32 %20 to i64
br label %25
22: ; preds = %4
%23 = load i64, i64* %6
%24 = sub i64 %23, 1
br label %25
25: ; preds = %22, %19
%26 = phi i64 [ %21, %19 ], [ %24, %22 ]
%27 = trunc i64 %26 to i32
ret i32 %27
}

LLVM IR (-O2):
define i32 @zvsnprintf(i8* nocapture %0, i64 %1, i8* nocapture %2, i32 %3) {
%5 = tail call i32 @vsnprintf(i8* %0, i64 %1, i8* %2, i32 %3)
%6 = sext i32 %5 to i64
%7 = icmp ult i64 %6, %1
%8 = add i64 %1, 4294967295
%9 = select i1 %7, i64 %6, i64 %8
%10 = trunc i64 %9 to i32
ret i32 %10
}
/* Variables and functions */
int STC31xx_ReadByte8(int);
int STC31xx_WriteByte8(int, int);
int STC31xx_StopPowerSavingMode(void) {
  int res;
  res = STC31xx_ReadByte8(0x00);
  res = STC31xx_WriteByte8(0x00, (res & ~0x01));
  if (res != 0)
    return (res);
  return (0);
}


x86 assembly (clang, -O0):
<STC31xx_StopPowerSavingMode>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
call   1030 <STC31xx_ReadByte8@plt>
mov    %eax,-0x8(%rbp)
mov    -0x8(%rbp),%esi
and    $0xfffffffe,%esi
xor    %edi,%edi
call   1040 <STC31xx_WriteByte8@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1157 <STC31xx_StopPowerSavingMode+0x37>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    115e <STC31xx_StopPowerSavingMode+0x3e>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<STC31xx_StopPowerSavingMode>:
push   %rax
xor    %edi,%edi
call   1030 <STC31xx_ReadByte8@plt>
and    $0xfffffffe,%eax
xor    %edi,%edi
mov    %eax,%esi
pop    %rax
jmp    1040 <STC31xx_WriteByte8@plt>

LLVM IR (-O0):
define i32 @STC31xx_StopPowerSavingMode() {
%1 = alloca i32
%2 = alloca i32
%3 = call i32 @STC31xx_ReadByte8(i32 0)
store i32 %3, i32* %2
%4 = load i32, i32* %2
%5 = and i32 %4, -2
%6 = call i32 @STC31xx_WriteByte8(i32 0, i32 %5)
store i32 %6, i32* %2
%7 = load i32, i32* %2
%8 = icmp ne i32 %7, 0
br i1 %8, label %9, label %11
9: ; preds = %0
%10 = load i32, i32* %2
store i32 %10, i32* %1
br label %12
11: ; preds = %0
store i32 0, i32* %1
br label %12
12: ; preds = %11, %9
%13 = load i32, i32* %1
ret i32 %13
}

LLVM IR (-O2):
define i32 @STC31xx_StopPowerSavingMode() {
%1 = tail call i32 @STC31xx_ReadByte8(i32 0)
%2 = and i32 %1, -2
%3 = tail call i32 @STC31xx_WriteByte8(i32 0, i32 %2)
ret i32 %3
}
void dontwarn2(unsigned int U) {
  if (U <= 4294967295) {
  }
  if (U <= (2147483647 * 2U + 1U)) {
  }
}


x86 assembly (clang, -O0):
<dontwarn2>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xffffffff,%ecx
cmp    %rcx,%rax
jg     111d <dontwarn2+0x1d>
jmp    111d <dontwarn2+0x1d>
cmpl   $0xffffffff,-0x4(%rbp)
ja     112c <dontwarn2+0x2c>
jmp    112c <dontwarn2+0x2c>
pop    %rbp
ret

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

LLVM IR (-O0):
define void @dontwarn2(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = zext i32 %3 to i64
%5 = icmp sle i64 %4, 4294967295
br i1 %5, label %6, label %7
6: ; preds = %1
br label %7
7: ; preds = %6, %1
%8 = load i32, i32* %2
%9 = icmp ule i32 %8, -1
br i1 %9, label %10, label %11
10: ; preds = %7
br label %11
11: ; preds = %10, %7
ret void
}

LLVM IR (-O2):
define void @dontwarn2(i32 %0) {
ret void
}
/* Type definitions */
struct Buf {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ free(struct Buf *);
void free_buf(struct Buf *buf) { free(buf); }


x86 assembly (clang, -O0):
<free_buf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_buf>:
jmp    1030 <free@plt>

LLVM IR (-O0):
%struct.Buf = type { i32 }
define void @free_buf(%struct.Buf* %0) {
%2 = alloca %struct.Buf*
store %struct.Buf* %0, %struct.Buf** %2
%3 = load %struct.Buf*, %struct.Buf** %2
%4 = call i32 @free(%struct.Buf* %3)
ret void
}

LLVM IR (-O2):
%struct.Buf = type { i32 }
define void @free_buf(%struct.Buf* nocapture %0) {
%2 = tail call i32 @free(%struct.Buf* %0)
ret void
}
/* Variables and functions */
int strlen(char *);
int one(char **a, int i) { return strlen(a[i]); }


x86 assembly (clang, -O0):
<one>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <strlen@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<one>:
movslq %esi,%rax
mov    (%rdi,%rax,8),%rdi
jmp    1030 <strlen@plt>

LLVM IR (-O0):
define i32 @one(i8** %0, i32 %1) {
%3 = alloca i8**
%4 = alloca i32
store i8** %0, i8*** %3
store i32 %1, i32* %4
%5 = load i8**, i8*** %3
%6 = load i32, i32* %4
%7 = sext i32 %6 to i64
%8 = getelementptr inbounds i8*, i8** %5, i64 %7
%9 = load i8*, i8** %8
%10 = call i32 @strlen(i8* %9)
ret i32 %10
}

LLVM IR (-O2):
define i32 @one(i8** nocapture %0, i32 %1) {
%3 = sext i32 %1 to i64
%4 = getelementptr inbounds i8*, i8** %0, i64 %3
%5 = load i8*, i8** %4
%6 = tail call i32 @strlen(i8* %5)
ret i32 %6
}
int test_imm_B9int32_reg(int val) { return ((val) & (0xB9 << 0)) ? -20 : -40; }


x86 assembly (clang, -O0):
<test_imm_B9int32_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edx
and    $0xb9,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_B9int32_reg>:
test   $0xb9,%dil
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

LLVM IR (-O0):
define i32 @test_imm_B9int32_reg(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = and i32 %3, 185
%5 = icmp ne i32 %4, 0
%6 = zext i1 %5 to i64
%7 = select i1 %5, i32 -20, i32 -40
ret i32 %7
}

LLVM IR (-O2):
define i32 @test_imm_B9int32_reg(i32 %0) {
%2 = and i32 %0, 185
%3 = icmp eq i32 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Type definitions */
struct itimerspec {
  int dummy;
};

/* Variables and functions */
int syscall(int, int, struct itimerspec *);
int timerfd_gettime(int fd, struct itimerspec *curr_value) {
  return syscall(287, fd, curr_value);
}


x86 assembly (clang, -O0):
<timerfd_gettime>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%esi
mov    -0x10(%rbp),%rdx
mov    $0x11f,%edi
call   1030 <syscall@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<timerfd_gettime>:
mov    %rsi,%rdx
mov    %edi,%esi
mov    $0x11f,%edi
jmp    1030 <syscall@plt>

LLVM IR (-O0):
%struct.itimerspec = type { i32 }
define i32 @timerfd_gettime(i32 %0, %struct.itimerspec* %1) {
%3 = alloca i32
%4 = alloca %struct.itimerspec*
store i32 %0, i32* %3
store %struct.itimerspec* %1, %struct.itimerspec** %4
%5 = load i32, i32* %3
%6 = load %struct.itimerspec*, %struct.itimerspec** %4
%7 = call i32 @syscall(i32 287, i32 %5, %struct.itimerspec* %6)
ret i32 %7
}

LLVM IR (-O2):
%struct.itimerspec = type { i32 }
define i32 @timerfd_gettime(i32 %0, %struct.itimerspec* %1) {
%3 = tail call i32 @syscall(i32 287, i32 %0, %struct.itimerspec* %1)
ret i32 %3
}
/* Type definitions */
typedef int /*<<< orphan*/ locale_t;

/* Variables and functions */
scalar_t__ islower(int);
int toupper_l(int c, locale_t locale) {
  if (islower(c)) {
    return c - 'a' + 'A';
  }
  return c;
}


x86 assembly (clang, -O0):
<toupper_l>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%edi
call   1030 <islower@plt>
cmp    $0x0,%rax
je     1141 <toupper_l+0x31>
mov    -0x8(%rbp),%eax
sub    $0x61,%eax
add    $0x41,%eax
mov    %eax,-0x4(%rbp)
jmp    1147 <toupper_l+0x37>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<toupper_l>:
push   %rbx
mov    %edi,%ebx
call   1030 <islower@plt>
lea    -0x20(%rbx),%ecx
test   %rax,%rax
cmove  %ebx,%ecx
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @toupper_l(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %4
store i32 %1, i32* %5
%6 = load i32, i32* %4
%7 = call i64 @islower(i32 %6)
%8 = icmp ne i64 %7, 0
br i1 %8, label %9, label %13
9: ; preds = %2
%10 = load i32, i32* %4
%11 = sub nsw i32 %10, 97
%12 = add nsw i32 %11, 65
store i32 %12, i32* %3
br label %15
13: ; preds = %2
%14 = load i32, i32* %4
store i32 %14, i32* %3
br label %15
15: ; preds = %13, %9
%16 = load i32, i32* %3
ret i32 %16
}

LLVM IR (-O2):
define i32 @toupper_l(i32 %0, i32 %1) {
%3 = tail call i64 @islower(i32 %0)
%4 = icmp eq i64 %3, 0
%5 = add nsw i32 %0, -32
%6 = select i1 %4, i32 %0, i32 %5
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
int strlen(char *);
int main() {
  char *s = "";
  printf("%d\n", strlen(s));
  s = NULL;
  printf("%d\n", strlen(s));
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
lea    0xed4(%rip),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%esi
lea    0xebb(%rip),%rdi
call   1040 <printf@plt>
movq   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %eax,%esi
lea    0xe9c(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

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

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

LLVM IR (-O2):
@.str = [1 x i8] zeroinitializer
@.str.1 = [4 x i8] c"%d\0A\00"
define i32 @main() {
%1 = tail call i32 @strlen(i8* getelementptr inbounds ([1 x i8], [1 x i8]* @.str, i64 0, i64 0))
%2 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %1)
%3 = tail call i32 @strlen(i8* null)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str.1, i64 0, i64 0), i32 %3)
ret i32 0
}
void subx(p) struct h8_opcode *p;
{ printf("dst = srcb - srca - (c != 0);\n"); }


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

x86 assembly (clang, -O2):
<subx>:
lea    0xee9(%rip),%rdi
jmp    1030 <puts@plt>

LLVM IR (-O0):
%struct.h8_opcode = type opaque
@.str = [31 x i8] c"dst = srcb - srca - (c != 0);\0A\00"
define void @subx(%struct.h8_opcode* %0) {
%2 = alloca %struct.h8_opcode*
store %struct.h8_opcode* %0, %struct.h8_opcode** %2
%3 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([31 x i8], [31 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
%struct.h8_opcode = type opaque
@str = [30 x i8] c"dst = srcb - srca - (c != 0);\00"
define void @subx(%struct.h8_opcode* nocapture readnone %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([30 x i8], [30 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ sasumsub(int const *, float const *, int const *, float *);
float c_sasum(const int N, const float *X, const int stride) {
  float sum;
  sasumsub(&N, X, &stride, &sum);
  return sum;
}


x86 assembly (clang, -O0):
<c_sasum>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    -0x10(%rbp),%rsi
lea    -0x4(%rbp),%rdi
lea    -0x14(%rbp),%rdx
lea    -0x18(%rbp),%rcx
call   1030 <sasumsub@plt>
movss  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<c_sasum>:
sub    $0x18,%rsp
mov    %edi,0x14(%rsp)
mov    %edx,0x10(%rsp)
lea    0x14(%rsp),%rdi
lea    0x10(%rsp),%rdx
lea    0xc(%rsp),%rcx
call   1030 <sasumsub@plt>
movss  0xc(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define float @c_sasum(i32 %0, float* %1, i32 %2) {
%4 = alloca i32
%5 = alloca float*
%6 = alloca i32
%7 = alloca float
store i32 %0, i32* %4
store float* %1, float** %5
store i32 %2, i32* %6
%8 = load float*, float** %5
%9 = call i32 @sasumsub(i32* %4, float* %8, i32* %6, float* %7)
%10 = load float, float* %7
ret float %10
}

LLVM IR (-O2):
define float @c_sasum(i32 %0, float* %1, i32 %2) {
%4 = alloca i32
%5 = alloca i32
%6 = alloca float
store i32 %0, i32* %4
store i32 %2, i32* %5
%7 = bitcast float* %6 to i8*
%8 = call i32 @sasumsub(i32* %4, float* %1, i32* %5, float* %6)
%9 = load float, float* %6
ret float %9
}
/* Variables and functions */
int /*<<< orphan*/ bl_cleanup();
int /*<<< orphan*/ bl_init();
int /*<<< orphan*/ bl_main();
int main(int argc, char **argv) {
  bl_init();
  bl_main();
  bl_cleanup();
  return 1;
}


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)
mov    $0x0,%al
call   1030 <bl_init@plt>
mov    $0x0,%al
call   1050 <bl_main@plt>
mov    $0x0,%al
call   1040 <bl_cleanup@plt>
mov    $0x1,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <bl_init@plt>
xor    %eax,%eax
call   1050 <bl_main@plt>
xor    %eax,%eax
call   1040 <bl_cleanup@plt>
mov    $0x1,%eax
pop    %rcx
ret

LLVM IR (-O0):
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 = call i32 (...) @bl_init()
%7 = call i32 (...) @bl_main()
%8 = call i32 (...) @bl_cleanup()
ret i32 1
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @bl_init()
%4 = tail call i32 (...) @bl_main()
%5 = tail call i32 (...) @bl_cleanup()
ret i32 1
}
double rad2deg(double rad) { return (rad * 180 / 3.14159265358979323846); }


x86 assembly (clang, -O0):
<rad2deg>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  0xef7(%rip),%xmm0
mulsd  -0x8(%rbp),%xmm0
movsd  0xee2(%rip),%xmm1
divsd  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<rad2deg>:
mulsd  0xef8(%rip),%xmm0
divsd  0xef8(%rip),%xmm0
ret

LLVM IR (-O0):
define double @rad2deg(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = fmul double %3, 1.800000e+02
%5 = fdiv double %4, 0x400921FB54442D18
ret double %5
}

LLVM IR (-O2):
define double @rad2deg(double %0) {
%2 = fmul double %0, 1.800000e+02
%3 = fdiv double %2, 0x400921FB54442D18
ret double %3
}
/* Variables and functions */
int compute_square(int);
int /*<<< orphan*/ test1();
scalar_t__ test2();
int /*<<< orphan*/ test3(int);
int main() {
  int x = 2;
  test1();
  test2();
  if (test2()) {
    goto ERROR;
  }
  test3(x);
  compute_square(x);
  x = compute_square(x) + 2;
  if (x != 7) {
    goto ERROR;
  }
  return 0;
ERROR:
  return -1;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
movl   $0x2,-0x8(%rbp)
mov    $0x0,%al
call   1040 <test1@plt>
mov    $0x0,%al
call   1060 <test2@plt>
mov    $0x0,%al
call   1060 <test2@plt>
cmp    $0x0,%rax
je     117a <main+0x3a>
jmp    11b3 <main+0x73>
mov    -0x8(%rbp),%edi
call   1030 <test3@plt>
mov    -0x8(%rbp),%edi
call   1050 <compute_square@plt>
mov    -0x8(%rbp),%edi
call   1050 <compute_square@plt>
add    $0x2,%eax
mov    %eax,-0x8(%rbp)
cmpl   $0x7,-0x8(%rbp)
je     11a7 <main+0x67>
jmp    11b3 <main+0x73>
movl   $0x0,-0x4(%rbp)
jmp    11ba <main+0x7a>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
xor    %ebx,%ebx
xor    %eax,%eax
call   1040 <test1@plt>
xor    %eax,%eax
call   1060 <test2@plt>
xor    %eax,%eax
call   1060 <test2@plt>
test   %rax,%rax
jne    1180 <main+0x40>
mov    $0x2,%edi
call   1030 <test3@plt>
mov    $0x2,%edi
call   1050 <compute_square@plt>
mov    $0x2,%edi
call   1050 <compute_square@plt>
cmp    $0x5,%eax
je     1185 <main+0x45>
mov    $0xffffffff,%ebx
mov    %ebx,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
store i32 0, i32* %1
store i32 2, i32* %2
%3 = call i32 (...) @test1()
%4 = call i64 (...) @test2()
%5 = call i64 (...) @test2()
%6 = icmp ne i64 %5, 0
br i1 %6, label %7, label %8
7: ; preds = %0
br label %20
8: ; preds = %0
%9 = load i32, i32* %2
%10 = call i32 @test3(i32 %9)
%11 = load i32, i32* %2
%12 = call i32 @compute_square(i32 %11)
%13 = load i32, i32* %2
%14 = call i32 @compute_square(i32 %13)
%15 = add nsw i32 %14, 2
store i32 %15, i32* %2
%16 = load i32, i32* %2
%17 = icmp ne i32 %16, 7
br i1 %17, label %18, label %19
18: ; preds = %8
br label %20
19: ; preds = %8
store i32 0, i32* %1
br label %21
20: ; preds = %18, %7
store i32 -1, i32* %1
br label %21
21: ; preds = %20, %19
%22 = load i32, i32* %1
ret i32 %22
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 (...) @test1()
%2 = tail call i64 (...) @test2()
%3 = tail call i64 (...) @test2()
%4 = icmp eq i64 %3, 0
br i1 %4, label %5, label %10
5: ; preds = %0
%6 = tail call i32 @test3(i32 2)
%7 = tail call i32 @compute_square(i32 2)
%8 = tail call i32 @compute_square(i32 2)
%9 = icmp eq i32 %8, 5
br i1 %9, label %11, label %10
10: ; preds = %5, %0
br label %11
11: ; preds = %5, %10
%12 = phi i32 [ -1, %10 ], [ 0, %5 ]
ret i32 %12
}
void foo_2_2_2_2_1_1_1_2_1() {}


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

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

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

LLVM IR (-O2):
define void @foo_2_2_2_2_1_1_1_2_1() {
ret void
}
int func3() { return 1; }


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

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

LLVM IR (-O0):
define i32 @func3() {
ret i32 1
}

LLVM IR (-O2):
define i32 @func3() {
ret i32 1
}