xunge/DecIR huggingface dataset:
void drv_base_set_char(int n, char *dat) {}


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

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

LLVM IR (-O0):
define void @drv_base_set_char(i32 %0, i8* %1) {
%3 = alloca i32
%4 = alloca i8*
store i32 %0, i32* %3
store i8* %1, i8** %4
ret void
}

LLVM IR (-O2):
define void @drv_base_set_char(i32 %0, i8* nocapture %1) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ memset(unsigned char *, int /*<<< orphan*/, int);
int /*<<< orphan*/ mpeg3_601_mmx(int, unsigned long *);
int /*<<< orphan*/ printf(char *, unsigned char, unsigned char);
int main(int argc, char *argv[]) {
  unsigned char output[1024];
  memset(output, 0, 1024);
  mpeg3_601_mmx(1, (unsigned long *)output);
  printf("%02x%02x\n", *(unsigned char *)&output[1],
         *(unsigned char *)&output[0]);
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x410,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
lea    -0x410(%rbp),%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1040 <memset@plt>
lea    -0x410(%rbp),%rsi
mov    $0x1,%edi
call   1050 <mpeg3_601_mmx@plt>
mov    -0x40f(%rbp),%al
lea    0xe8d(%rip),%rdi
movzbl %al,%esi
movzbl -0x410(%rbp),%edx
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x410,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x400,%rsp
mov    %rsp,%rbx
mov    %rbx,%rdi
xor    %esi,%esi
mov    $0x400,%edx
call   1040 <memset@plt>
mov    $0x1,%edi
mov    %rbx,%rsi
call   1050 <mpeg3_601_mmx@plt>
movzbl 0x1(%rsp),%esi
movzbl (%rsp),%edx
lea    0xe99(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x400,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@.str = [10 x i8] c"%02x%02x\0A\00"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i8**
%5 = alloca [1024 x i8]
store i32 %0, i32* %3
store i8** %1, i8*** %4
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%7 = call i32 @memset(i8* %6, i32 0, i32 1024)
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%9 = bitcast i8* %8 to i64*
%10 = call i32 @mpeg3_601_mmx(i32 1, i64* %9)
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 1
%12 = load i8, i8* %11
%13 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%14 = load i8, i8* %13
%15 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8 zeroext %12, i8 zeroext %14)
ret i32 0
}

LLVM IR (-O2):
@.str = [10 x i8] c"%02x%02x\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = call i32 @memset(i8* %4, i32 0, i32 1024)
%6 = bitcast [1024 x i8]* %3 to i64*
%7 = call i32 @mpeg3_601_mmx(i32 1, i64* %6)
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 1
%9 = load i8, i8* %8
%10 = load i8, i8* %4
%11 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0), i8 zeroext %9, i8 zeroext %10)
ret i32 0
}
/* Variables and functions */
scalar_t__ signbit(long double);
long double fabsl(long double x) { return signbit(x) ? -x : x; }


x86 assembly (clang, -O0):
<fabsl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <signbit@plt>
cmp    $0x0,%rax
je     1142 <fabsl+0x32>
fldt   -0x10(%rbp)
fchs
fstpt  -0x1c(%rbp)
jmp    1148 <fabsl+0x38>
fldt   -0x10(%rbp)
fstpt  -0x1c(%rbp)
fldt   -0x1c(%rbp)
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<fabsl>:
sub    $0x28,%rsp
fldt   0x30(%rsp)
fld    %st(0)
fstpt  0x1c(%rsp)
fstpt  (%rsp)
call   1030 <signbit@plt>
test   %rax,%rax
fldt   0x1c(%rsp)
fld    %st(0)
fchs
fcmove %st(1),%st
fstp   %st(1)
add    $0x28,%rsp
ret

LLVM IR (-O0):
define x86_fp80 @fabsl(x86_fp80 %0) {
%2 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %2
%3 = load x86_fp80, x86_fp80* %2
%4 = call i64 @signbit(x86_fp80 %3)
%5 = icmp ne i64 %4, 0
br i1 %5, label %6, label %9
6: ; preds = %1
%7 = load x86_fp80, x86_fp80* %2
%8 = fneg x86_fp80 %7
br label %11
9: ; preds = %1
%10 = load x86_fp80, x86_fp80* %2
br label %11
11: ; preds = %9, %6
%12 = phi x86_fp80 [ %8, %6 ], [ %10, %9 ]
ret x86_fp80 %12
}

LLVM IR (-O2):
define x86_fp80 @fabsl(x86_fp80 %0) {
%2 = tail call i64 @signbit(x86_fp80 %0)
%3 = icmp eq i64 %2, 0
%4 = fneg x86_fp80 %0
%5 = select i1 %3, x86_fp80 %0, x86_fp80 %4
ret x86_fp80 %5
}
/* Variables and functions */
double EvalAngDist_alpha0_5minus_0plus_15097_L5(double);
double funcAngDist_alpha0_5minus_0plus_15097_L5(double *x, double *par) {
  double result;
  result = par[0] * EvalAngDist_alpha0_5minus_0plus_15097_L5(x[0]);
  return result;
}


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

x86 assembly (clang, -O2):
<funcAngDist_alpha0_5minus_0plus_15097_L5>:
push   %rax
movsd  (%rsi),%xmm0
movsd  %xmm0,(%rsp)
movsd  (%rdi),%xmm0
call   1030 <EvalAngDist_alpha0_5minus_0plus_15097_L5@plt>
mulsd  (%rsp),%xmm0
pop    %rax
ret

LLVM IR (-O0):
define double @funcAngDist_alpha0_5minus_0plus_15097_L5(double* %0, double* %1) {
%3 = alloca double*
%4 = alloca double*
%5 = alloca double
store double* %0, double** %3
store double* %1, double** %4
%6 = load double*, double** %4
%7 = getelementptr inbounds double, double* %6, i64 0
%8 = load double, double* %7
%9 = load double*, double** %3
%10 = getelementptr inbounds double, double* %9, i64 0
%11 = load double, double* %10
%12 = call double @EvalAngDist_alpha0_5minus_0plus_15097_L5(double %11)
%13 = fmul double %8, %12
store double %13, double* %5
%14 = load double, double* %5
ret double %14
}

