xunge/DecIR huggingface dataset:
void WatchdogStallEnable(void) {
  (*((volatile unsigned long
          *)(((unsigned long)(0x40080000 + 0x00000418) & 0xF0000000) |
             0x02000000 |
             (((unsigned long)(0x40080000 + 0x00000418) & 0x000FFFFF) << 5) |
             ((8) << 2)))) = 1;
}


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

x86 assembly (clang, -O2):
<WatchdogStallEnable>:
movq   $0x1,0x43008320
ret

LLVM IR (-O0):
define void @WatchdogStallEnable() {
store volatile i64 1, i64* inttoptr (i64 1124107040 to i64*)
ret void
}

LLVM IR (-O2):
define void @WatchdogStallEnable() {
store volatile i64 1, i64* inttoptr (i64 1124107040 to i64*)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ deasplay_hal_init();
int /*<<< orphan*/ display_set_cursor(int /*<<< orphan*/, int /*<<< orphan*/);
void display_init(void) {
  deasplay_hal_init();
  display_set_cursor(0, 0);
  ;
}


x86 assembly (clang, -O0):
<display_init>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <deasplay_hal_init@plt>
xor    %esi,%esi
mov    %esi,%edi
call   1040 <display_set_cursor@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<display_init>:
push   %rax
xor    %eax,%eax
call   1030 <deasplay_hal_init@plt>
xor    %edi,%edi
xor    %esi,%esi
pop    %rax
jmp    1040 <display_set_cursor@plt>

LLVM IR (-O0):
define void @display_init() {
%1 = call i32 (...) @deasplay_hal_init()
%2 = call i32 @display_set_cursor(i32 0, i32 0)
ret void
}

LLVM IR (-O2):
define void @display_init() {
%1 = tail call i32 (...) @deasplay_hal_init()
%2 = tail call i32 @display_set_cursor(i32 0, i32 0)
ret void
}
void appendStr(char **pDstStr, char *srcStr) {
  while (*(*pDstStr)++ = *srcStr++)
    ;
  (*pDstStr)--;
  **pDstStr = 0;
}


x86 assembly (clang, -O0):
<appendStr>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,%rcx
add    $0x1,%rcx
mov    %rcx,-0x10(%rbp)
mov    (%rax),%al
mov    -0x8(%rbp),%rdx
mov    (%rdx),%rcx
mov    %rcx,%rsi
add    $0x1,%rsi
mov    %rsi,(%rdx)
mov    %al,(%rcx)
cmp    $0x0,%al
je     113d <appendStr+0x3d>
jmp    110c <appendStr+0xc>
mov    -0x8(%rbp),%rax
mov    (%rax),%rcx
add    $0xffffffffffffffff,%rcx
mov    %rcx,(%rax)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
movb   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<appendStr>:
movzbl (%rsi),%eax
add    $0x1,%rsi
mov    (%rdi),%rcx
lea    0x1(%rcx),%rdx
mov    %rdx,(%rdi)
mov    %al,(%rcx)
test   %al,%al
jne    1100 <appendStr>
mov    (%rdi),%rax
lea    -0x1(%rax),%rcx
mov    %rcx,(%rdi)
movb   $0x0,-0x1(%rax)
ret

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

LLVM IR (-O2):
define void @appendStr(i8** nocapture %0, i8* nocapture %1) {
br label %3
3: ; preds = %3, %2
%4 = phi i8* [ %1, %2 ], [ %5, %3 ]
%5 = getelementptr inbounds i8, i8* %4, i64 1
%6 = load i8, i8* %4
%7 = load i8*, i8** %0
%8 = getelementptr inbounds i8, i8* %7, i64 1
store i8* %8, i8** %0
store i8 %6, i8* %7
%9 = icmp eq i8 %6, 0
br i1 %9, label %10, label %3
10: ; preds = %3
%11 = load i8*, i8** %0
%12 = getelementptr inbounds i8, i8* %11, i64 -1
store i8* %12, i8** %0
store i8 0, i8* %12
ret void
}
/* Variables and functions */
int f(int, int);
int main(void) { return f(5, 6); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x5,%edi
mov    $0x6,%esi
call   1030 <f@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
mov    $0x5,%edi
mov    $0x6,%esi
jmp    1030 <f@plt>

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

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @f(i32 5, i32 6)
ret i32 %1
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int uint32_t;
typedef int uint16_t;

/* Variables and functions */
int /*<<< orphan*/ send_ipi(int /*<<< orphan*/ *, int, int);
void apic_send_ipi_all(uint8_t *baseapic, uint16_t type) {
  uint32_t high = 0x0f000000;
  uint32_t low = (2 << 18) | type;
  send_ipi(baseapic, high, low);
}


x86 assembly (clang, -O0):
<apic_send_ipi_all>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0xf000000,-0x10(%rbp)
mov    -0xc(%rbp),%eax
or     $0x80000,%eax
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%esi
mov    -0x14(%rbp),%edx
call   1030 <send_ipi@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<apic_send_ipi_all>:
mov    %esi,%edx
or     $0x80000,%edx
mov    $0xf000000,%esi
jmp    1030 <send_ipi@plt>

LLVM IR (-O0):
define void @apic_send_ipi_all(i32* %0, i32 %1) {
%3 = alloca i32*
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32* %0, i32** %3
store i32 %1, i32* %4
store i32 251658240, i32* %5
%7 = load i32, i32* %4
%8 = or i32 524288, %7
store i32 %8, i32* %6
%9 = load i32*, i32** %3
%10 = load i32, i32* %5
%11 = load i32, i32* %6
%12 = call i32 @send_ipi(i32* %9, i32 %10, i32 %11)
ret void
}

LLVM IR (-O2):
define void @apic_send_ipi_all(i32* %0, i32 %1) {
%3 = or i32 %1, 524288
%4 = tail call i32 @send_ipi(i32* %0, i32 251658240, i32 %3)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void usage(void) {
  printf("Usage: fldd program_or_directory [file]\n");
  printf(
      "Print a list of libraries used by program or store it in the file.\n");
  printf("Print a list of libraries used by all .so files in a directory or "
         "store it in the file.\n");
}


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

x86 assembly (clang, -O2):
<usage>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
lea    0xf04(%rip),%rdi
call   1030 <puts@plt>
lea    0xf3b(%rip),%rdi
pop    %rax
jmp    1030 <puts@plt>

LLVM IR (-O0):
@.str = [41 x i8] c"Usage: fldd program_or_directory [file]\0A\00"
@.str.1 = [68 x i8] c"Print a list of libraries used by program or store it in the file.\0A\00"
@.str.2 = [89 x i8] c"Print a list of libraries used by all .so files in a directory or store it in the file.\0A\00"
define void @usage() {
%1 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @printf(i8* getelementptr inbounds ([68 x i8], [68 x i8]* @.str.1, i64 0, i64 0))
%3 = call i32 @printf(i8* getelementptr inbounds ([89 x i8], [89 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [40 x i8] c"Usage: fldd program_or_directory [file]\00"
@str.3 = [67 x i8] c"Print a list of libraries used by program or store it in the file.\00"
@str.4 = [88 x i8] c"Print a list of libraries used by all .so files in a directory or store it in the file.\00"
define void @usage() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([67 x i8], [67 x i8]* @str.3, i64 0, i64 0))
%3 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([88 x i8], [88 x i8]* @str.4, i64 0, i64 0))
ret void
}
int fun539() { return 539; }


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

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

LLVM IR (-O0):
define i32 @fun539() {
ret i32 539
}

LLVM IR (-O2):
define i32 @fun539() {
ret i32 539
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
void *malloc(size_t);
int /*<<< orphan*/ stderr;
void *sr_malloc(size_t size) {
  void *ptr = malloc(size);
  if (!ptr) {
    fprintf(stderr, "sr_malloc: out of memory");
    exit(1);
  }
  return ptr;
}


x86 assembly (clang, -O0):
<sr_malloc>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <malloc@plt>
mov    %rax,-0x10(%rbp)
cmpq   $0x0,-0x10(%rbp)
jne    1173 <sr_malloc+0x43>
mov    0x2e85(%rip),%rax
mov    (%rax),%edi
lea    0xe9c(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>
mov    -0x10(%rbp),%rax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sr_malloc>:
push   %rax
call   1040 <malloc@plt>
test   %rax,%rax
je     113d <sr_malloc+0xd>
pop    %rcx
ret
mov    0x2e9c(%rip),%rax
mov    (%rax),%edi
lea    0xeb3(%rip),%rsi
call   1030 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [25 x i8] c"sr_malloc: out of memory\00"
define i8* @sr_malloc(i64 %0) {
%2 = alloca i64
%3 = alloca i8*
store i64 %0, i64* %2
%4 = load i64, i64* %2
%5 = call i8* @malloc(i64 %4)
store i8* %5, i8** %3
%6 = load i8*, i8** %3
%7 = icmp ne i8* %6, null
br i1 %7, label %12, label %8
8: ; preds = %1
%9 = load i32, i32* @stderr
%10 = call i32 @fprintf(i32 %9, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%11 = call i32 @exit(i32 1)
unreachable
12: ; preds = %1
%13 = load i8*, i8** %3
ret i8* %13
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [25 x i8] c"sr_malloc: out of memory\00"
define noalias i8* @sr_malloc(i64 %0) {
%2 = tail call i8* @malloc(i64 %0)
%3 = icmp eq i8* %2, null
br i1 %3, label %4, label %8
4: ; preds = %1
%5 = load i32, i32* @stderr
%6 = tail call i32 @fprintf(i32 %5, i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%7 = tail call i32 @exit(i32 1)
unreachable
8: ; preds = %1
ret i8* %2
}
/* Variables and functions */
int /*<<< orphan*/ sleep(unsigned int);
extern void sleep_(int *sec) { sleep((unsigned)*sec); }


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

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

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

LLVM IR (-O2):
define void @sleep_(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = tail call i32 @sleep(i32 %2)
ret void
}
/* Variables and functions */
double exp(double);
double r1(double *x) { return exp(x[0]) - x[1]; }


x86 assembly (clang, -O0):
<r1>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsd  (%rax),%xmm0
call   1030 <exp@plt>
mov    -0x8(%rbp),%rax
subsd  0x8(%rax),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<r1>:
push   %rbx
mov    %rdi,%rbx
movsd  (%rdi),%xmm0
call   1030 <exp@plt>
subsd  0x8(%rbx),%xmm0
pop    %rbx
ret

LLVM IR (-O0):
define double @r1(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 = call double @exp(double %5)
%7 = load double*, double** %2
%8 = getelementptr inbounds double, double* %7, i64 1
%9 = load double, double* %8
%10 = fsub double %6, %9
ret double %10
}

LLVM IR (-O2):
define double @r1(double* nocapture %0) {
%2 = load double, double* %0
%3 = tail call double @exp(double %2)
%4 = getelementptr inbounds double, double* %0, i64 1
%5 = load double, double* %4
%6 = fsub double %3, %5
ret double %6
}
/* Type definitions */
typedef int /*<<< orphan*/ pid_t;
typedef int /*<<< orphan*/ mask;
typedef int /*<<< orphan*/ cpu_set_t;

/* Variables and functions */
int /*<<< orphan*/ CPU_SET(int, int /*<<< orphan*/ *);
int /*<<< orphan*/ CPU_ZERO(int /*<<< orphan*/ *);
int sched_setaffinity(int /*<<< orphan*/, int, int /*<<< orphan*/ *);
int map_to_cpuid(int cpuid) {
  cpu_set_t mask;
  CPU_ZERO(&mask);
  CPU_SET(cpuid, &mask);
  return (sched_setaffinity((pid_t)0, sizeof(mask), &mask));
}


x86 assembly (clang, -O0):
<map_to_cpuid>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x8(%rbp),%rdi
call   1040 <CPU_ZERO@plt>
mov    -0x4(%rbp),%edi
lea    -0x8(%rbp),%rsi
call   1050 <CPU_SET@plt>
xor    %edi,%edi
mov    $0x4,%esi
lea    -0x8(%rbp),%rdx
call   1030 <sched_setaffinity@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<map_to_cpuid>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
lea    0x4(%rsp),%r14
mov    %r14,%rdi
call   1040 <CPU_ZERO@plt>
mov    %ebx,%edi
mov    %r14,%rsi
call   1050 <CPU_SET@plt>
xor    %edi,%edi
mov    $0x4,%esi
mov    %r14,%rdx
call   1030 <sched_setaffinity@plt>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i32 @map_to_cpuid(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = call i32 @CPU_ZERO(i32* %3)
%5 = load i32, i32* %2
%6 = call i32 @CPU_SET(i32 %5, i32* %3)
%7 = call i32 @sched_setaffinity(i32 0, i32 4, i32* %3)
ret i32 %7
}

LLVM IR (-O2):
define i32 @map_to_cpuid(i32 %0) {
%2 = alloca i32
%3 = bitcast i32* %2 to i8*
%4 = call i32 @CPU_ZERO(i32* %2)
%5 = call i32 @CPU_SET(i32 %0, i32* %2)
%6 = call i32 @sched_setaffinity(i32 0, i32 4, i32* %2)
ret i32 %6
}
/* Variables and functions */
int /*<<< orphan*/ perror(char *);
scalar_t__ setuid(int /*<<< orphan*/);
int wiringPiSetup();
int wiringPiSetupInit() {
  if (setuid(0)) {
    perror("setuid");
    return 1;
  }
  if (wiringPiSetup() == -1) {
    perror("Librairie Wiring PI introuvable, veuillez lier cette librairie...");
    return -1;
  }
}


x86 assembly (clang, -O0):
<wiringPiSetupInit>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
xor    %edi,%edi
call   1050 <setuid@plt>
cmp    $0x0,%rax
je     1161 <wiringPiSetupInit+0x31>
lea    0xeb0(%rip),%rdi
call   1040 <perror@plt>
movl   $0x1,-0x4(%rbp)
jmp    1184 <wiringPiSetupInit+0x54>
mov    $0x0,%al
call   1030 <wiringPiSetup@plt>
cmp    $0xffffffff,%eax
jne    1184 <wiringPiSetupInit+0x54>
lea    0xe8f(%rip),%rdi
call   1040 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<wiringPiSetupInit>:
push   %rbx
xor    %edi,%edi
call   1050 <setuid@plt>
test   %rax,%rax
jne    114d <wiringPiSetupInit+0x1d>
xor    %eax,%eax
call   1030 <wiringPiSetup@plt>
cmp    $0xffffffff,%eax
je     115b <wiringPiSetupInit+0x2b>
mov    %ebx,%eax
pop    %rbx
ret
mov    $0x1,%ebx
lea    0xea7(%rip),%rdi
jmp    1167 <wiringPiSetupInit+0x37>
mov    $0xffffffff,%ebx
lea    0xea0(%rip),%rdi
call   1040 <perror@plt>
jmp    1149 <wiringPiSetupInit+0x19>

LLVM IR (-O0):
@.str = [7 x i8] c"setuid\00"
@.str.1 = [66 x i8] c"Librairie Wiring PI introuvable, veuillez lier cette librairie...\00"
define i32 @wiringPiSetupInit() {
%1 = alloca i32
%2 = call i64 @setuid(i32 0)
%3 = icmp ne i64 %2, 0
br i1 %3, label %4, label %6
4: ; preds = %0
%5 = call i32 @perror(i8* getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0))
store i32 1, i32* %1
br label %11
6: ; preds = %0
%7 = call i32 (...) @wiringPiSetup()
%8 = icmp eq i32 %7, -1
br i1 %8, label %9, label %11
9: ; preds = %6
%10 = call i32 @perror(i8* getelementptr inbounds ([66 x i8], [66 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %1
br label %11
11: ; preds = %4, %9, %6
%12 = load i32, i32* %1
ret i32 %12
}

LLVM IR (-O2):
@.str = [7 x i8] c"setuid\00"
@.str.1 = [66 x i8] c"Librairie Wiring PI introuvable, veuillez lier cette librairie...\00"
define i32 @wiringPiSetupInit() {
%1 = tail call i64 @setuid(i32 0)
%2 = icmp eq i64 %1, 0
br i1 %2, label %3, label %6
3: ; preds = %0
%4 = tail call i32 (...) @wiringPiSetup()
%5 = icmp eq i32 %4, -1
br i1 %5, label %6, label %10
6: ; preds = %3, %0
%7 = phi i8* [ getelementptr inbounds ([7 x i8], [7 x i8]* @.str, i64 0, i64 0), %0 ], [ getelementptr inbounds ([66 x i8], [66 x i8]* @.str.1, i64 0, i64 0), %3 ]
%8 = phi i32 [ 1, %0 ], [ -1, %3 ]
%9 = tail call i32 @perror(i8* %7)
br label %10
10: ; preds = %6, %3
%11 = phi i32 [ undef, %3 ], [ %8, %6 ]
ret i32 %11
}
/* Variables and functions */
int /*<<< orphan*/ run_test(int);
int main() {
  run_test(1);
  run_test(10);
  run_test(100);
  run_test(1000);
  run_test(10000);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x1,%edi
call   1030 <run_test@plt>
mov    $0xa,%edi
call   1030 <run_test@plt>
mov    $0x64,%edi
call   1030 <run_test@plt>
mov    $0x3e8,%edi
call   1030 <run_test@plt>
mov    $0x2710,%edi
call   1030 <run_test@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x1,%edi
call   1030 <run_test@plt>
mov    $0xa,%edi
call   1030 <run_test@plt>
mov    $0x64,%edi
call   1030 <run_test@plt>
mov    $0x3e8,%edi
call   1030 <run_test@plt>
mov    $0x2710,%edi
call   1030 <run_test@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main() {
%1 = call i32 @run_test(i32 1)
%2 = call i32 @run_test(i32 10)
%3 = call i32 @run_test(i32 100)
%4 = call i32 @run_test(i32 1000)
%5 = call i32 @run_test(i32 10000)
ret i32 0
}

LLVM IR (-O2):
define i32 @main() {
%1 = tail call i32 @run_test(i32 1)
%2 = tail call i32 @run_test(i32 10)
%3 = tail call i32 @run_test(i32 100)
%4 = tail call i32 @run_test(i32 1000)
%5 = tail call i32 @run_test(i32 10000)
ret i32 0
}
int test_imm_BFint64_midword_reg(long long val) {
  return ((val >> 16) & (0xBF << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_BFint64_midword_reg>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
sar    $0x10,%rdx
and    $0xbf,%rdx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%rdx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_BFint64_midword_reg>:
test   $0xbf0000,%edi
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_BFint64_midword_reg(i64 %0) {
%2 = and i64 %0, 12517376
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
double cos(double);
double Dz(double alpha, double beta, double dl) {
  return cos(alpha) * cos(beta) * dl;
}


x86 assembly (clang, -O0):
<Dz>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <cos@plt>
movsd  %xmm0,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm0
call   1030 <cos@plt>
movaps %xmm0,%xmm1
movsd  -0x20(%rbp),%xmm0
mulsd  %xmm1,%xmm0
mulsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Dz>:
sub    $0x18,%rsp
movsd  %xmm2,0x10(%rsp)
movsd  %xmm1,0x8(%rsp)
call   1030 <cos@plt>
movsd  %xmm0,(%rsp)
movsd  0x8(%rsp),%xmm0
call   1030 <cos@plt>
mulsd  (%rsp),%xmm0
mulsd  0x10(%rsp),%xmm0
add    $0x18,%rsp
ret

LLVM IR (-O0):
define double @Dz(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
store double %0, double* %4
store double %1, double* %5
store double %2, double* %6
%7 = load double, double* %4
%8 = call double @cos(double %7)
%9 = load double, double* %5
%10 = call double @cos(double %9)
%11 = fmul double %8, %10
%12 = load double, double* %6
%13 = fmul double %11, %12
ret double %13
}

LLVM IR (-O2):
define double @Dz(double %0, double %1, double %2) {
%4 = tail call double @cos(double %0)
%5 = tail call double @cos(double %1)
%6 = fmul double %4, %5
%7 = fmul double %6, %2
ret double %7
}
int str_nr_test(char *p) {
  if (*p != '\\')
    return 0;
  if (*(p + 1) != 'n' && *(p + 1) != '*')
    return 0;
  if (*(p + 2) == '(')
    return 5;
  else
    return 3;
}


x86 assembly (clang, -O0):
<str_nr_test>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movsbl (%rax),%eax
cmp    $0x5c,%eax
je     1124 <str_nr_test+0x24>
movl   $0x0,-0x4(%rbp)
jmp    1176 <str_nr_test+0x76>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x6e,%eax
je     1152 <str_nr_test+0x52>
mov    -0x10(%rbp),%rax
movsbl 0x1(%rax),%eax
cmp    $0x2a,%eax
je     1152 <str_nr_test+0x52>
movl   $0x0,-0x4(%rbp)
jmp    1176 <str_nr_test+0x76>
mov    -0x10(%rbp),%rax
movsbl 0x2(%rax),%eax
cmp    $0x28,%eax
jne    116f <str_nr_test+0x6f>
movl   $0x5,-0x4(%rbp)
jmp    1176 <str_nr_test+0x76>
movl   $0x3,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<str_nr_test>:
xor    %eax,%eax
cmpb   $0x5c,(%rdi)
jne    1122 <str_nr_test+0x22>
mov    0x1(%rdi),%cl
cmp    $0x6e,%cl
je     1114 <str_nr_test+0x14>
cmp    $0x2a,%cl
jne    1122 <str_nr_test+0x22>
xor    %eax,%eax
cmpb   $0x28,0x2(%rdi)
sete   %al
add    %eax,%eax
add    $0x3,%eax
ret

LLVM IR (-O0):
define i32 @str_nr_test(i8* %0) {
%2 = alloca i32
%3 = alloca i8*
store i8* %0, i8** %3
%4 = load i8*, i8** %3
%5 = load i8, i8* %4
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %6, 92
br i1 %7, label %8, label %9
8: ; preds = %1
store i32 0, i32* %2
br label %30
9: ; preds = %1
%10 = load i8*, i8** %3
%11 = getelementptr inbounds i8, i8* %10, i64 1
%12 = load i8, i8* %11
%13 = sext i8 %12 to i32
%14 = icmp ne i32 %13, 110
br i1 %14, label %15, label %22
15: ; preds = %9
%16 = load i8*, i8** %3
%17 = getelementptr inbounds i8, i8* %16, i64 1
%18 = load i8, i8* %17
%19 = sext i8 %18 to i32
%20 = icmp ne i32 %19, 42
br i1 %20, label %21, label %22
21: ; preds = %15
store i32 0, i32* %2
br label %30
22: ; preds = %15, %9
%23 = load i8*, i8** %3
%24 = getelementptr inbounds i8, i8* %23, i64 2
%25 = load i8, i8* %24
%26 = sext i8 %25 to i32
%27 = icmp eq i32 %26, 40
br i1 %27, label %28, label %29
28: ; preds = %22
store i32 5, i32* %2
br label %30
29: ; preds = %22
store i32 3, i32* %2
br label %30
30: ; preds = %29, %28, %21, %8
%31 = load i32, i32* %2
ret i32 %31
}

LLVM IR (-O2):
define i32 @str_nr_test(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp eq i8 %2, 92
br i1 %3, label %4, label %12
4: ; preds = %1
%5 = getelementptr inbounds i8, i8* %0, i64 1
%6 = load i8, i8* %5
switch i8 %6, label %12 [
i8 110, label %7
i8 42, label %7
]
7: ; preds = %4, %4
%8 = getelementptr inbounds i8, i8* %0, i64 2
%9 = load i8, i8* %8
%10 = icmp eq i8 %9, 40
%11 = select i1 %10, i32 5, i32 3
br label %12
12: ; preds = %7, %4, %1
%13 = phi i32 [ 0, %1 ], [ 0, %4 ], [ %11, %7 ]
ret i32 %13
}
/* Variables and functions */
int /*<<< orphan*/ RIT128x96x4Init(int);
int /*<<< orphan*/ RIT128x96x4StringDraw(char *, int, int, int);
int /*<<< orphan*/ SysCtlClockSet(int);
int main(void) {
  SysCtlClockSet(0x07800000 | 0x00003800 | 0x00000000 | 0x00000380);
  RIT128x96x4Init(1000000);
  RIT128x96x4StringDraw("Hello World!", 30, 24, 15);
  while (1) {
  }
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    $0x7803b80,%edi
call   1030 <SysCtlClockSet@plt>
mov    $0xf4240,%edi
call   1040 <RIT128x96x4Init@plt>
lea    0xea6(%rip),%rdi
mov    $0x1e,%esi
mov    $0x18,%edx
mov    $0xf,%ecx
call   1050 <RIT128x96x4StringDraw@plt>
jmp    116e <main+0x3e>

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x7803b80,%edi
call   1030 <SysCtlClockSet@plt>
mov    $0xf4240,%edi
call   1040 <RIT128x96x4Init@plt>
lea    0xeb4(%rip),%rdi
mov    $0x1e,%esi
mov    $0x18,%edx
mov    $0xf,%ecx
call   1050 <RIT128x96x4StringDraw@plt>
jmp    1160 <main+0x30>

LLVM IR (-O0):
@.str = [13 x i8] c"Hello World!\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @SysCtlClockSet(i32 125844352)
%3 = call i32 @RIT128x96x4Init(i32 1000000)
%4 = call i32 @RIT128x96x4StringDraw(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 30, i32 24, i32 15)
br label %5
5: ; preds = %0, %5
br label %5
}

LLVM IR (-O2):
@.str = [13 x i8] c"Hello World!\00"
define i32 @main() {
%1 = tail call i32 @SysCtlClockSet(i32 125844352)
%2 = tail call i32 @RIT128x96x4Init(i32 1000000)
%3 = tail call i32 @RIT128x96x4StringDraw(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0), i32 30, i32 24, i32 15)
br label %4
4: ; preds = %0, %4
br label %4
}
float DotProduct(const float v0[3], const float v1[3]) {
  float dot;
  dot = v0[0] * v1[0] + v0[1] * v1[1] + v0[2] * v1[2];
  return dot;
}


x86 assembly (clang, -O0):
<DotProduct>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movss  (%rax),%xmm1
mov    -0x10(%rbp),%rax
movss  (%rax),%xmm2
mov    -0x8(%rbp),%rax
movss  0x4(%rax),%xmm0
mov    -0x10(%rbp),%rax
mulss  0x4(%rax),%xmm0
mulss  %xmm2,%xmm1
addss  %xmm0,%xmm1
mov    -0x8(%rbp),%rax
movss  0x8(%rax),%xmm0
mov    -0x10(%rbp),%rax
movss  0x8(%rax),%xmm2
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
movss  %xmm0,-0x14(%rbp)
movss  -0x14(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<DotProduct>:
movss  0x4(%rdi),%xmm0
mulss  0x4(%rsi),%xmm0
movss  (%rdi),%xmm1
mulss  (%rsi),%xmm1
addss  %xmm0,%xmm1
movss  0x8(%rdi),%xmm0
mulss  0x8(%rsi),%xmm0
addss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @DotProduct(float* %0, float* %1) {
%3 = alloca float*
%4 = alloca float*
%5 = alloca float
store float* %0, float** %3
store float* %1, float** %4
%6 = load float*, float** %3
%7 = getelementptr inbounds float, float* %6, i64 0
%8 = load float, float* %7
%9 = load float*, float** %4
%10 = getelementptr inbounds float, float* %9, i64 0
%11 = load float, float* %10
%12 = load float*, float** %3
%13 = getelementptr inbounds float, float* %12, i64 1
%14 = load float, float* %13
%15 = load float*, float** %4
%16 = getelementptr inbounds float, float* %15, i64 1
%17 = load float, float* %16
%18 = fmul float %14, %17
%19 = call float @llvm.fmuladd.f32(float %8, float %11, float %18)
%20 = load float*, float** %3
%21 = getelementptr inbounds float, float* %20, i64 2
%22 = load float, float* %21
%23 = load float*, float** %4
%24 = getelementptr inbounds float, float* %23, i64 2
%25 = load float, float* %24
%26 = call float @llvm.fmuladd.f32(float %22, float %25, float %19)
store float %26, float* %5
%27 = load float, float* %5
ret float %27
}

LLVM IR (-O2):
define float @DotProduct(float* nocapture %0, float* nocapture %1) {
%3 = load float, float* %0
%4 = load float, float* %1
%5 = getelementptr inbounds float, float* %0, i64 1
%6 = load float, float* %5
%7 = getelementptr inbounds float, float* %1, i64 1
%8 = load float, float* %7
%9 = fmul float %6, %8
%10 = tail call float @llvm.fmuladd.f32(float %3, float %4, float %9)
%11 = getelementptr inbounds float, float* %0, i64 2
%12 = load float, float* %11
%13 = getelementptr inbounds float, float* %1, i64 2
%14 = load float, float* %13
%15 = tail call float @llvm.fmuladd.f32(float %12, float %14, float %10)
ret float %15
}
/* Variables and functions */
double log(double);
double _p3dPunThresholding_flog(double x) {
  if (x <= 0.0)
    return 0.0;
  return log((double)x);
}


x86 assembly (clang, -O0):
<_p3dPunThresholding_flog>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x10(%rbp)
xorps  %xmm0,%xmm0
ucomisd -0x10(%rbp),%xmm0
jb     1138 <_p3dPunThresholding_flog+0x28>
xorps  %xmm0,%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    1147 <_p3dPunThresholding_flog+0x37>
movsd  -0x10(%rbp),%xmm0
call   1030 <log@plt>
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_p3dPunThresholding_flog>:
xorpd  %xmm1,%xmm1
ucomisd %xmm0,%xmm1
jae    111f <_p3dPunThresholding_flog+0xf>
jmp    1030 <log@plt>
xorpd  %xmm0,%xmm0
ret

LLVM IR (-O0):
define double @_p3dPunThresholding_flog(double %0) {
%2 = alloca double
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fcmp ole double %4, 0.000000e+00
br i1 %5, label %6, label %7
6: ; preds = %1
store double 0.000000e+00, double* %2
br label %10
7: ; preds = %1
%8 = load double, double* %3
%9 = call double @log(double %8)
store double %9, double* %2
br label %10
10: ; preds = %7, %6
%11 = load double, double* %2
ret double %11
}

LLVM IR (-O2):
define double @_p3dPunThresholding_flog(double %0) {
%2 = fcmp ugt double %0, 0.000000e+00
br i1 %2, label %3, label %5
3: ; preds = %1
%4 = tail call double @log(double %0)
br label %5
5: ; preds = %1, %3
%6 = phi double [ %4, %3 ], [ 0.000000e+00, %1 ]
ret double %6
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;
struct Address {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ address_set_port(struct Address *, int /*<<< orphan*/);
int atoi(char const *);
int address_set_port_str(struct Address *addr, const char *str) {
  int port = atoi(str);
  if (port < 0 || port > 65535) {
    return 0;
  }
  address_set_port(addr, (uint16_t)port);
  return 1;
}


x86 assembly (clang, -O0):
<address_set_port_str>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x1c(%rbp)
cmpl   $0x0,-0x1c(%rbp)
jl     1153 <address_set_port_str+0x33>
cmpl   $0xffff,-0x1c(%rbp)
jle    115f <address_set_port_str+0x3f>
movl   $0x0,-0x4(%rbp)
jmp    1172 <address_set_port_str+0x52>
mov    -0x10(%rbp),%rdi
mov    -0x1c(%rbp),%esi
call   1030 <address_set_port@plt>
movl   $0x1,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<address_set_port_str>:
push   %rbx
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1040 <atoi@plt>
xor    %ecx,%ecx
cmp    $0xffff,%eax
ja     1144 <address_set_port_str+0x24>
mov    %rbx,%rdi
mov    %eax,%esi
call   1030 <address_set_port@plt>
mov    $0x1,%ecx
mov    %ecx,%eax
pop    %rbx
ret

LLVM IR (-O0):
%struct.Address = type { i32 }
define i32 @address_set_port_str(%struct.Address* %0, i8* %1) {
%3 = alloca i32
%4 = alloca %struct.Address*
%5 = alloca i8*
%6 = alloca i32
store %struct.Address* %0, %struct.Address** %4
store i8* %1, i8** %5
%7 = load i8*, i8** %5
%8 = call i32 @atoi(i8* %7)
store i32 %8, i32* %6
%9 = load i32, i32* %6
%10 = icmp slt i32 %9, 0
br i1 %10, label %14, label %11
11: ; preds = %2
%12 = load i32, i32* %6
%13 = icmp sgt i32 %12, 65535
br i1 %13, label %14, label %15
14: ; preds = %11, %2
store i32 0, i32* %3
br label %19
15: ; preds = %11
%16 = load %struct.Address*, %struct.Address** %4
%17 = load i32, i32* %6
%18 = call i32 @address_set_port(%struct.Address* %16, i32 %17)
store i32 1, i32* %3
br label %19
19: ; preds = %15, %14
%20 = load i32, i32* %3
ret i32 %20
}

LLVM IR (-O2):
%struct.Address = type { i32 }
define i32 @address_set_port_str(%struct.Address* %0, i8* nocapture %1) {
%3 = tail call i32 @atoi(i8* %1)
%4 = icmp ugt i32 %3, 65535
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = tail call i32 @address_set_port(%struct.Address* %0, i32 %3)
br label %7
7: ; preds = %2, %5
%8 = phi i32 [ 1, %5 ], [ 0, %2 ]
ret i32 %8
}
float CrossProduct(float x1, float y1, float x2, float y2) {
  return (x1 * y2 - y1 * x2);
}


x86 assembly (clang, -O0):
<CrossProduct>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  %xmm2,-0xc(%rbp)
movss  %xmm3,-0x10(%rbp)
movss  -0x4(%rbp),%xmm0
movss  -0x10(%rbp),%xmm2
movss  -0x8(%rbp),%xmm1
mulss  -0xc(%rbp),%xmm1
movd   %xmm1,%eax
xor    $0x80000000,%eax
movd   %eax,%xmm1
mulss  %xmm2,%xmm0
addss  %xmm1,%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<CrossProduct>:
mulss  %xmm2,%xmm1
mulss  %xmm3,%xmm0
subss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @CrossProduct(float %0, float %1, float %2, float %3) {
%5 = alloca float
%6 = alloca float
%7 = alloca float
%8 = alloca float
store float %0, float* %5
store float %1, float* %6
store float %2, float* %7
store float %3, float* %8
%9 = load float, float* %5
%10 = load float, float* %8
%11 = load float, float* %6
%12 = load float, float* %7
%13 = fmul float %11, %12
%14 = fneg float %13
%15 = call float @llvm.fmuladd.f32(float %9, float %10, float %14)
ret float %15
}

LLVM IR (-O2):
define float @CrossProduct(float %0, float %1, float %2, float %3) {
%5 = fneg float %1
%6 = fmul float %5, %2
%7 = tail call float @llvm.fmuladd.f32(float %0, float %3, float %6)
ret float %7
}
int sum(char b[]) {
  int i, sum;
  i = 0;
  sum = 0;
  while (b[i] > 0) {
    sum = sum + b[i];
    i = i + 1;
  }
  return sum;
}


x86 assembly (clang, -O0):
<sum>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0x0,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x8(%rbp),%rax
movslq -0xc(%rbp),%rcx
movsbl (%rax,%rcx,1),%eax
cmp    $0x0,%eax
jle    114d <sum+0x4d>
mov    -0x10(%rbp),%eax
mov    -0x8(%rbp),%rcx
movslq -0xc(%rbp),%rdx
movsbl (%rcx,%rdx,1),%ecx
add    %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0xc(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0xc(%rbp)
jmp    1116 <sum+0x16>
mov    -0x10(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sum>:
mov    (%rdi),%cl
test   %cl,%cl
jle    1121 <sum+0x21>
add    $0x1,%rdi
xor    %eax,%eax
nopl   0x0(%rax)
movzbl %cl,%ecx
add    %ecx,%eax
movzbl (%rdi),%ecx
add    $0x1,%rdi
test   %cl,%cl
jg     1110 <sum+0x10>
ret
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @sum(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i32
store i8* %0, i8** %2
store i32 0, i32* %3
store i32 0, i32* %4
br label %5
5: ; preds = %13, %1
%6 = load i8*, i8** %2
%7 = load i32, i32* %3
%8 = sext i32 %7 to i64
%9 = getelementptr inbounds i8, i8* %6, i64 %8
%10 = load i8, i8* %9
%11 = sext i8 %10 to i32
%12 = icmp sgt i32 %11, 0
br i1 %12, label %13, label %24
13: ; preds = %5
%14 = load i32, i32* %4
%15 = load i8*, i8** %2
%16 = load i32, i32* %3
%17 = sext i32 %16 to i64
%18 = getelementptr inbounds i8, i8* %15, i64 %17
%19 = load i8, i8* %18
%20 = sext i8 %19 to i32
%21 = add nsw i32 %14, %20
store i32 %21, i32* %4
%22 = load i32, i32* %3
%23 = add nsw i32 %22, 1
store i32 %23, i32* %3
br label %5
24: ; preds = %5
%25 = load i32, i32* %4
ret i32 %25
}

LLVM IR (-O2):
define i32 @sum(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = icmp sgt i8 %2, 0
br i1 %3, label %4, label %14
4: ; preds = %1, %4
%5 = phi i64 [ %10, %4 ], [ 0, %1 ]
%6 = phi i8 [ %12, %4 ], [ %2, %1 ]
%7 = phi i32 [ %9, %4 ], [ 0, %1 ]
%8 = zext i8 %6 to i32
%9 = add nuw nsw i32 %7, %8
%10 = add nuw nsw i64 %5, 1
%11 = getelementptr inbounds i8, i8* %0, i64 %10
%12 = load i8, i8* %11
%13 = icmp sgt i8 %12, 0
br i1 %13, label %4, label %14
14: ; preds = %4, %1
%15 = phi i32 [ 0, %1 ], [ %9, %4 ]
ret i32 %15
}
/* Variables and functions */
char *_s2_f2cstr(char *, long);
int /*<<< orphan*/ free(char *);
unsigned int ss2ltt(char *, float *);
unsigned int ss2ltt_(char *cmd, float *aspect, long int textlen) {
  char *ttex = _s2_f2cstr(cmd, textlen);
  unsigned int result = ss2ltt(ttex, aspect);
  free(ttex);
  return result;
}


x86 assembly (clang, -O0):
<ss2ltt_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x18(%rbp),%rsi
call   1050 <_s2_f2cstr@plt>
mov    %rax,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
mov    -0x10(%rbp),%rsi
call   1040 <ss2ltt@plt>
mov    %eax,-0x24(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x24(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ss2ltt_>:
push   %rbp
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdx,%rsi
call   1050 <_s2_f2cstr@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1040 <ss2ltt@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %ebp,%eax
pop    %rbx
pop    %r14
pop    %rbp
ret

LLVM IR (-O0):
define i32 @ss2ltt_(i8* %0, float* %1, i64 %2) {
%4 = alloca i8*
%5 = alloca float*
%6 = alloca i64
%7 = alloca i8*
%8 = alloca i32
store i8* %0, i8** %4
store float* %1, float** %5
store i64 %2, i64* %6
%9 = load i8*, i8** %4
%10 = load i64, i64* %6
%11 = call i8* @_s2_f2cstr(i8* %9, i64 %10)
store i8* %11, i8** %7
%12 = load i8*, i8** %7
%13 = load float*, float** %5
%14 = call i32 @ss2ltt(i8* %12, float* %13)
store i32 %14, i32* %8
%15 = load i8*, i8** %7
%16 = call i32 @free(i8* %15)
%17 = load i32, i32* %8
ret i32 %17
}

LLVM IR (-O2):
define i32 @ss2ltt_(i8* %0, float* %1, i64 %2) {
%4 = tail call i8* @_s2_f2cstr(i8* %0, i64 %2)
%5 = tail call i32 @ss2ltt(i8* %4, float* %1)
%6 = tail call i32 @free(i8* %4)
ret i32 %5
}
/* Variables and functions */
double dmax(double, double);
double max_dvector(double *d, long n) {
  double maxdv = -1.0e+18;
  long i;
  for (i = 1; i <= n; i++)
    maxdv = dmax(maxdv, d[i]);
  return maxdv;
}


x86 assembly (clang, -O0):
<max_dvector>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
movsd  0xed8(%rip),%xmm0
movsd  %xmm0,-0x18(%rbp)
movq   $0x1,-0x20(%rbp)
mov    -0x20(%rbp),%rax
cmp    -0x10(%rbp),%rax
jg     1170 <max_dvector+0x60>
movsd  -0x18(%rbp),%xmm0
mov    -0x8(%rbp),%rax
mov    -0x20(%rbp),%rcx
movsd  (%rax,%rcx,8),%xmm1
call   1030 <dmax@plt>
movsd  %xmm0,-0x18(%rbp)
mov    -0x20(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x20(%rbp)
jmp    1135 <max_dvector+0x25>
movsd  -0x18(%rbp),%xmm0
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<max_dvector>:
push   %r15
push   %r14
push   %rbx
test   %rsi,%rsi
jle    1147 <max_dvector+0x37>
mov    %rsi,%r15
mov    %rdi,%r14
movsd  0xed8(%rip),%xmm0
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
movsd  0x8(%r14,%rbx,8),%xmm1
call   1030 <dmax@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <max_dvector+0x20>
jmp    114f <max_dvector+0x3f>
movsd  0xeb1(%rip),%xmm0
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
define double @max_dvector(double* %0, i64 %1) {
%3 = alloca double*
%4 = alloca i64
%5 = alloca double
%6 = alloca i64
store double* %0, double** %3
store i64 %1, i64* %4
store double -1.000000e+18, double* %5
store i64 1, i64* %6
br label %7
7: ; preds = %18, %2
%8 = load i64, i64* %6
%9 = load i64, i64* %4
%10 = icmp sle i64 %8, %9
br i1 %10, label %11, label %21
11: ; preds = %7
%12 = load double, double* %5
%13 = load double*, double** %3
%14 = load i64, i64* %6
%15 = getelementptr inbounds double, double* %13, i64 %14
%16 = load double, double* %15
%17 = call double @dmax(double %12, double %16)
store double %17, double* %5
br label %18
18: ; preds = %11
%19 = load i64, i64* %6
%20 = add nsw i64 %19, 1
store i64 %20, i64* %6
br label %7
21: ; preds = %7
%22 = load double, double* %5
ret double %22
}

LLVM IR (-O2):
define double @max_dvector(double* nocapture %0, i64 %1) {
%3 = icmp slt i64 %1, 1
br i1 %3, label %12, label %4
4: ; preds = %2, %4
%5 = phi i64 [ %10, %4 ], [ 1, %2 ]
%6 = phi double [ %9, %4 ], [ -1.000000e+18, %2 ]
%7 = getelementptr inbounds double, double* %0, i64 %5
%8 = load double, double* %7
%9 = tail call double @dmax(double %6, double %8)
%10 = add nuw i64 %5, 1
%11 = icmp eq i64 %5, %1
br i1 %11, label %12, label %4
12: ; preds = %4, %2
%13 = phi double [ -1.000000e+18, %2 ], [ %9, %4 ]
ret double %13
}
/* Variables and functions */
scalar_t__ malloc(int);
int *realloc_wrapper(int *, int);
void realloc_no_free_bad() {
  int *p = (int *)malloc(sizeof(int));
  int *q = realloc_wrapper(p, sizeof(int));
}


x86 assembly (clang, -O0):
<realloc_no_free_bad>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x4,%esi
call   1030 <realloc_wrapper@plt>
mov    %rax,-0x10(%rbp)
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<realloc_no_free_bad>:
push   %rax
mov    $0x4,%edi
call   1040 <malloc@plt>
mov    %rax,%rdi
mov    $0x4,%esi
pop    %rax
jmp    1030 <realloc_wrapper@plt>

LLVM IR (-O0):
define void @realloc_no_free_bad() {
%1 = alloca i32*
%2 = alloca i32*
%3 = call i64 @malloc(i32 4)
%4 = inttoptr i64 %3 to i32*
store i32* %4, i32** %1
%5 = load i32*, i32** %1
%6 = call i32* @realloc_wrapper(i32* %5, i32 4)
store i32* %6, i32** %2
ret void
}

LLVM IR (-O2):
define void @realloc_no_free_bad() {
%1 = tail call i64 @malloc(i32 4)
%2 = inttoptr i64 %1 to i32*
%3 = tail call i32* @realloc_wrapper(i32* %2, i32 4)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int);
void iterative_count(int x) {
  while (x <= 100) {
    printf("Iterative count : %d \n", x);
    x++;
  }
}


x86 assembly (clang, -O0):
<iterative_count>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x64,-0x4(%rbp)
jg     1142 <iterative_count+0x32>
mov    -0x4(%rbp),%esi
lea    0xed1(%rip),%rdi
call   1030 <printf@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111b <iterative_count+0xb>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<iterative_count>:
push   %r14
push   %rbx
push   %rax
cmp    $0x64,%edi
jg     1142 <iterative_count+0x32>
mov    %edi,%ebx
lea    0xede(%rip),%r14
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax)
mov    %r14,%rdi
mov    %ebx,%esi
call   1030 <printf@plt>
add    $0x1,%ebx
cmp    $0x65,%ebx
jne    1130 <iterative_count+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [23 x i8] c"Iterative count : %d \0A\00"
define void @iterative_count(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
br label %3
3: ; preds = %6, %1
%4 = load i32, i32* %2
%5 = icmp sle i32 %4, 100
br i1 %5, label %6, label %11
6: ; preds = %3
%7 = load i32, i32* %2
%8 = call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %7)
%9 = load i32, i32* %2
%10 = add nsw i32 %9, 1
store i32 %10, i32* %2
br label %3
11: ; preds = %3
ret void
}

LLVM IR (-O2):
@.str = [23 x i8] c"Iterative count : %d \0A\00"
define void @iterative_count(i32 %0) {
%2 = icmp slt i32 %0, 101
br i1 %2, label %3, label %8
3: ; preds = %1, %3
%4 = phi i32 [ %6, %3 ], [ %0, %1 ]
%5 = tail call i32 @printf(i8* getelementptr inbounds ([23 x i8], [23 x i8]* @.str, i64 0, i64 0), i32 %4)
%6 = add i32 %4, 1
%7 = icmp eq i32 %6, 101
br i1 %7, label %8, label %3
8: ; preds = %3, %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ generate_recurse(int, int *, int, int *, int /*<<< orphan*/);
void generate_combinations(int positions, int combo[positions], int set_size,
                           int set[set_size]) {
  generate_recurse(positions, combo, set_size, set, 0);
}


x86 assembly (clang, -O0):
<generate_combinations>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %edx,-0x14(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
mov    -0x14(%rbp),%edx
mov    -0x20(%rbp),%rcx
xor    %r8d,%r8d
call   1030 <generate_recurse@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<generate_combinations>:
xor    %r8d,%r8d
jmp    1030 <generate_recurse@plt>

LLVM IR (-O0):
define void @generate_combinations(i32 %0, i32* %1, i32 %2, i32* %3) {
%5 = alloca i32
%6 = alloca i32*
%7 = alloca i32
%8 = alloca i32*
store i32 %0, i32* %5
store i32* %1, i32** %6
store i32 %2, i32* %7
store i32* %3, i32** %8
%9 = load i32, i32* %5
%10 = zext i32 %9 to i64
%11 = load i32, i32* %7
%12 = zext i32 %11 to i64
%13 = load i32, i32* %5
%14 = load i32*, i32** %6
%15 = load i32, i32* %7
%16 = load i32*, i32** %8
%17 = call i32 @generate_recurse(i32 %13, i32* %14, i32 %15, i32* %16, i32 0)
ret void
}

LLVM IR (-O2):
define void @generate_combinations(i32 %0, i32* %1, i32 %2, i32* %3) {
%5 = tail call i32 @generate_recurse(i32 %0, i32* %1, i32 %2, i32* %3, i32 0)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ cwd;

/* Variables and functions */
int /*<<< orphan*/ *getcwd(char *, int);
int /*<<< orphan*/ perror(char *);
int /*<<< orphan*/ printf(char *, char *);
int executePwdCommand() {
  char cwd[1024];
  if (getcwd(cwd, sizeof(cwd)) != NULL)
    printf("Current Working Directory : %s\n", cwd);
  else {
    perror("getcwd() error");
    return -1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<executePwdCommand>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
lea    -0x410(%rbp),%rdi
mov    $0x400,%esi
call   1040 <getcwd@plt>
cmp    $0x0,%rax
je     116e <executePwdCommand+0x3e>
lea    -0x410(%rbp),%rsi
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
jmp    1186 <executePwdCommand+0x56>
lea    0xeab(%rip),%rdi
call   1050 <perror@plt>
movl   $0xffffffff,-0x4(%rbp)
jmp    118d <executePwdCommand+0x5d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<executePwdCommand>:
sub    $0x408,%rsp
mov    %rsp,%rdi
mov    $0x400,%esi
call   1040 <getcwd@plt>
test   %rax,%rax
je     1162 <executePwdCommand+0x32>
lea    0xeb0(%rip),%rdi
mov    %rsp,%rsi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x408,%rsp
ret
lea    0xeb7(%rip),%rdi
call   1050 <perror@plt>
mov    $0xffffffff,%eax
add    $0x408,%rsp
ret

LLVM IR (-O0):
@.str = [32 x i8] c"Current Working Directory : %s\0A\00"
@.str.1 = [15 x i8] c"getcwd() error\00"
define i32 @executePwdCommand() {
%1 = alloca i32
%2 = alloca [1024 x i8]
%3 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%4 = call i32* @getcwd(i8* %3, i32 1024)
%5 = icmp ne i32* %4, null
br i1 %5, label %6, label %9
6: ; preds = %0
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %2, i64 0, i64 0
%8 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %7)
br label %11
9: ; preds = %0
%10 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
store i32 -1, i32* %1
br label %12
11: ; preds = %6
store i32 0, i32* %1
br label %12
12: ; preds = %11, %9
%13 = load i32, i32* %1
ret i32 %13
}

LLVM IR (-O2):
@.str = [32 x i8] c"Current Working Directory : %s\0A\00"
@.str.1 = [15 x i8] c"getcwd() error\00"
define i32 @executePwdCommand() {
%1 = alloca [1024 x i8]
%2 = getelementptr inbounds [1024 x i8], [1024 x i8]* %1, i64 0, i64 0
%3 = call i32* @getcwd(i8* %2, i32 1024)
%4 = icmp eq i32* %3, null
br i1 %4, label %7, label %5
5: ; preds = %0
%6 = call i32 @printf(i8* getelementptr inbounds ([32 x i8], [32 x i8]* @.str, i64 0, i64 0), i8* %2)
br label %9
7: ; preds = %0
%8 = call i32 @perror(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str.1, i64 0, i64 0))
br label %9
9: ; preds = %5, %7
%10 = phi i32 [ 0, %5 ], [ -1, %7 ]
ret i32 %10
}
/* Variables and functions */
int EXIT_SUCCESS;
int /*<<< orphan*/ printf(char *);
int main() {
  printf("The world is a vampire.\n");
  return EXIT_SUCCESS;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeda(%rip),%rdi
call   1030 <printf@plt>
mov    0x2eae(%rip),%rax
mov    (%rax),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
call   1030 <puts@plt>
mov    0x2ebc(%rip),%rax
mov    (%rax),%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [25 x i8] c"The world is a vampire.\0A\00"
@EXIT_SUCCESS = global i32 0
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @EXIT_SUCCESS
ret i32 %3
}

LLVM IR (-O2):
@EXIT_SUCCESS = global i32 0
@str = [24 x i8] c"The world is a vampire.\00"
define i32 @main() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([24 x i8], [24 x i8]* @str, i64 0, i64 0))
%2 = load i32, i32* @EXIT_SUCCESS
ret i32 %2
}