xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ fputc(char, int /*<<< orphan*/);
int /*<<< orphan*/ stdout;
void print_hline() {
  for (int j = 0; j < 80; ++j) {
    fputc('-', stdout);
  }
  fputc('\n', stdout);
}


x86 assembly (clang, -O0):
<print_hline>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
cmpl   $0x50,-0x4(%rbp)
jge    114a <print_hline+0x3a>
mov    0x2eb0(%rip),%rax
mov    (%rax),%esi
mov    $0x2d,%edi
call   1030 <fputc@plt>
mov    -0x4(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x4(%rbp)
jmp    111f <print_hline+0xf>
mov    0x2e8f(%rip),%rax
mov    (%rax),%esi
mov    $0xa,%edi
call   1030 <fputc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<print_hline>:
push   %rbp
push   %rbx
push   %rax
mov    $0x50,%ebp
mov    0x2ec1(%rip),%rbx
nop
mov    (%rbx),%esi
mov    $0x2d,%edi
call   1030 <fputc@plt>
add    $0xffffffff,%ebp
jne    1120 <print_hline+0x10>
mov    (%rbx),%esi
mov    $0xa,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1030 <fputc@plt>

LLVM IR (-O0):
@stdout = global i32 0
define void @print_hline() {
%1 = alloca i32
store i32 0, i32* %1
br label %2
2: ; preds = %8, %0
%3 = load i32, i32* %1
%4 = icmp slt i32 %3, 80
br i1 %4, label %5, label %11
5: ; preds = %2
%6 = load i32, i32* @stdout
%7 = call i32 @fputc(i8 signext 45, i32 %6)
br label %8
8: ; preds = %5
%9 = load i32, i32* %1
%10 = add nsw i32 %9, 1
store i32 %10, i32* %1
br label %2
11: ; preds = %2
%12 = load i32, i32* @stdout
%13 = call i32 @fputc(i8 signext 10, i32 %12)
ret void
}

LLVM IR (-O2):
@stdout = global i32 0
define void @print_hline() {
br label %4
1: ; preds = %4
%2 = load i32, i32* @stdout
%3 = tail call i32 @fputc(i8 signext 10, i32 %2)
ret void
4: ; preds = %0, %4
%5 = phi i32 [ 0, %0 ], [ %8, %4 ]
%6 = load i32, i32* @stdout
%7 = tail call i32 @fputc(i8 signext 45, i32 %6)
%8 = add nuw nsw i32 %5, 1
%9 = icmp eq i32 %8, 80
br i1 %9, label %1, label %4
}
void DPMSCapable() {}


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

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

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

LLVM IR (-O2):
define void @DPMSCapable() {
ret void
}
void func11(int *ptr1, int *ptr2) {
  if (ptr1 && ptr2 || ptr1) {
    *ptr1 = 100;
    *ptr2 = 200;
    return;
  } else {
    *ptr1 = 300;
    *ptr2 = 400;
  }
  *ptr1 = 500;
  *ptr2 = 600;
}


x86 assembly (clang, -O0):
<func11>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1122 <func11+0x22>
cmpq   $0x0,-0x10(%rbp)
jne    112d <func11+0x2d>
cmpq   $0x0,-0x8(%rbp)
je     1146 <func11+0x46>
mov    -0x8(%rbp),%rax
movl   $0x64,(%rax)
mov    -0x10(%rbp),%rax
movl   $0xc8,(%rax)
jmp    116e <func11+0x6e>
mov    -0x8(%rbp),%rax
movl   $0x12c,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x190,(%rax)
mov    -0x8(%rbp),%rax
movl   $0x1f4,(%rax)
mov    -0x10(%rbp),%rax
movl   $0x258,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<func11>:
movl   $0x64,(%rdi)
movl   $0xc8,(%rsi)
ret

LLVM IR (-O0):
define void @func11(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 = icmp ne i32* %5, null
br i1 %6, label %7, label %10
7: ; preds = %2
%8 = load i32*, i32** %4
%9 = icmp ne i32* %8, null
br i1 %9, label %13, label %10
10: ; preds = %7, %2
%11 = load i32*, i32** %3
%12 = icmp ne i32* %11, null
br i1 %12, label %13, label %16
13: ; preds = %10, %7
%14 = load i32*, i32** %3
store i32 100, i32* %14
%15 = load i32*, i32** %4
store i32 200, i32* %15
br label %22
16: ; preds = %10
%17 = load i32*, i32** %3
store i32 300, i32* %17
%18 = load i32*, i32** %4
store i32 400, i32* %18
br label %19
19: ; preds = %16
%20 = load i32*, i32** %3
store i32 500, i32* %20
%21 = load i32*, i32** %4
store i32 600, i32* %21
br label %22
22: ; preds = %19, %13
ret void
}

LLVM IR (-O2):
define void @func11(i32* writeonly %0, i32* nocapture writeonly %1) {
%3 = icmp ne i32* %0, null
tail call void @llvm.assume(i1 %3)
store i32 100, i32* %0
store i32 200, i32* %1
ret void
}
/* Variables and functions */
scalar_t__ strcmp(char *, char *);
int sscanf(char *s, char *f, int *a) {
  if (strcmp(f, "%i"))
    *(double *)a = 2.1;
  else
    *a = 1;
  return 1;
}


x86 assembly (clang, -O0):
<sscanf>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
lea    0xed9(%rip),%rsi
call   1030 <strcmp@plt>
cmp    $0x0,%rax
je     1153 <sscanf+0x43>
mov    -0x18(%rbp),%rax
movsd  0xeb6(%rip),%xmm0
movsd  %xmm0,(%rax)
jmp    115d <sscanf+0x4d>
mov    -0x18(%rbp),%rax
movl   $0x1,(%rax)
mov    $0x1,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<sscanf>:
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%rdi
lea    0xee2(%rip),%rsi
call   1030 <strcmp@plt>
test   %rax,%rax
je     1137 <sscanf+0x27>
movabs $0x4000cccccccccccd,%rax
mov    %rax,(%rbx)
jmp    113d <sscanf+0x2d>
movl   $0x1,(%rbx)
mov    $0x1,%eax
pop    %rbx
ret

LLVM IR (-O0):
@.str = [3 x i8] c"%i\00"
define i32 @sscanf(i8* %0, i8* %1, i32* %2) {
%4 = alloca i8*
%5 = alloca i8*
%6 = alloca i32*
store i8* %0, i8** %4
store i8* %1, i8** %5
store i32* %2, i32** %6
%7 = load i8*, i8** %5
%8 = call i64 @strcmp(i8* %7, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%9 = icmp ne i64 %8, 0
br i1 %9, label %10, label %13
10: ; preds = %3
%11 = load i32*, i32** %6
%12 = bitcast i32* %11 to double*
store double 2.100000e+00, double* %12
br label %15
13: ; preds = %3
%14 = load i32*, i32** %6
store i32 1, i32* %14
br label %15
15: ; preds = %13, %10
ret i32 1
}

LLVM IR (-O2):
@.str = [3 x i8] c"%i\00"
define i32 @sscanf(i8* nocapture readnone %0, i8* %1, i32* nocapture writeonly %2) {
%4 = tail call i64 @strcmp(i8* %1, i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
%5 = icmp eq i64 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %3
%7 = bitcast i32* %2 to double*
store double 2.100000e+00, double* %7
br label %9
8: ; preds = %3
store i32 1, i32* %2
br label %9
9: ; preds = %8, %6
ret i32 1
}
/* Variables and functions */
int /*<<< orphan*/ putBezierPicture(double, double, double, double, double,
                                    double);
void putInnerBezier(double p0x, double p0y, double p1x, double p1y, double p2x,
                    double p2y) {
  putBezierPicture(p0x, p0y, p1x, p1y, p2x, p2y);
}


x86 assembly (clang, -O0):
<putInnerBezier>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
movsd  %xmm3,-0x20(%rbp)
movsd  %xmm4,-0x28(%rbp)
movsd  %xmm5,-0x30(%rbp)
movsd  -0x8(%rbp),%xmm0
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm2
movsd  -0x20(%rbp),%xmm3
movsd  -0x28(%rbp),%xmm4
movsd  -0x30(%rbp),%xmm5
call   1030 <putBezierPicture@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<putInnerBezier>:
jmp    1030 <putBezierPicture@plt>

LLVM IR (-O0):
define void @putInnerBezier(double %0, double %1, double %2, double %3, double %4, double %5) {
%7 = alloca double
%8 = alloca double
%9 = alloca double
%10 = alloca double
%11 = alloca double
%12 = alloca double
store double %0, double* %7
store double %1, double* %8
store double %2, double* %9
store double %3, double* %10
store double %4, double* %11
store double %5, double* %12
%13 = load double, double* %7
%14 = load double, double* %8
%15 = load double, double* %9
%16 = load double, double* %10
%17 = load double, double* %11
%18 = load double, double* %12
%19 = call i32 @putBezierPicture(double %13, double %14, double %15, double %16, double %17, double %18)
ret void
}

LLVM IR (-O2):
define void @putInnerBezier(double %0, double %1, double %2, double %3, double %4, double %5) {
%7 = tail call i32 @putBezierPicture(double %0, double %1, double %2, double %3, double %4, double %5)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ SIGCONT;
int /*<<< orphan*/ kill(int, int /*<<< orphan*/);
int ResumeTask(int pid) {
  kill(pid, SIGCONT);
  return 0;
}


x86 assembly (clang, -O0):
<ResumeTask>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    0x2ec3(%rip),%rax
mov    (%rax),%esi
call   1030 <kill@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ResumeTask>:
push   %rax
mov    0x2ed0(%rip),%rax
mov    (%rax),%esi
call   1030 <kill@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@SIGCONT = global i32 0
define i32 @ResumeTask(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = load i32, i32* @SIGCONT
%5 = call i32 @kill(i32 %3, i32 %4)
ret i32 0
}

LLVM IR (-O2):
@SIGCONT = global i32 0
define i32 @ResumeTask(i32 %0) {
%2 = load i32, i32* @SIGCONT
%3 = tail call i32 @kill(i32 %0, i32 %2)
ret i32 0
}
int sub(int quant1, int quant2) { return (quant1 - quant2); }


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

x86 assembly (clang, -O2):
<sub>:
mov    %edi,%eax
sub    %esi,%eax
ret

LLVM IR (-O0):
define i32 @sub(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 = sub nsw i32 %5, %6
ret i32 %7
}

LLVM IR (-O2):
define i32 @sub(i32 %0, i32 %1) {
%3 = sub nsw i32 %0, %1
ret i32 %3
}
/* Variables and functions */
scalar_t__ isTerminalRunning();
scalar_t__ terminalName();
int whiptailPresentOnly();
int whiptailPresent(void) {
  int lWhiptailPresent;
  lWhiptailPresent = whiptailPresentOnly();
  if (lWhiptailPresent && (isTerminalRunning() || terminalName())) {
    return lWhiptailPresent;
  } else {
    return 0;
  }
}


x86 assembly (clang, -O0):
<whiptailPresent>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <whiptailPresentOnly@plt>
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1179 <whiptailPresent+0x49>
mov    $0x0,%al
call   1040 <isTerminalRunning@plt>
cmp    $0x0,%rax
jne    116e <whiptailPresent+0x3e>
mov    $0x0,%al
call   1050 <terminalName@plt>
cmp    $0x0,%rax
je     1179 <whiptailPresent+0x49>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    1180 <whiptailPresent+0x50>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<whiptailPresent>:
push   %rbx
xor    %eax,%eax
call   1030 <whiptailPresentOnly@plt>
test   %eax,%eax
je     1156 <whiptailPresent+0x26>
mov    %eax,%ebx
xor    %eax,%eax
call   1040 <isTerminalRunning@plt>
test   %rax,%rax
jne    1158 <whiptailPresent+0x28>
xor    %eax,%eax
call   1050 <terminalName@plt>
test   %rax,%rax
jne    1158 <whiptailPresent+0x28>
xor    %ebx,%ebx
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @whiptailPresent() {
%1 = tail call i32 (...) @whiptailPresentOnly()
%2 = icmp eq i32 %1, 0
br i1 %2, label %9, label %3
3: ; preds = %0
%4 = tail call i64 (...) @isTerminalRunning()
%5 = icmp eq i64 %4, 0
br i1 %5, label %6, label %10
6: ; preds = %3
%7 = tail call i64 (...) @terminalName()
%8 = icmp eq i64 %7, 0
br i1 %8, label %9, label %10
9: ; preds = %6, %0
br label %10
10: ; preds = %3, %6, %9
%11 = phi i32 [ 0, %9 ], [ %1, %6 ], [ %1, %3 ]
ret i32 %11
}
/* Type definitions */
typedef int /*<<< orphan*/ uint8_t;
typedef int /*<<< orphan*/ uint32_t;
typedef int /*<<< orphan*/ uint16_t;

/* Variables and functions */
int /*<<< orphan*/ LoRaMacPayloadEncrypt(int /*<<< orphan*/ const *,
                                         int /*<<< orphan*/,
                                         int /*<<< orphan*/ const *,
                                         int /*<<< orphan*/, int /*<<< orphan*/,
                                         int /*<<< orphan*/,
                                         int /*<<< orphan*/ *);
void LoRaMacPayloadDecrypt(const uint8_t *buffer, uint16_t size,
                           const uint8_t *key, uint32_t address, uint8_t dir,
                           uint32_t sequenceCounter, uint8_t *decBuffer) {
  LoRaMacPayloadEncrypt(buffer, size, key, address, dir, sequenceCounter,
                        decBuffer);
}


x86 assembly (clang, -O0):
<LoRaMacPayloadDecrypt>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    0x10(%rbp),%rax
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %ecx,-0x1c(%rbp)
mov    %r8d,-0x20(%rbp)
mov    %r9d,-0x24(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x18(%rbp),%rdx
mov    -0x1c(%rbp),%ecx
mov    -0x20(%rbp),%r8d
mov    -0x24(%rbp),%r9d
mov    0x10(%rbp),%rax
mov    %rax,(%rsp)
call   1030 <LoRaMacPayloadEncrypt@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<LoRaMacPayloadDecrypt>:
jmp    1030 <LoRaMacPayloadEncrypt@plt>

LLVM IR (-O0):
define void @LoRaMacPayloadDecrypt(i32* %0, i32 %1, i32* %2, i32 %3, i32 %4, i32 %5, i32* %6) {
%8 = alloca i32*
%9 = alloca i32
%10 = alloca i32*
%11 = alloca i32
%12 = alloca i32
%13 = alloca i32
%14 = alloca i32*
store i32* %0, i32** %8
store i32 %1, i32* %9
store i32* %2, i32** %10
store i32 %3, i32* %11
store i32 %4, i32* %12
store i32 %5, i32* %13
store i32* %6, i32** %14
%15 = load i32*, i32** %8
%16 = load i32, i32* %9
%17 = load i32*, i32** %10
%18 = load i32, i32* %11
%19 = load i32, i32* %12
%20 = load i32, i32* %13
%21 = load i32*, i32** %14
%22 = call i32 @LoRaMacPayloadEncrypt(i32* %15, i32 %16, i32* %17, i32 %18, i32 %19, i32 %20, i32* %21)
ret void
}

LLVM IR (-O2):
define void @LoRaMacPayloadDecrypt(i32* %0, i32 %1, i32* %2, i32 %3, i32 %4, i32 %5, i32* %6) {
%8 = tail call i32 @LoRaMacPayloadEncrypt(i32* %0, i32 %1, i32* %2, i32 %3, i32 %4, i32 %5, i32* %6)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(void *);
void hz_free(void *ptr) { free(ptr); }


x86 assembly (clang, -O0):
<hz_free>:
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):
<hz_free>:
jmp    1030 <free@plt>

LLVM IR (-O0):
define void @hz_free(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 @hz_free(i8* nocapture %0) {
%2 = tail call i32 @free(i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ __startrek_entry_pt_OSEK_Task_ts1();
void cil_keeperOSEK_Task_ts1(void) {
  {
    __startrek_entry_pt_OSEK_Task_ts1();
    return;
  }
}


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

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

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

LLVM IR (-O2):
define void @cil_keeperOSEK_Task_ts1() {
%1 = tail call i32 (...) @__startrek_entry_pt_OSEK_Task_ts1()
ret void
}
/* Variables and functions */
char *malloc(int);
int /*<<< orphan*/ strncpy(char *, char *, int);
int /*<<< orphan*/ system(char *);
void system_(char *string, int len) {
  char *str;
  str = malloc(len + 1);
  strncpy(str, string, len);
  str[len] = '\0';
  system(str);
}


x86 assembly (clang, -O0):
<system_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0xc(%rbp),%edi
add    $0x1,%edi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
mov    -0xc(%rbp),%edx
call   1030 <strncpy@plt>
mov    -0x18(%rbp),%rax
movslq -0xc(%rbp),%rcx
movb   $0x0,(%rax,%rcx,1)
mov    -0x18(%rbp),%rdi
call   1040 <system@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<system_>:
push   %r15
push   %r14
push   %rbx
mov    %esi,%r15d
mov    %rdi,%r14
lea    0x1(%r15),%edi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
mov    %r15d,%edx
call   1030 <strncpy@plt>
movslq %r15d,%rax
movb   $0x0,(%rbx,%rax,1)
mov    %rbx,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1040 <system@plt>

LLVM IR (-O0):
define void @system_(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca i8*
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = load i32, i32* %4
%7 = add nsw i32 %6, 1
%8 = call i8* @malloc(i32 %7)
store i8* %8, i8** %5
%9 = load i8*, i8** %5
%10 = load i8*, i8** %3
%11 = load i32, i32* %4
%12 = call i32 @strncpy(i8* %9, i8* %10, i32 %11)
%13 = load i8*, i8** %5
%14 = load i32, i32* %4
%15 = sext i32 %14 to i64
%16 = getelementptr inbounds i8, i8* %13, i64 %15
store i8 0, i8* %16
%17 = load i8*, i8** %5
%18 = call i32 @system(i8* %17)
ret void
}

LLVM IR (-O2):
define void @system_(i8* %0, i32 %1) {
%3 = add nsw i32 %1, 1
%4 = tail call i8* @malloc(i32 %3)
%5 = tail call i32 @strncpy(i8* %4, i8* %0, i32 %1)
%6 = sext i32 %1 to i64
%7 = getelementptr inbounds i8, i8* %4, i64 %6
store i8 0, i8* %7
%8 = tail call i32 @system(i8* %4)
ret void
}
A0AX1(r0, r1, x0, x1, p0, p1) short r0, r1;
short *p0, *p1;
{
  if ((*((short *)10000000)) <= (((short *)11111111)[x1]))
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<A0AX1>:
push   %rbp
mov    %rsp,%rbp
mov    %esi,%eax
mov    %di,%si
mov    %si,-0x6(%rbp)
mov    %ax,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %ecx,-0x10(%rbp)
mov    %r8,-0x18(%rbp)
mov    %r9,-0x20(%rbp)
mov    $0x989680,%eax
movswl (%rax),%eax
movslq -0x10(%rbp),%rdx
mov    $0xa98ac7,%ecx
movswl (%rcx,%rdx,2),%ecx
cmp    %ecx,%eax
jg     1148 <A0AX1+0x48>
movl   $0x1,-0x4(%rbp)
jmp    114f <A0AX1+0x4f>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<A0AX1>:
movzwl 0x989680,%edx
movslq %ecx,%rcx
xor    %eax,%eax
cmp    0xa98ac7(%rcx,%rcx,1),%dx
setle  %al
ret

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

LLVM IR (-O2):
define i32 @A0AX1(i32 %0, i32 %1, i32 %2, i32 %3, i16* nocapture readnone %4, i16* nocapture readnone %5) {
%7 = load i16, i16* inttoptr (i64 10000000 to i16*)
%8 = sext i32 %3 to i64
%9 = getelementptr inbounds i16, i16* inttoptr (i64 11111111 to i16*), i64 %8
%10 = load i16, i16* %9
%11 = icmp sle i16 %7, %10
%12 = zext i1 %11 to i32
ret i32 %12
}
/* Variables and functions */
int /*<<< orphan*/ croak(char *);
void map3d_xy(double x, double y, double z, unsigned int *xt,
              unsigned int *yt) {
  croak("Unsupported function map3d_xy called");
}


x86 assembly (clang, -O0):
<map3d_xy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
mov    %rdi,-0x20(%rbp)
mov    %rsi,-0x28(%rbp)
lea    0xeca(%rip),%rdi
call   1030 <croak@plt>
add    $0x30,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@.str = [37 x i8] c"Unsupported function map3d_xy called\00"
define void @map3d_xy(double %0, double %1, double %2, i32* %3, i32* %4) {
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca i32*
%10 = alloca i32*
store double %0, double* %6
store double %1, double* %7
store double %2, double* %8
store i32* %3, i32** %9
store i32* %4, i32** %10
%11 = call i32 @croak(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [37 x i8] c"Unsupported function map3d_xy called\00"
define void @map3d_xy(double %0, double %1, double %2, i32* nocapture readnone %3, i32* nocapture readnone %4) {
%6 = tail call i32 @croak(i8* getelementptr inbounds ([37 x i8], [37 x i8]* @.str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ O_RDONLY;
int open(char *, int /*<<< orphan*/);
int read(int, int *, int);
int main() {
  int ch[2];
  int fd = open("/bin/sh", O_RDONLY);
  return read(fd, ch, 2) != 2;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0x2eb2(%rip),%rax
mov    (%rax),%esi
lea    0xec1(%rip),%rdi
call   1040 <open@plt>
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
lea    -0xc(%rbp),%rsi
mov    $0x2,%edx
call   1030 <read@plt>
cmp    $0x2,%eax
setne  %al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    0x2ec0(%rip),%rax
mov    (%rax),%esi
lea    0xecf(%rip),%rdi
call   1040 <open@plt>
mov    %rsp,%rsi
mov    %eax,%edi
mov    $0x2,%edx
call   1030 <read@plt>
xor    %ecx,%ecx
cmp    $0x2,%eax
setne  %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"/bin/sh\00"
@O_RDONLY = global i32 0
define i32 @main() {
%1 = alloca i32
%2 = alloca [2 x i32]
%3 = alloca i32
store i32 0, i32* %1
%4 = load i32, i32* @O_RDONLY
%5 = call i32 @open(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %4)
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = getelementptr inbounds [2 x i32], [2 x i32]* %2, i64 0, i64 0
%8 = call i32 @read(i32 %6, i32* %7, i32 2)
%9 = icmp ne i32 %8, 2
%10 = zext i1 %9 to i32
ret i32 %10
}

LLVM IR (-O2):
@.str = [8 x i8] c"/bin/sh\00"
@O_RDONLY = global i32 0
define i32 @main() {
%1 = alloca [2 x i32]
%2 = bitcast [2 x i32]* %1 to i8*
%3 = load i32, i32* @O_RDONLY
%4 = tail call i32 @open(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = getelementptr inbounds [2 x i32], [2 x i32]* %1, i64 0, i64 0
%6 = call i32 @read(i32 %4, i32* %5, i32 2)
%7 = icmp ne i32 %6, 2
%8 = zext i1 %7 to i32
ret i32 %8
}
int test_imm_60uint64_lowword_reg(unsigned long long val) {
  return ((val) & (0x60 << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_60uint64_lowword_reg(i64 %0) {
%2 = alloca i64
store i64 %0, i64* %2
%3 = load i64, i64* %2
%4 = and i64 %3, 96
%5 = icmp ne i64 %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_60uint64_lowword_reg(i64 %0) {
%2 = and i64 %0, 96
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}
/* Variables and functions */
scalar_t__ ISNANd(double);
int ISINFd(double x) { return !ISNANd(x) && ISNANd(x - x); }


x86 assembly (clang, -O0):
<ISINFd>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
call   1030 <ISNANd@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    $0x0,%rcx
mov    %al,-0x9(%rbp)
jne    1152 <ISINFd+0x42>
movsd  -0x8(%rbp),%xmm0
subsd  -0x8(%rbp),%xmm0
call   1030 <ISNANd@plt>
cmp    $0x0,%rax
setne  %al
mov    %al,-0x9(%rbp)
mov    -0x9(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ISINFd>:
push   %rax
movsd  %xmm0,(%rsp)
call   1030 <ISNANd@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
je     1127 <ISINFd+0x17>
pop    %rcx
ret
movsd  (%rsp),%xmm0
subsd  %xmm0,%xmm0
call   1030 <ISNANd@plt>
mov    %rax,%rcx
xor    %eax,%eax
test   %rcx,%rcx
setne  %al
pop    %rcx
ret

LLVM IR (-O0):
define i32 @ISINFd(double %0) {
%2 = alloca double
store double %0, double* %2
%3 = load double, double* %2
%4 = call i64 @ISNANd(double %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %12, label %6
6: ; preds = %1
%7 = load double, double* %2
%8 = load double, double* %2
%9 = fsub double %7, %8
%10 = call i64 @ISNANd(double %9)
%11 = icmp ne i64 %10, 0
br label %12
12: ; preds = %6, %1
%13 = phi i1 [ false, %1 ], [ %11, %6 ]
%14 = zext i1 %13 to i32
ret i32 %14
}

LLVM IR (-O2):
define i32 @ISINFd(double %0) {
%2 = tail call i64 @ISNANd(double %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %9
4: ; preds = %1
%5 = fsub double %0, %0
%6 = tail call i64 @ISNANd(double %5)
%7 = icmp ne i64 %6, 0
%8 = zext i1 %7 to i32
br label %9
9: ; preds = %4, %1
%10 = phi i32 [ 0, %1 ], [ %8, %4 ]
ret i32 %10
}
/* Type definitions */
typedef int uint8_t;
typedef int uint16_t;

/* Variables and functions */
unsigned int be16get(void *p, uint16_t *v) {
  uint8_t *a;
  a = p;
  *v = a[0] << 8;
  *v |= a[1];
  return 2;
}


x86 assembly (clang, -O0):
<be16get>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rax
mov    (%rax),%ecx
shl    $0x8,%ecx
mov    -0x10(%rbp),%rax
mov    %ecx,(%rax)
mov    -0x18(%rbp),%rax
mov    0x4(%rax),%ecx
mov    -0x10(%rbp),%rax
or     (%rax),%ecx
mov    %ecx,(%rax)
mov    $0x2,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<be16get>:
mov    (%rdi),%eax
shl    $0x8,%eax
mov    %eax,(%rsi)
or     0x4(%rdi),%eax
mov    %eax,(%rsi)
mov    $0x2,%eax
ret

LLVM IR (-O0):
define i32 @be16get(i8* %0, i32* %1) {
%3 = alloca i8*
%4 = alloca i32*
%5 = alloca i32*
store i8* %0, i8** %3
store i32* %1, i32** %4
%6 = load i8*, i8** %3
%7 = bitcast i8* %6 to i32*
store i32* %7, i32** %5
%8 = load i32*, i32** %5
%9 = getelementptr inbounds i32, i32* %8, i64 0
%10 = load i32, i32* %9
%11 = shl i32 %10, 8
%12 = load i32*, i32** %4
store i32 %11, i32* %12
%13 = load i32*, i32** %5
%14 = getelementptr inbounds i32, i32* %13, i64 1
%15 = load i32, i32* %14
%16 = load i32*, i32** %4
%17 = load i32, i32* %16
%18 = or i32 %17, %15
store i32 %18, i32* %16
ret i32 2
}

LLVM IR (-O2):
define i32 @be16get(i8* nocapture %0, i32* nocapture writeonly %1) {
%3 = bitcast i8* %0 to i32*
%4 = load i32, i32* %3
%5 = shl i32 %4, 8
store i32 %5, i32* %1
%6 = getelementptr inbounds i8, i8* %0, i64 4
%7 = bitcast i8* %6 to i32*
%8 = load i32, i32* %7
%9 = or i32 %8, %5
store i32 %9, i32* %1
ret i32 2
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
int FreeObjs(char *a, char *b, char *c, char *d) {
  free(d);
  free(c);
  free(b);
  free(a);
  return (0);
}


x86 assembly (clang, -O0):
<FreeObjs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    -0x20(%rbp),%rdi
call   1030 <free@plt>
mov    -0x18(%rbp),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%rdi
call   1030 <free@plt>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<FreeObjs>:
push   %r15
push   %r14
push   %rbx
mov    %rdx,%rbx
mov    %rsi,%r14
mov    %rdi,%r15
mov    %rcx,%rdi
call   1030 <free@plt>
mov    %rbx,%rdi
call   1030 <free@plt>
mov    %r14,%rdi
call   1030 <free@plt>
mov    %r15,%rdi
call   1030 <free@plt>
xor    %eax,%eax
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define i32 @FreeObjs(i8* nocapture %0, i8* nocapture %1, i8* nocapture %2, i8* nocapture %3) {
%5 = tail call i32 @free(i8* %3)
%6 = tail call i32 @free(i8* %2)
%7 = tail call i32 @free(i8* %1)
%8 = tail call i32 @free(i8* %0)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
char *getprogname();
int /*<<< orphan*/ stderr;
void usage(void) {
  fprintf(stderr,
          "Usage: %s [-k keep-symbol] [-f keep-list-file] object-file\n"
          "\t\t [object-file ...]\n",
          getprogname());
  exit(1);
}


x86 assembly (clang, -O0):
<usage>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2ea1(%rip),%rax
mov    (%rax),%eax
mov    %eax,-0x4(%rbp)
mov    $0x0,%al
call   1030 <getprogname@plt>
mov    -0x4(%rbp),%edi
mov    %rax,%rdx
lea    0xea8(%rip),%rsi
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

x86 assembly (clang, -O2):
<usage>:
push   %rbx
mov    0x2ea8(%rip),%rax
mov    (%rax),%ebx
xor    %eax,%eax
call   1030 <getprogname@plt>
lea    0xeb8(%rip),%rsi
mov    %ebx,%edi
mov    %rax,%rdx
call   1040 <fprintf@plt>
mov    $0x1,%edi
call   1050 <exit@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [81 x i8] c"Usage: %s [-k keep-symbol] [-f keep-list-file] object-file\0A\09\09 [object-file ...]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = call i8* (...) @getprogname()
%3 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [81 x i8] c"Usage: %s [-k keep-symbol] [-f keep-list-file] object-file\0A\09\09 [object-file ...]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i8* (...) @getprogname()
%3 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([81 x i8], [81 x i8]* @.str, i64 0, i64 0), i8* %2)
%4 = tail call i32 @exit(i32 1)
unreachable
}
void rwx(bits, chars) unsigned short bits;
char *chars;
{
  chars[0] = (bits & 00400) ? 'r' : '-';
  chars[1] = (bits & 00200) ? 'w' : '-';
  chars[2] = (bits & 00100) ? 'x' : '-';
}


x86 assembly (clang, -O0):
<rwx>:
push   %rbp
mov    %rsp,%rbp
mov    %di,%ax
mov    %ax,-0x2(%rbp)
mov    %rsi,-0x10(%rbp)
movzwl -0x2(%rbp),%edx
and    $0x100,%edx
mov    $0x2d,%eax
mov    $0x72,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,(%rax)
movzwl -0x2(%rbp),%edx
and    $0x80,%edx
mov    $0x2d,%eax
mov    $0x77,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x1(%rax)
movzwl -0x2(%rbp),%edx
and    $0x40,%edx
mov    $0x2d,%eax
mov    $0x78,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
mov    %al,%cl
mov    -0x10(%rbp),%rax
mov    %cl,0x2(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<rwx>:
test   $0x100,%edi
mov    $0x2d,%eax
mov    $0x72,%ecx
cmove  %eax,%ecx
mov    %cl,(%rsi)
test   $0x80,%dil
mov    $0x77,%ecx
cmove  %eax,%ecx
mov    %cl,0x1(%rsi)
test   $0x40,%dil
mov    $0x78,%ecx
cmove  %eax,%ecx
mov    %cl,0x2(%rsi)
ret

LLVM IR (-O0):
define void @rwx(i32 %0, i8* %1) {
%3 = alloca i16
%4 = alloca i8*
%5 = trunc i32 %0 to i16
store i16 %5, i16* %3
store i8* %1, i8** %4
%6 = load i16, i16* %3
%7 = zext i16 %6 to i32
%8 = and i32 %7, 256
%9 = icmp ne i32 %8, 0
%10 = zext i1 %9 to i64
%11 = select i1 %9, i32 114, i32 45
%12 = trunc i32 %11 to i8
%13 = load i8*, i8** %4
%14 = getelementptr inbounds i8, i8* %13, i64 0
store i8 %12, i8* %14
%15 = load i16, i16* %3
%16 = zext i16 %15 to i32
%17 = and i32 %16, 128
%18 = icmp ne i32 %17, 0
%19 = zext i1 %18 to i64
%20 = select i1 %18, i32 119, i32 45
%21 = trunc i32 %20 to i8
%22 = load i8*, i8** %4
%23 = getelementptr inbounds i8, i8* %22, i64 1
store i8 %21, i8* %23
%24 = load i16, i16* %3
%25 = zext i16 %24 to i32
%26 = and i32 %25, 64
%27 = icmp ne i32 %26, 0
%28 = zext i1 %27 to i64
%29 = select i1 %27, i32 120, i32 45
%30 = trunc i32 %29 to i8
%31 = load i8*, i8** %4
%32 = getelementptr inbounds i8, i8* %31, i64 2
store i8 %30, i8* %32
ret void
}

LLVM IR (-O2):
define void @rwx(i32 %0, i8* nocapture writeonly %1) {
%3 = and i32 %0, 256
%4 = icmp eq i32 %3, 0
%5 = select i1 %4, i8 45, i8 114
store i8 %5, i8* %1
%6 = and i32 %0, 128
%7 = icmp eq i32 %6, 0
%8 = select i1 %7, i8 45, i8 119
%9 = getelementptr inbounds i8, i8* %1, i64 1
store i8 %8, i8* %9
%10 = and i32 %0, 64
%11 = icmp eq i32 %10, 0
%12 = select i1 %11, i8 45, i8 120
%13 = getelementptr inbounds i8, i8* %1, i64 2
store i8 %12, i8* %13
ret void
}
/* Variables and functions */
f(int x) {
  typedef short vla[x + g()];
  x = 1;
  vla a, b;
  return sizeof a + sizeof b;
}


x86 assembly (clang, -O0):
<f>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    %eax,-0x24(%rbp)
mov    $0x0,%al
call   1030 <g@plt>
mov    %eax,%ecx
mov    -0x24(%rbp),%eax
add    %ecx,%eax
mov    %eax,%eax
mov    %eax,%ecx
movl   $0x1,-0x4(%rbp)
mov    %rsp,%rax
mov    %rax,-0x10(%rbp)
mov    %rcx,-0x18(%rbp)
mov    %rcx,-0x20(%rbp)
mov    %rcx,%rax
shl    $0x1,%rax
shl    $0x1,%rcx
add    %rcx,%rax
mov    -0x10(%rbp),%rcx
mov    %rcx,%rsp
mov    %rbp,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<f>:
push   %rbx
mov    %edi,%ebx
xor    %eax,%eax
call   1030 <g@plt>
add    %ebx,%eax
shl    $0x2,%eax
pop    %rbx
ret

LLVM IR (-O0):
define i32 @f(i32 %0) {
%2 = alloca i32
%3 = alloca i8*
%4 = alloca i64
%5 = alloca i64
store i32 %0, i32* %2
%6 = load i32, i32* %2
%7 = call i32 (...) @g()
%8 = add nsw i32 %6, %7
%9 = zext i32 %8 to i64
store i32 1, i32* %2
%10 = call i8* @llvm.stacksave()
store i8* %10, i8** %3
%11 = alloca i16, i64 %9
store i64 %9, i64* %4
%12 = alloca i16, i64 %9
store i64 %9, i64* %5
%13 = mul nuw i64 2, %9
%14 = mul nuw i64 2, %9
%15 = add i64 %13, %14
%16 = trunc i64 %15 to i32
%17 = load i8*, i8** %3
ret i32 %16
}

LLVM IR (-O2):
define i32 @f(i32 %0) {
%2 = tail call i32 (...) @g()
%3 = add nsw i32 %2, %0
%4 = shl i32 %3, 2
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ abort();
void _vector_abort(void) { abort(); }


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

x86 assembly (clang, -O2):
<_vector_abort>:
push   %rax
xor    %eax,%eax
call   1030 <abort@plt>

LLVM IR (-O0):
define void @_vector_abort() {
%1 = call i32 (...) @abort()
unreachable
}

LLVM IR (-O2):
define void @_vector_abort() {
%1 = tail call i32 (...) @abort()
unreachable
}
/* Variables and functions */
int partition(int *, int, int);
void doQuickSort(int *array, int start, int end) {
  int pivotPoint;
  if (start < end) {
    pivotPoint = partition(array, start, end);
    doQuickSort(array, start, pivotPoint - 1);
    doQuickSort(array, pivotPoint + 1, end);
  }
}


x86 assembly (clang, -O0):
<doQuickSort>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %edx,-0x10(%rbp)
mov    -0xc(%rbp),%eax
cmp    -0x10(%rbp),%eax
jge    1174 <doQuickSort+0x54>
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x10(%rbp),%edx
call   1030 <partition@plt>
mov    %eax,-0x14(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%esi
mov    -0x14(%rbp),%edx
sub    $0x1,%edx
call   1040 <doQuickSort@plt>
mov    -0x8(%rbp),%rdi
mov    -0x14(%rbp),%esi
add    $0x1,%esi
mov    -0x10(%rbp),%edx
call   1040 <doQuickSort@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<doQuickSort>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
cmp    %edx,%esi
jge    1166 <doQuickSort+0x46>
mov    %edx,%r14d
mov    %esi,%ebp
mov    %rdi,%r15
cs nopw 0x0(%rax,%rax,1)
nopl   (%rax)
mov    %r15,%rdi
mov    %ebp,%esi
mov    %r14d,%edx
call   1030 <partition@plt>
mov    %eax,%ebx
lea    -0x1(%rbx),%edx
mov    %r15,%rdi
mov    %ebp,%esi
call   1040 <doQuickSort@plt>
add    $0x1,%ebx
mov    %ebx,%ebp
cmp    %r14d,%ebx
jl     1140 <doQuickSort+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
define void @doQuickSort(i32* %0, i32 %1, i32 %2) {
%4 = alloca i32*
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
store i32* %0, i32** %4
store i32 %1, i32* %5
store i32 %2, i32* %6
%8 = load i32, i32* %5
%9 = load i32, i32* %6
%10 = icmp slt i32 %8, %9
br i1 %10, label %11, label %24
11: ; preds = %3
%12 = load i32*, i32** %4
%13 = load i32, i32* %5
%14 = load i32, i32* %6
%15 = call i32 @partition(i32* %12, i32 %13, i32 %14)
store i32 %15, i32* %7
%16 = load i32*, i32** %4
%17 = load i32, i32* %5
%18 = load i32, i32* %7
%19 = sub nsw i32 %18, 1
%20 = load i32*, i32** %4
%21 = load i32, i32* %7
%22 = add nsw i32 %21, 1
%23 = load i32, i32* %6
br label %24
24: ; preds = %11, %3
ret void
}

LLVM IR (-O2):
define void @doQuickSort(i32* %0, i32 %1, i32 %2) {
%4 = icmp slt i32 %1, %2
br i1 %4, label %5, label %11
5: ; preds = %3, %5
%6 = phi i32 [ %9, %5 ], [ %1, %3 ]
%7 = tail call i32 @partition(i32* %0, i32 %6, i32 %2)
%8 = add nsw i32 %7, -1
tail call void @doQuickSort(i32* %0, i32 %6, i32 %8)
%9 = add nsw i32 %7, 1
%10 = icmp slt i32 %9, %2
br i1 %10, label %5, label %11
11: ; preds = %5, %3
ret void
}
int main(argc, argv)
int argc;
char **argv;
{
  if (build_lookup("bind") != 4)
    abort();
  else
    exit(0);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
lea    0xeb3(%rip),%rdi
mov    $0x0,%al
call   1050 <build_lookup@plt>
cmp    $0x4,%eax
je     1162 <main+0x32>
call   1030 <abort@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xec8(%rip),%rdi
xor    %eax,%eax
call   1050 <build_lookup@plt>
cmp    $0x4,%eax
jne    114b <main+0x1b>
xor    %edi,%edi
call   1040 <exit@plt>
call   1030 <abort@plt>

LLVM IR (-O0):
@.str = [5 x i8] c"bind\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%6 = call i32 (i8*, ...) bitcast (i32 (...)* @build_lookup to i32 (i8*, ...)*)(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%7 = icmp ne i32 %6, 4
br i1 %7, label %8, label %9
8: ; preds = %2
unreachable
9: ; preds = %2
unreachable
}

LLVM IR (-O2):
@.str = [5 x i8] c"bind\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (i8*, ...) bitcast (i32 (...)* @build_lookup to i32 (i8*, ...)*)(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0))
%4 = icmp eq i32 %3, 4
br i1 %4, label %6, label %5
5: ; preds = %2
tail call void @abort()
unreachable
6: ; preds = %2
tail call void @exit(i32 0)
unreachable
}
/* Type definitions */
struct timeval {
  int tv_sec;
  int tv_usec;
};

/* Variables and functions */
int diffms(struct timeval t1, struct timeval t2) {
  int ms = (t1.tv_sec - t2.tv_sec) * 1000;
  ms += (t1.tv_usec - t2.tv_usec + 500) / 1000;
  return ms;
}


x86 assembly (clang, -O0):
<diffms>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%eax
sub    -0x10(%rbp),%eax
imul   $0x3e8,%eax,%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
sub    -0xc(%rbp),%eax
add    $0x1f4,%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
add    -0x14(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<diffms>:
mov    %rdi,%rax
shr    $0x20,%rax
sub    %esi,%edi
shr    $0x20,%rsi
imul   $0x3e8,%edi,%ecx
sub    %esi,%eax
add    $0x1f4,%eax
cltq
imul   $0x10624dd3,%rax,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rax
add    %edx,%eax
add    %ecx,%eax
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
define i32 @diffms(i64 %0, i64 %1) {
%3 = alloca %struct.timeval
%4 = alloca %struct.timeval
%5 = alloca i32
%6 = bitcast %struct.timeval* %3 to i64*
store i64 %0, i64* %6
%7 = bitcast %struct.timeval* %4 to i64*
store i64 %1, i64* %7
%8 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 0
%9 = load i32, i32* %8
%10 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i32 0, i32 0
%11 = load i32, i32* %10
%12 = sub nsw i32 %9, %11
%13 = mul nsw i32 %12, 1000
store i32 %13, i32* %5
%14 = getelementptr inbounds %struct.timeval, %struct.timeval* %3, i32 0, i32 1
%15 = load i32, i32* %14
%16 = getelementptr inbounds %struct.timeval, %struct.timeval* %4, i32 0, i32 1
%17 = load i32, i32* %16
%18 = sub nsw i32 %15, %17
%19 = add nsw i32 %18, 500
%20 = sdiv i32 %19, 1000
%21 = load i32, i32* %5
%22 = add nsw i32 %21, %20
store i32 %22, i32* %5
%23 = load i32, i32* %5
ret i32 %23
}

LLVM IR (-O2):
define i32 @diffms(i64 %0, i64 %1) {
%3 = trunc i64 %0 to i32
%4 = lshr i64 %0, 32
%5 = trunc i64 %4 to i32
%6 = trunc i64 %1 to i32
%7 = lshr i64 %1, 32
%8 = trunc i64 %7 to i32
%9 = sub nsw i32 %3, %6
%10 = mul nsw i32 %9, 1000
%11 = add i32 %5, 500
%12 = sub i32 %11, %8
%13 = sdiv i32 %12, 1000
%14 = add nsw i32 %13, %10
ret i32 %14
}
void free_strings(char **x, const int n) {
  int i;
  for (i = 0; i < n; i++)
    free(x[i]);
  free(x);
}


x86 assembly (clang, -O0):
<free_strings>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
movl   $0x0,-0x10(%rbp)
mov    -0x10(%rbp),%eax
cmp    -0xc(%rbp),%eax
jge    1151 <free_strings+0x41>
mov    -0x8(%rbp),%rax
movslq -0x10(%rbp),%rcx
mov    (%rax,%rcx,8),%rdi
call   1030 <free@plt>
mov    -0x10(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x10(%rbp)
jmp    1126 <free_strings+0x16>
mov    -0x8(%rbp),%rdi
call   1030 <free@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<free_strings>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
test   %esi,%esi
jle    1142 <free_strings+0x32>
mov    %esi,%r15d
xor    %ebx,%ebx
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
mov    (%r14,%rbx,8),%rdi
call   1030 <free@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1130 <free_strings+0x20>
mov    %r14,%rdi
pop    %rbx
pop    %r14
pop    %r15
jmp    1030 <free@plt>

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

LLVM IR (-O2):
define void @free_strings(i8** nocapture %0, i32 %1) {
%3 = icmp sgt i32 %1, 0
br i1 %3, label %4, label %12
4: ; preds = %2
%5 = zext i32 %1 to i64
br label %6
6: ; preds = %4, %6
%7 = phi i64 [ 0, %4 ], [ %10, %6 ]
%8 = getelementptr inbounds i8*, i8** %0, i64 %7
%9 = load i8*, i8** %8
tail call void @free(i8* %9)
%10 = add nuw nsw i64 %7, 1
%11 = icmp eq i64 %10, %5
br i1 %11, label %12, label %6
12: ; preds = %6, %2
%13 = bitcast i8** %0 to i8*
tail call void @free(i8* %13)
ret void
}
/* Variables and functions */
int atoi(char *);
int validate_int_HR(int);
int validate_str_HR(char *strhr) {
  int hr = 0;
  if (strhr != NULL) {
    hr = atoi(strhr);
    return validate_int_HR(hr);
  } else {
    return hr;
  }
}


x86 assembly (clang, -O0):
<validate_str_HR>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x10(%rbp)
movl   $0x0,-0x14(%rbp)
cmpq   $0x0,-0x10(%rbp)
je     115a <validate_str_HR+0x3a>
mov    -0x10(%rbp),%rdi
call   1040 <atoi@plt>
mov    %eax,-0x14(%rbp)
mov    -0x14(%rbp),%edi
call   1030 <validate_int_HR@plt>
mov    %eax,-0x4(%rbp)
jmp    1160 <validate_str_HR+0x40>
mov    -0x14(%rbp),%eax
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<validate_str_HR>:
test   %rdi,%rdi
je     1133 <validate_str_HR+0x13>
push   %rax
call   1040 <atoi@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <validate_int_HR@plt>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @validate_str_HR(i8* %0) {
%2 = icmp eq i8* %0, null
br i1 %2, label %6, label %3
3: ; preds = %1
%4 = tail call i32 @atoi(i8* %0)
%5 = tail call i32 @validate_int_HR(i32 %4)
br label %6
6: ; preds = %1, %3
%7 = phi i32 [ %5, %3 ], [ 0, %1 ]
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ setCurrentPD(int /*<<< orphan*/);
void test() { setCurrentPD(0); }


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

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

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

LLVM IR (-O2):
define void @test() {
%1 = tail call i32 @setCurrentPD(i32 0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ system(char *);
void reset_tty() { system("stty echo cooked"); }


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

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

LLVM IR (-O0):
@.str = [17 x i8] c"stty echo cooked\00"
define void @reset_tty() {
%1 = call i32 @system(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"stty echo cooked\00"
define void @reset_tty() {
%1 = tail call i32 @system(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0))
ret void
}
int x11_display_create(struct host1x *host1x, struct host1x_display *base) {
  return -1;
}


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

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

LLVM IR (-O0):
%struct.host1x = type opaque
%struct.host1x_display = type opaque
define i32 @x11_display_create(%struct.host1x* %0, %struct.host1x_display* %1) {
%3 = alloca %struct.host1x*
%4 = alloca %struct.host1x_display*
store %struct.host1x* %0, %struct.host1x** %3
store %struct.host1x_display* %1, %struct.host1x_display** %4
ret i32 -1
}

LLVM IR (-O2):
%struct.host1x = type opaque
%struct.host1x_display = type opaque
define i32 @x11_display_create(%struct.host1x* nocapture readnone %0, %struct.host1x_display* nocapture readnone %1) {
ret i32 -1
}
int test_imm_2Aint64_midword_reg(long long val) {
  return ((val >> 16) & (0x2A << 0)) ? -20 : -40;
}


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

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

LLVM IR (-O0):
define i32 @test_imm_2Aint64_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, 42
%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_2Aint64_midword_reg(i64 %0) {
%2 = and i64 %0, 2752512
%3 = icmp eq i64 %2, 0
%4 = select i1 %3, i32 -40, i32 -20
ret i32 %4
}