LLVM IR (-O2):
define double @funcAngDist_alpha0_5minus_0plus_15097_L5(double* nocapture %0, double* nocapture %1) {
%3 = load double, double* %1
%4 = load double, double* %0
%5 = tail call double @EvalAngDist_alpha0_5minus_0plus_15097_L5(double %4)
%6 = fmul double %3, %5
ret double %6
}
/* Type definitions */
struct cpufreq_related_cpus {
  int dummy;
};

/* Variables and functions */
struct cpufreq_related_cpus *sysfs_get_affected_cpus(unsigned int cpu) {
  return NULL;
}


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

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

LLVM IR (-O0):
%struct.cpufreq_related_cpus = type { i32 }
define %struct.cpufreq_related_cpus* @sysfs_get_affected_cpus(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
ret %struct.cpufreq_related_cpus* null
}

LLVM IR (-O2):
%struct.cpufreq_related_cpus = type { i32 }
define noalias %struct.cpufreq_related_cpus* @sysfs_get_affected_cpus(i32 %0) {
ret %struct.cpufreq_related_cpus* null
}
/* Variables and functions */
char *CuStrAlloc(int);
int /*<<< orphan*/ strcpy(char *, char const *);
int strlen(char const *);
char *CuStrCopy(const char *old) {
  int len = strlen(old);
  char *newStr = CuStrAlloc(len + 1);
  strcpy(newStr, old);
  return newStr;
}


x86 assembly (clang, -O0):
<CuStrCopy>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %eax,-0xc(%rbp)
mov    -0xc(%rbp),%edi
add    $0x1,%edi
call   1050 <CuStrAlloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<CuStrCopy>:
push   %r14
push   %rbx
push   %rax
mov    %rdi,%r14
call   1040 <strlen@plt>
lea    0x1(%rax),%edi
call   1050 <CuStrAlloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
mov    %rbx,%rax
add    $0x8,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
define i8* @CuStrCopy(i8* %0) {
%2 = alloca i8*
%3 = alloca i32
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i32 @strlen(i8* %5)
store i32 %6, i32* %3
%7 = load i32, i32* %3
%8 = add nsw i32 %7, 1
%9 = call i8* @CuStrAlloc(i32 %8)
store i8* %9, i8** %4
%10 = load i8*, i8** %4
%11 = load i8*, i8** %2
%12 = call i32 @strcpy(i8* %10, i8* %11)
%13 = load i8*, i8** %4
ret i8* %13
}

LLVM IR (-O2):
define i8* @CuStrCopy(i8* %0) {
%2 = tail call i32 @strlen(i8* %0)
%3 = add nsw i32 %2, 1
%4 = tail call i8* @CuStrAlloc(i32 %3)
%5 = tail call i32 @strcpy(i8* %4, i8* %0)
ret i8* %4
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, ...);
void logInfo(char *message, int log) {
  printf("\x1b[36m");
  printf("[GCLog] - %s\n", message);
  printf("\x1b[0m");
}


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

x86 assembly (clang, -O2):
<logInfo>:
push   %rbx
mov    %rdi,%rbx
lea    0xee5(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xedd(%rip),%rdi
mov    %rbx,%rsi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xeda(%rip),%rdi
xor    %eax,%eax
pop    %rbx
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [6 x i8] c"\1B[36m\00"
@.str.1 = [14 x i8] c"[GCLog] - %s\0A\00"
@.str.2 = [5 x i8] c"\1B[0m\00"
define void @logInfo(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
store i8* %0, i8** %3
store i32 %1, i32* %4
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%6 = load i8*, i8** %3
%7 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %6)
%8 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@.str = [6 x i8] c"\1B[36m\00"
@.str.1 = [14 x i8] c"[GCLog] - %s\0A\00"
@.str.2 = [5 x i8] c"\1B[0m\00"
define void @logInfo(i8* %0, i32 %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0))
%4 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str.1, i64 0, i64 0), i8* %0)
%5 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([5 x i8], [5 x i8]* @.str.2, i64 0, i64 0))
ret void
}
void data(int on) {
  if (on)
    *(volatile unsigned *)(0xBF800000 + (0x86168)) = (1 << (1));
  else
    *(volatile unsigned *)(0xBF800000 + (0x86164)) = (1 << (1));
}


x86 assembly (clang, -O0):
<data>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1121 <data+0x21>
mov    $0xbf886168,%eax
movl   $0x2,(%rax)
jmp    112c <data+0x2c>
mov    $0xbf886164,%eax
movl   $0x2,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<data>:
mov    $0xbf886164,%eax
test   %edi,%edi
je     1111 <data+0x11>
movl   $0x2,0x4(%rax)
ret
movl   $0x2,(%rax)
ret

LLVM IR (-O0):
define void @data(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp ne i32 %3, 0
br i1 %4, label %5, label %6
5: ; preds = %1
store volatile i32 2, i32* inttoptr (i64 3213386088 to i32*)
br label %7
6: ; preds = %1
store volatile i32 2, i32* inttoptr (i64 3213386084 to i32*)
br label %7
7: ; preds = %6, %5
ret void
}

LLVM IR (-O2):
define void @data(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %4, label %3
3: ; preds = %1
store volatile i32 2, i32* inttoptr (i64 3213386088 to i32*)
br label %5
4: ; preds = %1
store volatile i32 2, i32* inttoptr (i64 3213386084 to i32*)
br label %5
5: ; preds = %4, %3
ret void
}
/* Variables and functions */
int PAPI_start_counters(int *, int);
void papif_start_counters_(int *events, int *array_len, int *check) {
  *check = PAPI_start_counters(events, *array_len);
}


x86 assembly (clang, -O0):
<papif_start_counters_>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rax
mov    (%rax),%esi
call   1030 <PAPI_start_counters@plt>
mov    %eax,%ecx
mov    -0x18(%rbp),%rax
mov    %ecx,(%rax)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<papif_start_counters_>:
push   %rbx
mov    %rdx,%rbx
mov    (%rsi),%esi
call   1030 <PAPI_start_counters@plt>
mov    %eax,(%rbx)
pop    %rbx
ret

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

LLVM IR (-O2):
define void @papif_start_counters_(i32* %0, i32* nocapture %1, i32* nocapture writeonly %2) {
%4 = load i32, i32* %1
%5 = tail call i32 @PAPI_start_counters(i32* %0, i32 %4)
store i32 %5, i32* %2
ret void
}
unsigned int apm_last_error(int fd) {
  int err = 0;
  return err;
}


x86 assembly (clang, -O0):
<apm_last_error>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
mov    -0x8(%rbp),%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @apm_last_error(i32 %0) {
ret i32 0
}
/* Variables and functions */
int strcmp(char *, char *);
int compare_strings(const void *a, const void *b) {
  return strcmp(*(char **)a, *(char **)b);
}


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

x86 assembly (clang, -O2):
<compare_strings>:
mov    (%rdi),%rdi
mov    (%rsi),%rsi
jmp    1030 <strcmp@plt>

LLVM IR (-O0):
define i32 @compare_strings(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
store i8* %0, i8** %3
store i8* %1, i8** %4
%5 = load i8*, i8** %3
%6 = bitcast i8* %5 to i8**
%7 = load i8*, i8** %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i8**
%10 = load i8*, i8** %9
%11 = call i32 @strcmp(i8* %7, i8* %10)
ret i32 %11
}

LLVM IR (-O2):
define i32 @compare_strings(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i8**
%4 = load i8*, i8** %3
%5 = bitcast i8* %1 to i8**
%6 = load i8*, i8** %5
%7 = tail call i32 @strcmp(i8* dereferenceable(1) %4, i8* dereferenceable(1) %6)
ret i32 %7
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ perror(char *);
void pipe_handler(int signum) {
  perror("broken pipe ");
  exit(signum);
}


x86 assembly (clang, -O0):
<pipe_handler>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    0xece(%rip),%rdi
call   1030 <perror@plt>
mov    -0x4(%rbp),%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<pipe_handler>:
push   %rbx
mov    %edi,%ebx
lea    0xed6(%rip),%rdi
call   1030 <perror@plt>
mov    %ebx,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [13 x i8] c"broken pipe \00"
define void @pipe_handler(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%4 = load i32, i32* %2
%5 = call i32 @exit(i32 %4)
unreachable
}

LLVM IR (-O2):
@.str = [13 x i8] c"broken pipe \00"
define void @pipe_handler(i32 %0) {
%2 = tail call i32 @perror(i8* getelementptr inbounds ([13 x i8], [13 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 %0)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ Inst_Printf(char *, char *, char *);
void Jump_If_Equal(char *label) { Inst_Printf("je", "%s", label); }


x86 assembly (clang, -O0):
<Jump_If_Equal>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdx
lea    0xed9(%rip),%rdi
lea    0xed5(%rip),%rsi
call   1030 <Inst_Printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Jump_If_Equal>:
mov    %rdi,%rdx
lea    0xee6(%rip),%rdi
lea    0xee2(%rip),%rsi
jmp    1030 <Inst_Printf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"je\00"
@.str.1 = [3 x i8] c"%s\00"
define void @Jump_If_Equal(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @Inst_Printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %3)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"je\00"
@.str.1 = [3 x i8] c"%s\00"
define void @Jump_If_Equal(i8* %0) {
%2 = tail call i32 @Inst_Printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str.1, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ setgid(int /*<<< orphan*/);
int /*<<< orphan*/ setuid(int /*<<< orphan*/);
int /*<<< orphan*/ system(char *);
int main() {
  setuid(0);
  setgid(0);
  system("/bin/sh");
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
xor    %edi,%edi
call   1050 <setuid@plt>
xor    %edi,%edi
call   1040 <setgid@plt>
lea    0xeac(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %edi,%edi
call   1050 <setuid@plt>
xor    %edi,%edi
call   1040 <setgid@plt>
lea    0xeba(%rip),%rdi
call   1030 <system@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [8 x i8] c"/bin/sh\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @setuid(i32 0)
%3 = call i32 @setgid(i32 0)
%4 = call i32 @system(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [8 x i8] c"/bin/sh\00"
define i32 @main() {
%1 = tail call i32 @setuid(i32 0)
%2 = tail call i32 @setgid(i32 0)
%3 = tail call i32 @system(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
/* Type definitions */
typedef scalar_t__ __v2si;
typedef scalar_t__ __m64;

/* Variables and functions */
__m64 __attribute__((__always___, __nodebug__))
_mm_sub_pi32(__m64 __m1, __m64 __m2) {
  return (__m64)((__v2si)__m1 - (__v2si)__m2);
}


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

x86 assembly (clang, -O2):
<_mm_sub_pi32>:
mov    %rdi,%rax
sub    %rsi,%rax
ret

LLVM IR (-O0):
define i64 @_mm_sub_pi32(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %3
%6 = load i64, i64* %4
%7 = sub nsw i64 %5, %6
ret i64 %7
}

LLVM IR (-O2):
define i64 @_mm_sub_pi32(i64 %0, i64 %1) {
%3 = sub nsw i64 %0, %1
ret i64 %3
}
/* Variables and functions */
int /*<<< orphan*/ put32(unsigned int);
int /*<<< orphan*/ put8(int);
void adc_reg32_imm32(unsigned int reg32, unsigned int imm32) {
  put8(0x81);
  put8(0xD0 + reg32);
  put32(imm32);
}


x86 assembly (clang, -O0):
<adc_reg32_imm32>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    $0x81,%edi
call   1030 <put8@plt>
mov    -0x4(%rbp),%edi
add    $0xd0,%edi
call   1030 <put8@plt>
mov    -0x8(%rbp),%edi
call   1040 <put32@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<adc_reg32_imm32>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    $0x81,%edi
call   1030 <put8@plt>
add    $0xd0,%ebp
mov    %ebp,%edi
call   1030 <put8@plt>
mov    %ebx,%edi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <put32@plt>

LLVM IR (-O0):
define void @adc_reg32_imm32(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%5 = call i32 @put8(i32 129)
%6 = load i32, i32* %3
%7 = add i32 208, %6
%8 = call i32 @put8(i32 %7)
%9 = load i32, i32* %4
%10 = call i32 @put32(i32 %9)
ret void
}

LLVM IR (-O2):
define void @adc_reg32_imm32(i32 %0, i32 %1) {
%3 = tail call i32 @put8(i32 129)
%4 = add i32 %0, 208
%5 = tail call i32 @put8(i32 %4)
%6 = tail call i32 @put32(i32 %1)
ret void
}
double dclamp(double a, double min, double max) {
  if (a < min)
    return min;
  if (a > max)
    return max;
  return a;
}


x86 assembly (clang, -O0):
<dclamp>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  %xmm1,-0x18(%rbp)
movsd  %xmm2,-0x20(%rbp)
movsd  -0x10(%rbp),%xmm1
movsd  -0x18(%rbp),%xmm0
ucomisd %xmm1,%xmm0
jbe    1136 <dclamp+0x36>
movsd  -0x18(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    115f <dclamp+0x5f>
movsd  -0x10(%rbp),%xmm0
ucomisd -0x20(%rbp),%xmm0
jbe    1155 <dclamp+0x55>
movsd  -0x20(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
jmp    115f <dclamp+0x5f>
movsd  -0x10(%rbp),%xmm0
movsd  %xmm0,-0x8(%rbp)
movsd  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<dclamp>:
minsd  %xmm0,%xmm2
cmpltsd %xmm1,%xmm0
movapd %xmm0,%xmm3
andnpd %xmm2,%xmm3
andpd  %xmm1,%xmm0
orpd   %xmm3,%xmm0
ret

LLVM IR (-O0):
define double @dclamp(double %0, double %1, double %2) {
%4 = alloca double
%5 = alloca double
%6 = alloca double
%7 = alloca double
store double %0, double* %5
store double %1, double* %6
store double %2, double* %7
%8 = load double, double* %5
%9 = load double, double* %6
%10 = fcmp olt double %8, %9
br i1 %10, label %11, label %13
11: ; preds = %3
%12 = load double, double* %6
store double %12, double* %4
br label %21
13: ; preds = %3
%14 = load double, double* %5
%15 = load double, double* %7
%16 = fcmp ogt double %14, %15
br i1 %16, label %17, label %19
17: ; preds = %13
%18 = load double, double* %7
store double %18, double* %4
br label %21
19: ; preds = %13
%20 = load double, double* %5
store double %20, double* %4
br label %21
21: ; preds = %19, %17, %11
%22 = load double, double* %4
ret double %22
}

LLVM IR (-O2):
define double @dclamp(double %0, double %1, double %2) {
%4 = fcmp olt double %0, %1
%5 = fcmp ogt double %0, %2
%6 = select i1 %5, double %2, double %0
%7 = select i1 %4, double %1, double %6
ret double %7
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, int, int);
int main() { printf("%d%c", 1 ? 2 : 3, 10); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0x2,%esi
mov    $0xa,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0x2,%esi
mov    $0xa,%edx
call   1030 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%d%c\00"
define i32 @main() {
%1 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 2, i32 10)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%d%c\00"
define i32 @main() {
%1 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i32 2, i32 10)
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ brc(int, char);
int /*<<< orphan*/ padding(int);
void cub(int pn) {
  brc(pn, 'D');
  padding(2);
}


x86 assembly (clang, -O0):
<cub>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%edi
mov    $0x44,%esi
call   1040 <brc@plt>
mov    $0x2,%edi
call   1030 <padding@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<cub>:
push   %rax
mov    $0x44,%esi
call   1040 <brc@plt>
mov    $0x2,%edi
pop    %rax
jmp    1030 <padding@plt>

LLVM IR (-O0):
define void @cub(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = call i32 @brc(i32 %3, i8 signext 68)
%5 = call i32 @padding(i32 2)
ret void
}

LLVM IR (-O2):
define void @cub(i32 %0) {
%2 = tail call i32 @brc(i32 %0, i8 signext 68)
%3 = tail call i32 @padding(i32 2)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ msg;

/* Variables and functions */
int /*<<< orphan*/ LOG(char *);
int /*<<< orphan*/ snprintf(char *, int, char *, char const *, char *);
char *strerror(int);
void log_perror(const char *message, int _errno) {
  char msg[1024];
  snprintf(msg, sizeof(msg) - 1, "PERROR: %s | %s\n", message,
           strerror(_errno));
  msg[sizeof(msg) - 2] = '\n';
  msg[sizeof(msg) - 1] = '\0';
  LOG(msg);
}


x86 assembly (clang, -O0):
<log_perror>:
push   %rbp
mov    %rsp,%rbp
sub    $0x420,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
lea    -0x410(%rbp),%rax
mov    %rax,-0x420(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x418(%rbp)
mov    -0xc(%rbp),%edi
call   1050 <strerror@plt>
mov    -0x420(%rbp),%rdi
mov    -0x418(%rbp),%rcx
mov    %rax,%r8
mov    $0x3ff,%esi
lea    0xe80(%rip),%rdx
call   1030 <snprintf@plt>
movb   $0xa,-0x12(%rbp)
movb   $0x0,-0x11(%rbp)
lea    -0x410(%rbp),%rdi
call   1040 <LOG@plt>
add    $0x420,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<log_perror>:
push   %r14
push   %rbx
sub    $0x408,%rsp
mov    %rdi,%rbx
mov    %esi,%edi
call   1050 <strerror@plt>
lea    0xeb5(%rip),%rdx
mov    %rsp,%r14
mov    %r14,%rdi
mov    $0x3ff,%esi
mov    %rbx,%rcx
mov    %rax,%r8
call   1030 <snprintf@plt>
movw   $0xa,0x3fe(%rsp)
mov    %r14,%rdi
call   1040 <LOG@plt>
add    $0x408,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [17 x i8] c"PERROR: %s | %s\0A\00"
define void @log_perror(i8* %0, i32 %1) {
%3 = alloca i8*
%4 = alloca i32
%5 = alloca [1024 x i8]
store i8* %0, i8** %3
store i32 %1, i32* %4
%6 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%7 = load i8*, i8** %3
%8 = load i32, i32* %4
%9 = call i8* @strerror(i32 %8)
%10 = call i32 @snprintf(i8* %6, i32 1023, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %7, i8* %9)
%11 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 1022
store i8 10, i8* %11
%12 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 1023
store i8 0, i8* %12
%13 = getelementptr inbounds [1024 x i8], [1024 x i8]* %5, i64 0, i64 0
%14 = call i32 @LOG(i8* %13)
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"PERROR: %s | %s\0A\00"
define void @log_perror(i8* %0, i32 %1) {
%3 = alloca [1024 x i8]
%4 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 0
%5 = tail call i8* @strerror(i32 %1)
%6 = call i32 @snprintf(i8* %4, i32 1023, i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i8* %0, i8* %5)
%7 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 1022
store i8 10, i8* %7
%8 = getelementptr inbounds [1024 x i8], [1024 x i8]* %3, i64 0, i64 1023
store i8 0, i8* %8
%9 = call i32 @LOG(i8* %4)
ret void
}
/* Variables and functions */
char *GetGreeting3();
int /*<<< orphan*/ printf(char *, char *);
int main() { printf("%s!\n", GetGreeting3()); }


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1030 <GetGreeting3@plt>
mov    %rax,%rsi
lea    0xecb(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <GetGreeting3@plt>
lea    0xed1(%rip),%rdi
mov    %rax,%rsi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [5 x i8] c"%s!\0A\00"
define i32 @main() {
%1 = call i8* (...) @GetGreeting3()
%2 = call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %1)
ret i32 0
}

LLVM IR (-O2):
@.str = [5 x i8] c"%s!\0A\00"
define i32 @main() {
%1 = tail call i8* (...) @GetGreeting3()
%2 = tail call i32 @printf(i8* getelementptr inbounds ([5 x i8], [5 x i8]* @.str, i64 0, i64 0), i8* %1)
ret i32 0
}
long f4_get_long() {
  long r = 33;
  return r;
}


x86 assembly (clang, -O0):
<f4_get_long>:
push   %rbp
mov    %rsp,%rbp
movq   $0x21,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

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

LLVM IR (-O0):
define i64 @f4_get_long() {
%1 = alloca i64
store i64 33, i64* %1
%2 = load i64, i64* %1
ret i64 %2
}

LLVM IR (-O2):
define i64 @f4_get_long() {
ret i64 33
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct tm {
  scalar_t__ tm_hour;
  scalar_t__ tm_min;
  scalar_t__ tm_sec;
};

/* Variables and functions */
struct tm *localtime(int /*<<< orphan*/ *);
int /*<<< orphan*/ mktime(struct tm *);
time_t getCurrentLocalDayForTs(time_t ts) {
  struct tm *t = localtime(&ts);
  t->tm_sec = 0;
  t->tm_min = 0;
  t->tm_hour = 0;
  return mktime(t);
}


x86 assembly (clang, -O0):
<getCurrentLocalDayForTs>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
lea    -0x4(%rbp),%rdi
call   1030 <localtime@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rax
movq   $0x0,0x10(%rax)
mov    -0x10(%rbp),%rax
movq   $0x0,0x8(%rax)
mov    -0x10(%rbp),%rax
movq   $0x0,(%rax)
mov    -0x10(%rbp),%rdi
call   1040 <mktime@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<getCurrentLocalDayForTs>:
push   %rax
mov    %edi,0x4(%rsp)
lea    0x4(%rsp),%rdi
call   1030 <localtime@plt>
xorps  %xmm0,%xmm0
movups %xmm0,(%rax)
movq   $0x0,0x10(%rax)
mov    %rax,%rdi
call   1040 <mktime@plt>
pop    %rcx
ret

LLVM IR (-O0):
%struct.tm = type { i64, i64, i64 }
define i32 @getCurrentLocalDayForTs(i32 %0) {
%2 = alloca i32
%3 = alloca %struct.tm*
store i32 %0, i32* %2
%4 = call %struct.tm* @localtime(i32* %2)
store %struct.tm* %4, %struct.tm** %3
%5 = load %struct.tm*, %struct.tm** %3
%6 = getelementptr inbounds %struct.tm, %struct.tm* %5, i32 0, i32 2
store i64 0, i64* %6
%7 = load %struct.tm*, %struct.tm** %3
%8 = getelementptr inbounds %struct.tm, %struct.tm* %7, i32 0, i32 1
store i64 0, i64* %8
%9 = load %struct.tm*, %struct.tm** %3
%10 = getelementptr inbounds %struct.tm, %struct.tm* %9, i32 0, i32 0
store i64 0, i64* %10
%11 = load %struct.tm*, %struct.tm** %3
%12 = call i32 @mktime(%struct.tm* %11)
ret i32 %12
}

LLVM IR (-O2):
%struct.tm = type { i64, i64, i64 }
define i32 @getCurrentLocalDayForTs(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = call %struct.tm* @localtime(i32* %2)
%4 = bitcast %struct.tm* %3 to i8*
%5 = call i32 @mktime(%struct.tm* %3)
ret i32 %5
}
/* Variables and functions */
scalar_t__ EINTR;
int dup2(int, int);
scalar_t__ errno;
int r_dup2(int fd, int fd2) {
  int retval;
  while (retval = dup2(fd, fd2), retval == -1 && errno == EINTR)
    ;
  return retval;
}


x86 assembly (clang, -O0):
<r_dup2>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x8(%rbp),%esi
call   1030 <dup2@plt>
mov    %eax,-0xc(%rbp)
xor    %eax,%eax
cmpl   $0xffffffff,-0xc(%rbp)
mov    %al,-0xd(%rbp)
jne    1155 <r_dup2+0x45>
mov    0x2e9e(%rip),%rax
mov    (%rax),%rax
mov    0x2e8c(%rip),%rcx
cmp    (%rcx),%rax
sete   %al
mov    %al,-0xd(%rbp)
mov    -0xd(%rbp),%al
test   $0x1,%al
jne    1165 <r_dup2+0x55>
jmp    116a <r_dup2+0x5a>
jmp    111e <r_dup2+0xe>
mov    -0xc(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<r_dup2>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %esi,%ebx
mov    %edi,%ebp
mov    0x2ebe(%rip),%r14
mov    0x2eaf(%rip),%r15
nopl   0x0(%rax)
mov    %ebp,%edi
mov    %ebx,%esi
call   1030 <dup2@plt>
cmp    $0xffffffff,%eax
jne    1146 <r_dup2+0x36>
mov    (%r15),%rcx
cmp    %rcx,(%r14)
je     1130 <r_dup2+0x20>
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
ret

LLVM IR (-O0):
@errno = global i64 0
@EINTR = global i64 0
define i32 @r_dup2(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
br label %6
6: ; preds = %18, %2
%7 = load i32, i32* %3
%8 = load i32, i32* %4
%9 = call i32 @dup2(i32 %7, i32 %8)
store i32 %9, i32* %5
%10 = load i32, i32* %5
%11 = icmp eq i32 %10, -1
br i1 %11, label %12, label %16
12: ; preds = %6
%13 = load i64, i64* @errno
%14 = load i64, i64* @EINTR
%15 = icmp eq i64 %13, %14
br label %16
16: ; preds = %12, %6
%17 = phi i1 [ false, %6 ], [ %15, %12 ]
br i1 %17, label %18, label %19
18: ; preds = %16
br label %6
19: ; preds = %16
%20 = load i32, i32* %5
ret i32 %20
}

LLVM IR (-O2):
@errno = global i64 0
@EINTR = global i64 0
define i32 @r_dup2(i32 %0, i32 %1) {
br label %3
3: ; preds = %3, %2
%4 = tail call i32 @dup2(i32 %0, i32 %1)
%5 = icmp eq i32 %4, -1
%6 = load i64, i64* @errno
%7 = load i64, i64* @EINTR
%8 = icmp eq i64 %6, %7
%9 = select i1 %5, i1 %8, i1 false
br i1 %9, label %3, label %10
10: ; preds = %3
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ getcwd(char *, int);
int dir_get_current(char *dirname) { return (!getcwd(dirname, 256)); }


x86 assembly (clang, -O0):
<dir_get_current>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    $0x100,%esi
call   1030 <getcwd@plt>
cmp    $0x0,%eax
setne  %al
xor    $0xff,%al
and    $0x1,%al
movzbl %al,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dir_get_current>:
push   %rax
mov    $0x100,%esi
call   1030 <getcwd@plt>
xor    %ecx,%ecx
test   %eax,%eax
sete   %cl
mov    %ecx,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @dir_get_current(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i32 @getcwd(i8* %3, i32 256)
%5 = icmp ne i32 %4, 0
%6 = xor i1 %5, true
%7 = zext i1 %6 to i32
ret i32 %7
}

LLVM IR (-O2):
define i32 @dir_get_current(i8* %0) {
%2 = tail call i32 @getcwd(i8* %0, i32 256)
%3 = icmp eq i32 %2, 0
%4 = zext i1 %3 to i32
ret i32 %4
}
/* Variables and functions */
size_t strlen(char const *);
int /*<<< orphan*/ terminal_putchar(char const);
void terminal_writestring(const char *data) {
  size_t datalen = strlen(data);
  for (size_t i = 0; i < datalen; i++)
    terminal_putchar(data[i]);
}


x86 assembly (clang, -O0):
<terminal_writestring>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1030 <strlen@plt>
mov    %rax,-0x10(%rbp)
movq   $0x0,-0x18(%rbp)
mov    -0x18(%rbp),%rax
cmp    -0x10(%rbp),%rax
jae    1171 <terminal_writestring+0x51>
mov    -0x8(%rbp),%rax
mov    -0x18(%rbp),%rcx
movsbl (%rax,%rcx,1),%edi
call   1040 <terminal_putchar@plt>
mov    -0x18(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x18(%rbp)
jmp    1141 <terminal_writestring+0x21>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<terminal_writestring>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1030 <strlen@plt>
test   %rax,%rax
je     1153 <terminal_writestring+0x33>
mov    %rax,%r15
xor    %ebx,%ebx
nopw   0x0(%rax,%rax,1)
movsbl (%r14,%rbx,1),%edi
call   1040 <terminal_putchar@plt>
add    $0x1,%rbx
cmp    %rbx,%r15
jne    1140 <terminal_writestring+0x20>
pop    %rbx
pop    %r14
pop    %r15
ret

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

LLVM IR (-O2):
define void @terminal_writestring(i8* nocapture %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = icmp eq i64 %2, 0
br i1 %3, label %4, label %5
4: ; preds = %5, %1
ret void
5: ; preds = %1, %5
%6 = phi i64 [ %10, %5 ], [ 0, %1 ]
%7 = getelementptr inbounds i8, i8* %0, i64 %6
%8 = load i8, i8* %7
%9 = tail call i32 @terminal_putchar(i8 signext %8)
%10 = add nuw i64 %6, 1
%11 = icmp eq i64 %10, %2
br i1 %11, label %4, label %5
}
unsigned long assemble_16a(x, y, z)
unsigned int x, y, z;
{
  unsigned int temp;
  if ((0)) {
    temp = ((((((z & (~((-1) << 1))) << 1) |
               ((z ^ ((x) >> (31 - (0)) & ((1 << ((0) - (0) + 1)) - 1))) &
                (~((-1) << 1)))) &
              (~((-1) << 2)))
             << 12) |
            (((((z ^ ((x) >> (31 - (1)) & ((1 << ((1) - (1) + 1)) - 1))) &
                (~((-1) << 1)))
               << 11) |
              (y & (~((-1) << 11)))) &
             (~((-1) << 12))));
  } else {
    temp = ((((((z & (~((-1) << 1))) << 1) | (z & (~((-1) << 1)))) &
              (~((-1) << 2)))
             << 12) |
            ((((z & (~((-1) << 1))) << 11) | (y & (~((-1) << 11)))) &
             (~((-1) << 12))));
  }
  return sign_extend((temp << 2), 16);
}


x86 assembly (clang, -O0):
<assemble_16a>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0xc(%rbp),%eax
and    $0x1,%eax
shl    $0x1,%eax
mov    -0xc(%rbp),%ecx
and    $0x1,%ecx
or     %ecx,%eax
and    $0x3,%eax
shl    $0xc,%eax
mov    -0xc(%rbp),%ecx
and    $0x1,%ecx
shl    $0xb,%ecx
mov    -0x8(%rbp),%edx
and    $0x7ff,%edx
or     %edx,%ecx
and    $0xfff,%ecx
or     %ecx,%eax
mov    %eax,-0x10(%rbp)
mov    -0x10(%rbp),%edi
shl    $0x2,%edi
mov    $0x10,%esi
mov    $0x0,%al
call   1030 <sign_extend@plt>
cltq
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<assemble_16a>:
push   %rax
and    $0x1,%edx
mov    %edx,%eax
shl    $0xc,%eax
lea    (%rax,%rax,2),%eax
shl    $0xb,%edx
and    $0x7ff,%esi
lea    (%rsi,%rdx,1),%edi
or     %eax,%edi
shl    $0x2,%edi
mov    $0x10,%esi
xor    %eax,%eax
call   1030 <sign_extend@plt>
cltq
pop    %rcx
ret

LLVM IR (-O0):
define i64 @assemble_16a(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* %6
%9 = and i32 %8, 1
%10 = shl i32 %9, 1
%11 = load i32, i32* %6
%12 = and i32 %11, 1
%13 = or i32 %10, %12
%14 = and i32 %13, 3
%15 = shl i32 %14, 12
%16 = load i32, i32* %6
%17 = and i32 %16, 1
%18 = shl i32 %17, 11
%19 = load i32, i32* %5
%20 = and i32 %19, 2047
%21 = or i32 %18, %20
%22 = and i32 %21, 4095
%23 = or i32 %15, %22
store i32 %23, i32* %7
%24 = load i32, i32* %7
%25 = shl i32 %24, 2
%26 = call i32 (i32, i32, ...) bitcast (i32 (...)* @sign_extend to i32 (i32, i32, ...)*)(i32 %25, i32 16)
%27 = sext i32 %26 to i64
ret i64 %27
}

LLVM IR (-O2):
define i64 @assemble_16a(i32 %0, i32 %1, i32 %2) {
%4 = and i32 %2, 1
%5 = mul nuw nsw i32 %4, 12288
%6 = shl nuw nsw i32 %4, 11
%7 = and i32 %1, 2047
%8 = or i32 %6, %7
%9 = or i32 %5, %8
%10 = shl nuw nsw i32 %9, 2
%11 = tail call i32 (i32, i32, ...) bitcast (i32 (...)* @sign_extend to i32 (i32, i32, ...)*)(i32 %10, i32 16)
%12 = sext i32 %11 to i64
ret i64 %12
}
/* Variables and functions */
int circlemod3();
int circlemod2(void) { return circlemod3(); }


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

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

LLVM IR (-O0):
define i32 @circlemod2() {
%1 = call i32 (...) @circlemod3()
ret i32 %1
}

LLVM IR (-O2):
define i32 @circlemod2() {
%1 = tail call i32 (...) @circlemod3()
ret i32 %1
}
int main(void) {
  int i;
  for (i = 0; i < 10; i++) {
    if (i > 5) {
      break;
    }
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
movl   $0x0,-0x4(%rbp)
movl   $0x0,-0x8(%rbp)
cmpl   $0xa,-0x8(%rbp)
jge    113e <main+0x3e>
cmpl   $0x5,-0x8(%rbp)
jle    112b <main+0x2b>
jmp    113e <main+0x3e>
jmp    1130 <main+0x30>
mov    -0x8(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x8(%rbp)
jmp    1112 <main+0x12>
xor    %eax,%eax
pop    %rbp
ret

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 0
}
void f1(x, y) {
  x = 4;
  printf("x=%d\n", x);
}


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

x86 assembly (clang, -O2):
<f1>:
lea    0xee9(%rip),%rdi
mov    $0x4,%esi
xor    %eax,%eax
jmp    1030 <printf@plt>

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

LLVM IR (-O2):
@.str = [6 x i8] c"x=%d\0A\00"
define void @f1(i32 %0, i32 %1) {
%3 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([6 x i8], [6 x i8]* @.str, i64 0, i64 0), i32 4)
ret void
}
long double test_asinhl(long double x) { return __builtin_asinhl(x); }


x86 assembly (clang, -O0):
<test_asinhl>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
fldt   0x10(%rbp)
fstpt  -0x10(%rbp)
fldt   -0x10(%rbp)
mov    %rsp,%rax
fstpt  (%rax)
call   1030 <asinhl@plt>
fld    %st(0)
fstp   %st(0)
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_asinhl>:
jmp    1030 <asinhl@plt>

LLVM IR (-O0):
define x86_fp80 @test_asinhl(x86_fp80 %0) {
%2 = alloca x86_fp80
store x86_fp80 %0, x86_fp80* %2
%3 = load x86_fp80, x86_fp80* %2
%4 = call x86_fp80 @asinhl(x86_fp80 %3)
ret x86_fp80 %4
}

LLVM IR (-O2):
define x86_fp80 @test_asinhl(x86_fp80 %0) {
%2 = tail call x86_fp80 @asinhl(x86_fp80 %0)
ret x86_fp80 %2
}
/* Type definitions */
struct stat {
  int dummy;
};

/* Variables and functions */
scalar_t__ fstat(int, struct stat *);
int /*<<< orphan*/ panic(char *);
void must_fstat(int fd, struct stat *buf) {
  if (0 > fstat(fd, buf)) {
    panic("fstat error");
  }
}


x86 assembly (clang, -O0):
<must_fstat>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x4(%rbp),%edi
mov    -0x10(%rbp),%rsi
call   1040 <fstat@plt>
mov    %rax,%rcx
xor    %eax,%eax
cmp    %rcx,%rax
jle    1155 <must_fstat+0x35>
lea    0xeb0(%rip),%rdi
call   1030 <panic@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<must_fstat>:
push   %rax
call   1040 <fstat@plt>
test   %rax,%rax
js     112d <must_fstat+0xd>
pop    %rax
ret
lea    0xecc(%rip),%rdi
pop    %rax
jmp    1030 <panic@plt>

LLVM IR (-O0):
%struct.stat = type { i32 }
@.str = [12 x i8] c"fstat error\00"
define void @must_fstat(i32 %0, %struct.stat* %1) {
%3 = alloca i32
%4 = alloca %struct.stat*
store i32 %0, i32* %3
store %struct.stat* %1, %struct.stat** %4
%5 = load i32, i32* %3
%6 = load %struct.stat*, %struct.stat** %4
%7 = call i64 @fstat(i32 %5, %struct.stat* %6)
%8 = icmp sgt i64 0, %7
br i1 %8, label %9, label %11
9: ; preds = %2
%10 = call i32 @panic(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %11
11: ; preds = %9, %2
ret void
}

LLVM IR (-O2):
%struct.stat = type { i32 }
@.str = [12 x i8] c"fstat error\00"
define void @must_fstat(i32 %0, %struct.stat* nocapture %1) {
%3 = tail call i64 @fstat(i32 %0, %struct.stat* %1)
%4 = icmp slt i64 %3, 0
br i1 %4, label %5, label %7
5: ; preds = %2
%6 = tail call i32 @panic(i8* getelementptr inbounds ([12 x i8], [12 x i8]* @.str, i64 0, i64 0))
br label %7
7: ; preds = %5, %2
ret void
}
/* Variables and functions */
size_t Evt_hdrSize();
size_t HadTu_size(void const *);
size_t Evt_dataSize(const void *my) { return HadTu_size(my) - Evt_hdrSize(); }


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

x86 assembly (clang, -O2):
<Evt_dataSize>:
push   %rbx
call   1030 <HadTu_size@plt>
mov    %rax,%rbx
xor    %eax,%eax
call   1040 <Evt_hdrSize@plt>
sub    %rax,%rbx
mov    %rbx,%rax
pop    %rbx
ret

LLVM IR (-O0):
define i64 @Evt_dataSize(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i8*, i8** %2
%4 = call i64 @HadTu_size(i8* %3)
%5 = call i64 (...) @Evt_hdrSize()
%6 = sub i64 %4, %5
ret i64 %6
}

LLVM IR (-O2):
define i64 @Evt_dataSize(i8* %0) {
%2 = tail call i64 @HadTu_size(i8* %0)
%3 = tail call i64 (...) @Evt_hdrSize()
%4 = sub i64 %2, %3
ret i64 %4
}
/* Type definitions */
typedef int /*<<< orphan*/ pthread_mutex_t;

/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void ShreyasAcquired(pthread_mutex_t *m) { printf("acquired\n"); }


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

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

LLVM IR (-O0):
@.str = [10 x i8] c"acquired\0A\00"
define void @ShreyasAcquired(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = call i32 @printf(i8* getelementptr inbounds ([10 x i8], [10 x i8]* @.str, i64 0, i64 0))
ret void
}

LLVM IR (-O2):
@str = [9 x i8] c"acquired\00"
define void @ShreyasAcquired(i32* nocapture readnone %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ change_state(int /*<<< orphan*/, int, int /*<<< orphan*/);
int /*<<< orphan*/ force_exit();
void help_state_handle_input(int input) {
  if (input == ('q'))
    force_exit();
  if (input == ('\n'))
    change_state((0), (1), (0));
}


x86 assembly (clang, -O0):
<help_state_handle_input>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x71,-0x4(%rbp)
jne    113c <help_state_handle_input+0x1c>
mov    $0x0,%al
call   1040 <force_exit@plt>
cmpl   $0xa,-0x4(%rbp)
jne    1154 <help_state_handle_input+0x34>
xor    %edx,%edx
mov    $0x1,%esi
mov    %edx,%edi
call   1030 <change_state@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<help_state_handle_input>:
cmp    $0xa,%edi
je     1131 <help_state_handle_input+0x11>
cmp    $0x71,%edi
jne    113f <help_state_handle_input+0x1f>
xor    %eax,%eax
jmp    1040 <force_exit@plt>
xor    %edi,%edi
mov    $0x1,%esi
xor    %edx,%edx
jmp    1030 <change_state@plt>
ret

LLVM IR (-O0):
define void @help_state_handle_input(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
%3 = load i32, i32* %2
%4 = icmp eq i32 %3, 113
br i1 %4, label %5, label %7
5: ; preds = %1
%6 = call i32 (...) @force_exit()
br label %7
7: ; preds = %5, %1
%8 = load i32, i32* %2
%9 = icmp eq i32 %8, 10
br i1 %9, label %10, label %12
10: ; preds = %7
%11 = call i32 @change_state(i32 0, i32 1, i32 0)
br label %12
12: ; preds = %10, %7
ret void
}

LLVM IR (-O2):
define void @help_state_handle_input(i32 %0) {
switch i32 %0, label %6 [
i32 113, label %2
i32 10, label %4
]
2: ; preds = %1
%3 = tail call i32 (...) @force_exit()
br label %6
4: ; preds = %1
%5 = tail call i32 @change_state(i32 0, i32 1, i32 0)
br label %6
6: ; preds = %2, %1, %4
ret void
}