xunge/DecIR huggingface dataset:
/* Variables and functions */
int /*<<< orphan*/ fatal(char *, char *, char *);
size_t strlen(char *);
scalar_t__ strncmp(char *, char *, size_t);
char *_expect(char *str, char *expect) {
  size_t len = strlen(expect);
  if (strncmp(str, expect, len))
    fatal("Expected '%s', not '%s'\n", expect, str);
  return str + len;
}


x86 assembly (clang, -O0):
<_expect>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x18(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0x10(%rbp),%rsi
mov    -0x18(%rbp),%rdx
call   1030 <strncmp@plt>
cmp    $0x0,%rax
je     117c <_expect+0x4c>
mov    -0x10(%rbp),%rsi
mov    -0x8(%rbp),%rdx
lea    0xe89(%rip),%rdi
call   1050 <fatal@plt>
mov    -0x8(%rbp),%rax
add    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<_expect>:
push   %r15
push   %r14
push   %rbx
mov    %rsi,%r14
mov    %rdi,%rbx
mov    %rsi,%rdi
call   1040 <strlen@plt>
mov    %rax,%r15
mov    %rbx,%rdi
mov    %r14,%rsi
mov    %rax,%rdx
call   1030 <strncmp@plt>
test   %rax,%rax
je     116b <_expect+0x3b>
lea    0xea0(%rip),%rdi
mov    %r14,%rsi
mov    %rbx,%rdx
call   1050 <fatal@plt>
add    %r15,%rbx
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [25 x i8] c"Expected '%s', not '%s'\0A\00"
define i8* @_expect(i8* %0, i8* %1) {
%3 = alloca i8*
%4 = alloca i8*
%5 = alloca i64
store i8* %0, i8** %3
store i8* %1, i8** %4
%6 = load i8*, i8** %4
%7 = call i64 @strlen(i8* %6)
store i64 %7, i64* %5
%8 = load i8*, i8** %3
%9 = load i8*, i8** %4
%10 = load i64, i64* %5
%11 = call i64 @strncmp(i8* %8, i8* %9, i64 %10)
%12 = icmp ne i64 %11, 0
br i1 %12, label %13, label %17
13: ; preds = %2
%14 = load i8*, i8** %4
%15 = load i8*, i8** %3
%16 = call i32 @fatal(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %14, i8* %15)
br label %17
17: ; preds = %13, %2
%18 = load i8*, i8** %3
%19 = load i64, i64* %5
%20 = getelementptr inbounds i8, i8* %18, i64 %19
ret i8* %20
}

LLVM IR (-O2):
@.str = [25 x i8] c"Expected '%s', not '%s'\0A\00"
define i8* @_expect(i8* %0, i8* %1) {
%3 = tail call i64 @strlen(i8* dereferenceable(1) %1)
%4 = tail call i64 @strncmp(i8* %0, i8* %1, i64 %3)
%5 = icmp eq i64 %4, 0
br i1 %5, label %8, label %6
6: ; preds = %2
%7 = tail call i32 @fatal(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str, i64 0, i64 0), i8* %1, i8* %0)
br label %8
8: ; preds = %6, %2
%9 = getelementptr inbounds i8, i8* %0, i64 %3
ret i8* %9
}
void PRCMSRAMRetentionEnable(unsigned long ulSramColSel,
                             unsigned long ulModeFlags) {
  if (ulModeFlags & 0x00000002) {
    (*((volatile unsigned long *)(0x4402D000 + 0x0000001C))) =
        (ulSramColSel & 0xF);
  }
}


x86 assembly (clang, -O0):
<PRCMSRAMRetentionEnable>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
and    $0x2,%rax
cmp    $0x0,%rax
je     112e <PRCMSRAMRetentionEnable+0x2e>
mov    -0x8(%rbp),%rcx
and    $0xf,%rcx
mov    $0x4402d01c,%eax
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<PRCMSRAMRetentionEnable>:
test   $0x2,%sil
je     1111 <PRCMSRAMRetentionEnable+0x11>
and    $0xf,%edi
mov    %rdi,0x4402d01c
44
ret

LLVM IR (-O0):
define void @PRCMSRAMRetentionEnable(i64 %0, i64 %1) {
%3 = alloca i64
%4 = alloca i64
store i64 %0, i64* %3
store i64 %1, i64* %4
%5 = load i64, i64* %4
%6 = and i64 %5, 2
%7 = icmp ne i64 %6, 0
br i1 %7, label %8, label %11
8: ; preds = %2
%9 = load i64, i64* %3
%10 = and i64 %9, 15
store volatile i64 %10, i64* inttoptr (i64 1141035036 to i64*)
br label %11
11: ; preds = %8, %2
ret void
}

LLVM IR (-O2):
define void @PRCMSRAMRetentionEnable(i64 %0, i64 %1) {
%3 = and i64 %1, 2
%4 = icmp eq i64 %3, 0
br i1 %4, label %7, label %5
5: ; preds = %2
%6 = and i64 %0, 15
store volatile i64 %6, i64* inttoptr (i64 1141035036 to i64*)
br label %7
7: ; preds = %5, %2
ret void
}
long long int sumOfDigits(long long int n) {
  long long int val = 0;
  while (n) {
    val += (n % 10);
    n /= 10;
  }
  return val;
}


x86 assembly (clang, -O0):
<sumOfDigits>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movq   $0x0,-0x10(%rbp)
cmpq   $0x0,-0x8(%rbp)
je     1148 <sumOfDigits+0x48>
mov    -0x8(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
add    -0x10(%rbp),%rdx
mov    %rdx,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    $0xa,%ecx
cqto
idiv   %rcx
mov    %rax,-0x8(%rbp)
jmp    1110 <sumOfDigits+0x10>
mov    -0x10(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sumOfDigits>:
test   %rdi,%rdi
je     1156 <sumOfDigits+0x56>
mov    %rdi,%rsi
xor    %ecx,%ecx
movabs $0x6666666666666667,%r8
66 66 66
cs nopw 0x0(%rax,%rax,1)
xchg   %ax,%ax
mov    %rsi,%rax
imul   %r8
mov    %rdx,%rax
shr    $0x3f,%rax
sar    $0x2,%rdx
add    %rax,%rdx
lea    (%rdx,%rdx,1),%rax
lea    (%rax,%rax,4),%rax
mov    %rsi,%rdi
sub    %rax,%rdi
add    %rdi,%rcx
add    $0x9,%rsi
cmp    $0x12,%rsi
mov    %rdx,%rsi
ja     1120 <sumOfDigits+0x20>
mov    %rcx,%rax
ret
xor    %ecx,%ecx
mov    %rcx,%rax
ret

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

LLVM IR (-O2):
define i64 @sumOfDigits(i64 %0) {
%2 = icmp eq i64 %0, 0
br i1 %2, label %11, label %3
3: ; preds = %1, %3
%4 = phi i64 [ %7, %3 ], [ 0, %1 ]
%5 = phi i64 [ %8, %3 ], [ %0, %1 ]
%6 = srem i64 %5, 10
%7 = add nsw i64 %4, %6
%8 = sdiv i64 %5, 10
%9 = add i64 %5, 9
%10 = icmp ult i64 %9, 19
br i1 %10, label %11, label %3
11: ; preds = %3, %1
%12 = phi i64 [ 0, %1 ], [ %7, %3 ]
ret i64 %12
}
/* Type definitions */
struct drm_device {
  int dummy;
};

/* Variables and functions */
int drm_vblank_init(struct drm_device *, int);
int r128_driver_load(struct drm_device *dev, unsigned long flags) {
  return drm_vblank_init(dev, 1);
}


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

x86 assembly (clang, -O2):
<r128_driver_load>:
mov    $0x1,%esi
jmp    1030 <drm_vblank_init@plt>

LLVM IR (-O0):
%struct.drm_device = type { i32 }
define i32 @r128_driver_load(%struct.drm_device* %0, i64 %1) {
%3 = alloca %struct.drm_device*
%4 = alloca i64
store %struct.drm_device* %0, %struct.drm_device** %3
store i64 %1, i64* %4
%5 = load %struct.drm_device*, %struct.drm_device** %3
%6 = call i32 @drm_vblank_init(%struct.drm_device* %5, i32 1)
ret i32 %6
}

LLVM IR (-O2):
%struct.drm_device = type { i32 }
define i32 @r128_driver_load(%struct.drm_device* %0, i64 %1) {
%3 = tail call i32 @drm_vblank_init(%struct.drm_device* %0, i32 1)
ret i32 %3
}
long fifidint(double a) {
  if (a < 1.0)
    return (long)0;
  else
    return (long)a;
}


x86 assembly (clang, -O0):
<fifidint>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x10(%rbp)
movsd  0xeef(%rip),%xmm0
ucomisd -0x10(%rbp),%xmm0
jbe    1129 <fifidint+0x29>
movq   $0x0,-0x8(%rbp)
jmp    1133 <fifidint+0x33>
cvttsd2si -0x10(%rbp),%rax
mov    %rax,-0x8(%rbp)
mov    -0x8(%rbp),%rax
pop    %rbp
ret

x86 assembly (clang, -O2):
<fifidint>:
xor    %eax,%eax
movsd  0xef6(%rip),%xmm1
ucomisd %xmm0,%xmm1
cvttsd2si %xmm0,%rcx
cmovbe %rcx,%rax
ret

LLVM IR (-O0):
define i64 @fifidint(double %0) {
%2 = alloca i64
%3 = alloca double
store double %0, double* %3
%4 = load double, double* %3
%5 = fcmp olt double %4, 1.000000e+00
br i1 %5, label %6, label %7
6: ; preds = %1
store i64 0, i64* %2
br label %10
7: ; preds = %1
%8 = load double, double* %3
%9 = fptosi double %8 to i64
store i64 %9, i64* %2
br label %10
10: ; preds = %7, %6
%11 = load i64, i64* %2
ret i64 %11
}

LLVM IR (-O2):
define i64 @fifidint(double %0) {
%2 = fcmp olt double %0, 1.000000e+00
%3 = fptosi double %0 to i64
%4 = select i1 %2, i64 0, i64 %3
ret i64 %4
}
int get_v(char *array[]) {
  int i;
  i = -1;
  while (array[++i])
    continue;
  return (i);
}


x86 assembly (clang, -O0):
<get_v>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
movl   $0xffffffff,-0xc(%rbp)
mov    -0x8(%rbp),%rax
mov    -0xc(%rbp),%ecx
add    $0x1,%ecx
mov    %ecx,-0xc(%rbp)
movslq %ecx,%rcx
cmpq   $0x0,(%rax,%rcx,8)
je     112f <get_v+0x2f>
jmp    110f <get_v+0xf>
mov    -0xc(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<get_v>:
mov    $0xffffffff,%eax
cs nopw 0x0(%rax,%rax,1)
nop
add    $0x1,%eax
cmpq   $0x0,(%rdi)
lea    0x8(%rdi),%rdi
jne    1110 <get_v+0x10>
ret

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

LLVM IR (-O2):
define i32 @get_v(i8** nocapture %0) {
br label %2
2: ; preds = %2, %1
%3 = phi i64 [ %4, %2 ], [ -1, %1 ]
%4 = add nsw i64 %3, 1
%5 = getelementptr inbounds i8*, i8** %0, i64 %4
%6 = load i8*, i8** %5
%7 = icmp eq i8* %6, null
br i1 %7, label %8, label %2
8: ; preds = %2
%9 = trunc i64 %4 to i32
ret i32 %9
}
/* Type definitions */
typedef int uint32_t;
typedef int int32_t;

/* Variables and functions */
void cast_unsigned_to_signed_Good() {
  char arr[10];
  uint32_t x = 15;
  int32_t y = (int32_t)x;
  if (y < 10) {
    arr[y] = 0;
  }
}


x86 assembly (clang, -O0):
<cast_unsigned_to_signed_Good>:
push   %rbp
mov    %rsp,%rbp
movl   $0xf,-0x10(%rbp)
mov    -0x10(%rbp),%eax
mov    %eax,-0x14(%rbp)
cmpl   $0xa,-0x14(%rbp)
jge    1124 <cast_unsigned_to_signed_Good+0x24>
movslq -0x14(%rbp),%rax
movb   $0x0,-0xa(%rbp,%rax,1)
pop    %rbp
ret

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

LLVM IR (-O0):
define void @cast_unsigned_to_signed_Good() {
%1 = alloca [10 x i8]
%2 = alloca i32
%3 = alloca i32
store i32 15, i32* %2
%4 = load i32, i32* %2
store i32 %4, i32* %3
%5 = load i32, i32* %3
%6 = icmp slt i32 %5, 10
br i1 %6, label %7, label %11
7: ; preds = %0
%8 = load i32, i32* %3
%9 = sext i32 %8 to i64
%10 = getelementptr inbounds [10 x i8], [10 x i8]* %1, i64 0, i64 %9
store i8 0, i8* %10
br label %11
11: ; preds = %7, %0
ret void
}

LLVM IR (-O2):
define void @cast_unsigned_to_signed_Good() {
ret void
}
/* Type definitions */
struct tcb {
  int dummy;
};

/* Variables and functions */
int sys_fstat(struct tcb *);
int sys_fstat64(struct tcb *tcp) { return sys_fstat(tcp); }


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

x86 assembly (clang, -O2):
<sys_fstat64>:
jmp    1030 <sys_fstat@plt>

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

LLVM IR (-O2):
%struct.tcb = type { i32 }
define i32 @sys_fstat64(%struct.tcb* %0) {
%2 = tail call i32 @sys_fstat(%struct.tcb* %0)
ret i32 %2
}
/* Variables and functions */
scalar_t__ floor(double);
double pow(double, int);
int long2tile(double lon, int z) {
  return (int)(floor((lon + 180.0) / 360.0 * pow(2.0, z)));
}


x86 assembly (clang, -O0):
<long2tile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movsd  %xmm0,-0x8(%rbp)
mov    %edi,-0xc(%rbp)
movsd  0xed8(%rip),%xmm0
addsd  -0x8(%rbp),%xmm0
movsd  0xec3(%rip),%xmm1
divsd  %xmm1,%xmm0
movsd  %xmm0,-0x18(%rbp)
mov    -0xc(%rbp),%edi
movsd  0xea7(%rip),%xmm0
call   1030 <pow@plt>
movaps %xmm0,%xmm1
movsd  -0x18(%rbp),%xmm0
mulsd  %xmm1,%xmm0
call   1040 <floor@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<long2tile>:
push   %rax
addsd  0xed7(%rip),%xmm0
divsd  0xed7(%rip),%xmm0
movsd  %xmm0,(%rsp)
movsd  0xed2(%rip),%xmm0
call   1030 <pow@plt>
mulsd  (%rsp),%xmm0
pop    %rax
jmp    1040 <floor@plt>

LLVM IR (-O0):
define i32 @long2tile(double %0, i32 %1) {
%3 = alloca double
%4 = alloca i32
store double %0, double* %3
store i32 %1, i32* %4
%5 = load double, double* %3
%6 = fadd double %5, 1.800000e+02
%7 = fdiv double %6, 3.600000e+02
%8 = load i32, i32* %4
%9 = call double @pow(double 2.000000e+00, i32 %8)
%10 = fmul double %7, %9
%11 = call i64 @floor(double %10)
%12 = trunc i64 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @long2tile(double %0, i32 %1) {
%3 = fadd double %0, 1.800000e+02
%4 = fdiv double %3, 3.600000e+02
%5 = tail call double @pow(double 2.000000e+00, i32 %1)
%6 = fmul double %4, %5
%7 = tail call i64 @floor(double %6)
%8 = trunc i64 %7 to i32
ret i32 %8
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void usage(void) {
  (void)fprintf(stderr, "usage: env [-i] [name=value ...] [command]\n");
  exit(1);
}


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

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

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

LLVM IR (-O2):
@stderr = global i32 0
@.str = [44 x i8] c"usage: env [-i] [name=value ...] [command]\0A\00"
define void @usage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([44 x i8], [44 x i8]* @.str, i64 0, i64 0))
%3 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *);
void sig_pipe(int signo) { printf("SIGPIPE handled...\n"); }


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

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

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

LLVM IR (-O2):
@str = [19 x i8] c"SIGPIPE handled...\00"
define void @sig_pipe(i32 %0) {
%2 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([19 x i8], [19 x i8]* @str, i64 0, i64 0))
ret void
}
/* Variables and functions */
int /*<<< orphan*/ ENOENT;
int /*<<< orphan*/ errno;
int _unlink(char *name __attribute((unused))) {
  errno = ENOENT;
  return -1;
}


x86 assembly (clang, -O0):
<_unlink>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    0x2ec1(%rip),%rax
mov    (%rax),%ecx
mov    0x2ec8(%rip),%rax
mov    %ecx,(%rax)
mov    $0xffffffff,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<_unlink>:
mov    0x2ec9(%rip),%rax
mov    (%rax),%eax
mov    0x2ed0(%rip),%rcx
mov    %eax,(%rcx)
mov    $0xffffffff,%eax
ret

LLVM IR (-O0):
@ENOENT = global i32 0
@errno = global i32 0
define i32 @_unlink(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @ENOENT
store i32 %3, i32* @errno
ret i32 -1
}

LLVM IR (-O2):
@ENOENT = global i32 0
@errno = global i32 0
define i32 @_unlink(i8* nocapture readnone %0) {
%2 = load i32, i32* @ENOENT
store i32 %2, i32* @errno
ret i32 -1
}
/* Variables and functions */
int /*<<< orphan*/ GL_ALPHA_TEST;
int /*<<< orphan*/ glDisable(int /*<<< orphan*/);
int /*<<< orphan*/ glEnable(int /*<<< orphan*/);
void afunc(void) {
  static int state;
  if (state ^= 1)
    glEnable(GL_ALPHA_TEST);
  else
    glDisable(GL_ALPHA_TEST);
}


x86 assembly (clang, -O0):
<afunc>:
push   %rbp
mov    %rsp,%rbp
mov    0x2f0a(%rip),%eax
xor    $0x1,%eax
mov    %eax,0x2f01(%rip)
cmp    $0x0,%eax
je     114f <afunc+0x2f>
mov    0x2ea5(%rip),%rax
mov    (%rax),%edi
call   1030 <glEnable@plt>
jmp    115d <afunc+0x3d>
mov    0x2e92(%rip),%rax
mov    (%rax),%edi
call   1040 <glDisable@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<afunc>:
xorl   $0x1,0x2f0d(%rip)
mov    0x2eba(%rip),%rax
mov    (%rax),%edi
je     1137 <afunc+0x17>
jmp    1030 <glEnable@plt>
jmp    1040 <glDisable@plt>

LLVM IR (-O0):
@afunc.state = internal global i32 0
@GL_ALPHA_TEST = global i32 0
define void @afunc() {
%1 = load i32, i32* @afunc.state
%2 = xor i32 %1, 1
store i32 %2, i32* @afunc.state
%3 = icmp ne i32 %2, 0
br i1 %3, label %4, label %7
4: ; preds = %0
%5 = load i32, i32* @GL_ALPHA_TEST
%6 = call i32 @glEnable(i32 %5)
br label %10
7: ; preds = %0
%8 = load i32, i32* @GL_ALPHA_TEST
%9 = call i32 @glDisable(i32 %8)
br label %10
10: ; preds = %7, %4
ret void
}

LLVM IR (-O2):
@afunc.state = internal unnamed_addr global i32 0
@GL_ALPHA_TEST = global i32 0
define void @afunc() {
%1 = load i32, i32* @afunc.state
%2 = xor i32 %1, 1
store i32 %2, i32* @afunc.state
%3 = icmp eq i32 %2, 0
%4 = load i32, i32* @GL_ALPHA_TEST
br i1 %3, label %7, label %5
5: ; preds = %0
%6 = tail call i32 @glEnable(i32 %4)
br label %9
7: ; preds = %0
%8 = tail call i32 @glDisable(i32 %4)
br label %9
9: ; preds = %7, %5
ret void
}
int vfdRefresh(void) { return 0; }


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

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

LLVM IR (-O0):
define i32 @vfdRefresh() {
ret i32 0
}

LLVM IR (-O2):
define i32 @vfdRefresh() {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ cpc_key_press(int);
int /*<<< orphan*/ cpc_key_unpress(int);
void Joy_Alpha_Down(int value) {
  if (value) {
    cpc_key_press(0x91);
  } else {
    cpc_key_unpress(0x91);
  };
}


x86 assembly (clang, -O0):
<Joy_Alpha_Down>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
cmpl   $0x0,-0x4(%rbp)
je     1144 <Joy_Alpha_Down+0x24>
mov    $0x91,%edi
call   1030 <cpc_key_press@plt>
jmp    114e <Joy_Alpha_Down+0x2e>
mov    $0x91,%edi
call   1040 <cpc_key_unpress@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<Joy_Alpha_Down>:
test   %edi,%edi
je     112e <Joy_Alpha_Down+0xe>
mov    $0x91,%edi
jmp    1030 <cpc_key_press@plt>
mov    $0x91,%edi
jmp    1040 <cpc_key_unpress@plt>

LLVM IR (-O0):
define void @Joy_Alpha_Down(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 %7
5: ; preds = %1
%6 = call i32 @cpc_key_press(i32 145)
br label %9
7: ; preds = %1
%8 = call i32 @cpc_key_unpress(i32 145)
br label %9
9: ; preds = %7, %5
ret void
}

LLVM IR (-O2):
define void @Joy_Alpha_Down(i32 %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @cpc_key_press(i32 145)
br label %7
5: ; preds = %1
%6 = tail call i32 @cpc_key_unpress(i32 145)
br label %7
7: ; preds = %5, %3
ret void
}
int wpas_dbus_register_interface(struct wpa_supplicant *wpa_s) { return 0; }


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

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

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

LLVM IR (-O2):
%struct.wpa_supplicant = type opaque
define i32 @wpas_dbus_register_interface(%struct.wpa_supplicant* nocapture readnone %0) {
ret i32 0
}
int are_equal_long(const void *a, const void *b) {
  return *(long *)a == *(long *)b;
}


x86 assembly (clang, -O0):
<are_equal_long>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    (%rax),%rax
mov    -0x10(%rbp),%rcx
cmp    (%rcx),%rax
sete   %al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<are_equal_long>:
mov    (%rdi),%rcx
xor    %eax,%eax
cmp    (%rsi),%rcx
sete   %al
ret

LLVM IR (-O0):
define i32 @are_equal_long(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 i64*
%7 = load i64, i64* %6
%8 = load i8*, i8** %4
%9 = bitcast i8* %8 to i64*
%10 = load i64, i64* %9
%11 = icmp eq i64 %7, %10
%12 = zext i1 %11 to i32
ret i32 %12
}

LLVM IR (-O2):
define i32 @are_equal_long(i8* nocapture %0, i8* nocapture %1) {
%3 = bitcast i8* %0 to i64*
%4 = load i64, i64* %3
%5 = bitcast i8* %1 to i64*
%6 = load i64, i64* %5
%7 = icmp eq i64 %4, %6
%8 = zext i1 %7 to i32
ret i32 %8
}
/* Variables and functions */
int parse_action(char *, int);
int parse_action_true(char *s) { return parse_action(s, 1); }


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

x86 assembly (clang, -O2):
<parse_action_true>:
mov    $0x1,%esi
jmp    1030 <parse_action@plt>

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

LLVM IR (-O2):
define i32 @parse_action_true(i8* %0) {
%2 = tail call i32 @parse_action(i8* %0, i32 1)
ret i32 %2
}
void sk_new_null(void) {}


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

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

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

LLVM IR (-O2):
define void @sk_new_null() {
ret void
}
/* Type definitions */
struct rtattr {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ RTA_DATA(struct rtattr *);
int /*<<< orphan*/ RTA_PAYLOAD(struct rtattr *);
int /*<<< orphan*/ parse_rtattr(struct rtattr **, int, int /*<<< orphan*/,
                                int /*<<< orphan*/);
void parse_nested_rtattr(struct rtattr *tb[], int max, struct rtattr *rta) {
  parse_rtattr(tb, max, RTA_DATA(rta), RTA_PAYLOAD(rta));
}


x86 assembly (clang, -O0):
<parse_nested_rtattr>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    %rdx,-0x18(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x28(%rbp)
mov    -0xc(%rbp),%eax
mov    %eax,-0x20(%rbp)
mov    -0x18(%rbp),%rdi
call   1040 <RTA_DATA@plt>
mov    %eax,-0x1c(%rbp)
mov    -0x18(%rbp),%rdi
call   1030 <RTA_PAYLOAD@plt>
mov    -0x28(%rbp),%rdi
mov    -0x20(%rbp),%esi
mov    -0x1c(%rbp),%edx
mov    %eax,%ecx
call   1050 <parse_rtattr@plt>
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<parse_nested_rtattr>:
push   %rbp
push   %r15
push   %r14
push   %rbx
push   %rax
mov    %rdx,%rbx
mov    %esi,%r14d
mov    %rdi,%r15
mov    %rdx,%rdi
call   1040 <RTA_DATA@plt>
mov    %eax,%ebp
mov    %rbx,%rdi
call   1030 <RTA_PAYLOAD@plt>
mov    %r15,%rdi
mov    %r14d,%esi
mov    %ebp,%edx
mov    %eax,%ecx
add    $0x8,%rsp
pop    %rbx
pop    %r14
pop    %r15
pop    %rbp
jmp    1050 <parse_rtattr@plt>

LLVM IR (-O0):
%struct.rtattr = type { i32 }
define void @parse_nested_rtattr(%struct.rtattr** %0, i32 %1, %struct.rtattr* %2) {
%4 = alloca %struct.rtattr**
%5 = alloca i32
%6 = alloca %struct.rtattr*
store %struct.rtattr** %0, %struct.rtattr*** %4
store i32 %1, i32* %5
store %struct.rtattr* %2, %struct.rtattr** %6
%7 = load %struct.rtattr**, %struct.rtattr*** %4
%8 = load i32, i32* %5
%9 = load %struct.rtattr*, %struct.rtattr** %6
%10 = call i32 @RTA_DATA(%struct.rtattr* %9)
%11 = load %struct.rtattr*, %struct.rtattr** %6
%12 = call i32 @RTA_PAYLOAD(%struct.rtattr* %11)
%13 = call i32 @parse_rtattr(%struct.rtattr** %7, i32 %8, i32 %10, i32 %12)
ret void
}

LLVM IR (-O2):
%struct.rtattr = type { i32 }
define void @parse_nested_rtattr(%struct.rtattr** %0, i32 %1, %struct.rtattr* %2) {
%4 = tail call i32 @RTA_DATA(%struct.rtattr* %2)
%5 = tail call i32 @RTA_PAYLOAD(%struct.rtattr* %2)
%6 = tail call i32 @parse_rtattr(%struct.rtattr** %0, i32 %1, i32 %4, i32 %5)
ret void
}
int sign(n)
int n;
{
  if (n < 0)
    return -1;
  else if (n > 0)
    return 1;
  else
    return 0;
}


x86 assembly (clang, -O0):
<sign>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
jge    111d <sign+0x1d>
movl   $0xffffffff,-0x4(%rbp)
jmp    113a <sign+0x3a>
cmpl   $0x0,-0x8(%rbp)
jle    1133 <sign+0x33>
movl   $0x1,-0x4(%rbp)
jmp    113a <sign+0x3a>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<sign>:
xor    %ecx,%ecx
test   %edi,%edi
setne  %cl
mov    $0xffffffff,%eax
cmovns %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @sign(i32 %0) {
%2 = icmp ne i32 %0, 0
%3 = zext i1 %2 to i32
%4 = icmp sgt i32 %0, -1
%5 = select i1 %4, i32 %3, i32 -1
ret i32 %5
}
/* Variables and functions */
int /*<<< orphan*/ log(int /*<<< orphan*/);
int /*<<< orphan*/ wPopNumber();
int /*<<< orphan*/ wPushNumber(int /*<<< orphan*/);
void wBasLog() { wPushNumber(log(wPopNumber())); }


x86 assembly (clang, -O0):
<wBasLog>:
push   %rbp
mov    %rsp,%rbp
mov    $0x0,%al
call   1040 <wPopNumber@plt>
mov    %eax,%edi
call   1050 <log@plt>
mov    %eax,%edi
call   1030 <wPushNumber@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<wBasLog>:
push   %rax
xor    %eax,%eax
call   1040 <wPopNumber@plt>
mov    %eax,%edi
call   1050 <log@plt>
mov    %eax,%edi
pop    %rax
jmp    1030 <wPushNumber@plt>

LLVM IR (-O0):
define void @wBasLog() {
%1 = call i32 (...) @wPopNumber()
%2 = call i32 @log(i32 %1)
%3 = call i32 @wPushNumber(i32 %2)
ret void
}

LLVM IR (-O2):
define void @wBasLog() {
%1 = tail call i32 (...) @wPopNumber()
%2 = tail call i32 @log(i32 %1)
%3 = tail call i32 @wPushNumber(i32 %2)
ret void
}
int do_424() { return 424; }


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

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

LLVM IR (-O0):
define i32 @do_424() {
ret i32 424
}

LLVM IR (-O2):
define i32 @do_424() {
ret i32 424
}
float devide(float first, float second) { return first / second; }


x86 assembly (clang, -O0):
<devide>:
push   %rbp
mov    %rsp,%rbp
movss  %xmm0,-0x4(%rbp)
movss  %xmm1,-0x8(%rbp)
movss  -0x4(%rbp),%xmm0
divss  -0x8(%rbp),%xmm0
pop    %rbp
ret

x86 assembly (clang, -O2):
<devide>:
divss  %xmm1,%xmm0
ret

LLVM IR (-O0):
define float @devide(float %0, float %1) {
%3 = alloca float
%4 = alloca float
store float %0, float* %3
store float %1, float* %4
%5 = load float, float* %3
%6 = load float, float* %4
%7 = fdiv float %5, %6
ret float %7
}

LLVM IR (-O2):
define float @devide(float %0, float %1) {
%3 = fdiv float %0, %1
ret float %3
}
/* Variables and functions */
int func1(int, int);
int func2(int, int);
int /*<<< orphan*/ printf(char *, int);
int main(int argc, char *argv[]) {
  printf("func1(2, 3) = %d\n", func1(2, 3));
  printf("func2(2, 3) = %d\n", func2(2, 3));
  return 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)
mov    $0x2,%edi
mov    $0x3,%esi
call   1030 <func1@plt>
mov    %eax,%esi
lea    0xea2(%rip),%rdi
call   1040 <printf@plt>
mov    $0x2,%edi
mov    $0x3,%esi
call   1050 <func2@plt>
mov    %eax,%esi
lea    0xe97(%rip),%rdi
call   1040 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
mov    $0x2,%edi
mov    $0x3,%esi
call   1030 <func1@plt>
lea    0xeb9(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
mov    $0x2,%edi
mov    $0x3,%esi
call   1050 <func2@plt>
lea    0xeae(%rip),%rdi
mov    %eax,%esi
call   1040 <printf@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
@.str = [18 x i8] c"func1(2, 3) = %d\0A\00"
@.str.1 = [18 x i8] c"func2(2, 3) = %d\0A\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 @func1(i32 2, i32 3)
%7 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %6)
%8 = call i32 @func2(i32 2, i32 3)
%9 = call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %8)
ret i32 0
}

LLVM IR (-O2):
@.str = [18 x i8] c"func1(2, 3) = %d\0A\00"
@.str.1 = [18 x i8] c"func2(2, 3) = %d\0A\00"
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @func1(i32 2, i32 3)
%4 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str, i64 0, i64 0), i32 %3)
%5 = tail call i32 @func2(i32 2, i32 3)
%6 = tail call i32 @printf(i8* getelementptr inbounds ([18 x i8], [18 x i8]* @.str.1, i64 0, i64 0), i32 %5)
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ uint16_t;
struct ns_connection {
  int dummy;
};

/* Variables and functions */
int /*<<< orphan*/ ns_send_mqtt_short_command(struct ns_connection *, int,
                                              int /*<<< orphan*/);
void ns_mqtt_puback(struct ns_connection *nc, uint16_t message_id) {
  ns_send_mqtt_short_command(nc, 4, message_id);
}


x86 assembly (clang, -O0):
<ns_mqtt_puback>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    %esi,-0xc(%rbp)
mov    -0x8(%rbp),%rdi
mov    -0xc(%rbp),%edx
mov    $0x4,%esi
call   1030 <ns_send_mqtt_short_command@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<ns_mqtt_puback>:
mov    %esi,%edx
mov    $0x4,%esi
jmp    1030 <ns_send_mqtt_short_command@plt>

LLVM IR (-O0):
%struct.ns_connection = type { i32 }
define void @ns_mqtt_puback(%struct.ns_connection* %0, i32 %1) {
%3 = alloca %struct.ns_connection*
%4 = alloca i32
store %struct.ns_connection* %0, %struct.ns_connection** %3
store i32 %1, i32* %4
%5 = load %struct.ns_connection*, %struct.ns_connection** %3
%6 = load i32, i32* %4
%7 = call i32 @ns_send_mqtt_short_command(%struct.ns_connection* %5, i32 4, i32 %6)
ret void
}

LLVM IR (-O2):
%struct.ns_connection = type { i32 }
define void @ns_mqtt_puback(%struct.ns_connection* %0, i32 %1) {
%3 = tail call i32 @ns_send_mqtt_short_command(%struct.ns_connection* %0, i32 4, i32 %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ free(char *);
char *malloc(size_t);
int /*<<< orphan*/ strcpy(char *, char *);
size_t strlen(char *);
char *safe_dir_name(char *dirname) {
  size_t dn_len = strlen(dirname);
  char *dirname_safe = malloc(dn_len + 2);
  strcpy(dirname_safe, dirname);
  dirname_safe[dn_len] = *"/";
  dirname_safe[dn_len + 1] = *"\0";
  return dirname_safe;
  free(dirname_safe);
}


x86 assembly (clang, -O0):
<safe_dir_name>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
call   1040 <strlen@plt>
mov    %rax,-0x10(%rbp)
mov    -0x10(%rbp),%rdi
add    $0x2,%rdi
call   1050 <malloc@plt>
mov    %rax,-0x18(%rbp)
mov    -0x18(%rbp),%rdi
mov    -0x8(%rbp),%rsi
call   1030 <strcpy@plt>
mov    0xe93(%rip),%dl
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %dl,(%rax,%rcx,1)
mov    0xe84(%rip),%dl
mov    -0x18(%rbp),%rax
mov    -0x10(%rbp),%rcx
mov    %dl,0x1(%rax,%rcx,1)
mov    -0x18(%rbp),%rax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<safe_dir_name>:
push   %r15
push   %r14
push   %rbx
mov    %rdi,%r14
call   1040 <strlen@plt>
mov    %rax,%r15
lea    0x2(%rax),%rdi
call   1050 <malloc@plt>
mov    %rax,%rbx
mov    %rax,%rdi
mov    %r14,%rsi
call   1030 <strcpy@plt>
movw   $0x2f,(%rbx,%r15,1)
mov    %rbx,%rax
pop    %rbx
pop    %r14
pop    %r15
ret

LLVM IR (-O0):
@.str = [2 x i8] c"/\00"
@.str.1 = [2 x i8] zeroinitializer
define i8* @safe_dir_name(i8* %0) {
%2 = alloca i8*
%3 = alloca i64
%4 = alloca i8*
store i8* %0, i8** %2
%5 = load i8*, i8** %2
%6 = call i64 @strlen(i8* %5)
store i64 %6, i64* %3
%7 = load i64, i64* %3
%8 = add i64 %7, 2
%9 = call i8* @malloc(i64 %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* getelementptr inbounds ([2 x i8], [2 x i8]* @.str, i64 0, i64 0)
%14 = load i8*, i8** %4
%15 = load i64, i64* %3
%16 = getelementptr inbounds i8, i8* %14, i64 %15
store i8 %13, i8* %16
%17 = load i8, i8* getelementptr inbounds ([2 x i8], [2 x i8]* @.str.1, i64 0, i64 0)
%18 = load i8*, i8** %4
%19 = load i64, i64* %3
%20 = add i64 %19, 1
%21 = getelementptr inbounds i8, i8* %18, i64 %20
store i8 %17, i8* %21
%22 = load i8*, i8** %4
ret i8* %22
}

LLVM IR (-O2):
define i8* @safe_dir_name(i8* %0) {
%2 = tail call i64 @strlen(i8* dereferenceable(1) %0)
%3 = add i64 %2, 2
%4 = tail call i8* @malloc(i64 %3)
%5 = tail call i32 @strcpy(i8* %4, i8* %0)
%6 = getelementptr inbounds i8, i8* %4, i64 %2
store i8 47, i8* %6
%7 = add i64 %2, 1
%8 = getelementptr inbounds i8, i8* %4, i64 %7
store i8 0, i8* %8
ret i8* %4
}
unsigned int zero_nth_position(unsigned int num, int position) {
  return (num & (~(7 << position)));
}


x86 assembly (clang, -O0):
<zero_nth_position>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    -0x4(%rbp),%eax
mov    -0x8(%rbp),%ecx
mov    $0x7,%edx
shl    %cl,%edx
mov    %edx,%ecx
xor    $0xffffffff,%ecx
and    %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<zero_nth_position>:
mov    %esi,%ecx
mov    $0x7,%eax
shl    %cl,%eax
not    %eax
and    %edi,%eax
ret

LLVM IR (-O0):
define i32 @zero_nth_position(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 = shl i32 7, %6
%8 = xor i32 %7, -1
%9 = and i32 %5, %8
ret i32 %9
}

LLVM IR (-O2):
define i32 @zero_nth_position(i32 %0, i32 %1) {
%3 = shl i32 7, %1
%4 = xor i32 %3, -1
%5 = and i32 %4, %0
ret i32 %5
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int fprintf(int /*<<< orphan*/ *, char *, char *);
int WriteLine(FILE *f, char *s) { return fprintf(f, "%s\n", s); }


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

x86 assembly (clang, -O2):
<WriteLine>:
mov    %rsi,%rdx
lea    0xee6(%rip),%rsi
jmp    1030 <fprintf@plt>

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

LLVM IR (-O2):
@.str = [4 x i8] c"%s\0A\00"
define i32 @WriteLine(i32* nocapture %0, i8* %1) {
%3 = tail call i32 @fprintf(i32* %0, i8* getelementptr inbounds ([4 x i8], [4 x i8]* @.str, i64 0, i64 0), i8* %1)
ret i32 %3
}
void cvmx_debug_strcpy(char *dest, const char *src) {
  while (*src) {
    *dest = *src;
    src++;
    dest++;
  }
  *dest = 0;
}


x86 assembly (clang, -O0):
<cvmx_debug_strcpy>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpb   $0x0,(%rax)
je     1142 <cvmx_debug_strcpy+0x42>
mov    -0x10(%rbp),%rax
mov    (%rax),%cl
mov    -0x8(%rbp),%rax
mov    %cl,(%rax)
mov    -0x10(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x10(%rbp)
mov    -0x8(%rbp),%rax
add    $0x1,%rax
mov    %rax,-0x8(%rbp)
jmp    110c <cvmx_debug_strcpy+0xc>
mov    -0x8(%rbp),%rax
movb   $0x0,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<cvmx_debug_strcpy>:
mov    (%rsi),%al
test   %al,%al
je     1121 <cvmx_debug_strcpy+0x21>
add    $0x1,%rsi
nopw   0x0(%rax,%rax,1)
mov    %al,(%rdi)
add    $0x1,%rdi
movzbl (%rsi),%eax
add    $0x1,%rsi
test   %al,%al
jne    1110 <cvmx_debug_strcpy+0x10>
movb   $0x0,(%rdi)
ret

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

LLVM IR (-O2):
define void @cvmx_debug_strcpy(i8* nocapture writeonly %0, i8* nocapture %1) {
%3 = load i8, i8* %1
%4 = icmp eq i8 %3, 0
br i1 %4, label %13, label %5
5: ; preds = %2, %5
%6 = phi i8 [ %11, %5 ], [ %3, %2 ]
%7 = phi i8* [ %9, %5 ], [ %1, %2 ]
%8 = phi i8* [ %10, %5 ], [ %0, %2 ]
store i8 %6, i8* %8
%9 = getelementptr inbounds i8, i8* %7, i64 1
%10 = getelementptr inbounds i8, i8* %8, i64 1
%11 = load i8, i8* %9
%12 = icmp eq i8 %11, 0
br i1 %12, label %13, label %5
13: ; preds = %5, %2
%14 = phi i8* [ %0, %2 ], [ %10, %5 ]
store i8 0, i8* %14
ret void
}
void sys_GetFileAttributes() { ; }


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

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

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

LLVM IR (-O2):
define void @sys_GetFileAttributes() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ messErr(int);
void dev_write(int did, int sid, int cid, long d) { messErr(17); }


x86 assembly (clang, -O0):
<dev_write>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    %rcx,-0x18(%rbp)
mov    $0x11,%edi
call   1030 <messErr@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<dev_write>:
mov    $0x11,%edi
jmp    1030 <messErr@plt>

LLVM IR (-O0):
define void @dev_write(i32 %0, i32 %1, i32 %2, i64 %3) {
%5 = alloca i32
%6 = alloca i32
%7 = alloca i32
%8 = alloca i64
store i32 %0, i32* %5
store i32 %1, i32* %6
store i32 %2, i32* %7
store i64 %3, i64* %8
%9 = call i32 @messErr(i32 17)
ret void
}

LLVM IR (-O2):
define void @dev_write(i32 %0, i32 %1, i32 %2, i64 %3) {
%5 = tail call i32 @messErr(i32 17)
ret void
}
/* Type definitions */
typedef int /*<<< orphan*/ time_t;
struct timespec {
  int /*<<< orphan*/ tv_sec;
};

/* Variables and functions */
int /*<<< orphan*/ CLOCK_REALTIME;
int /*<<< orphan*/ assert(int);
int clock_gettime(int /*<<< orphan*/, struct timespec *);
time_t real_seconds(void) {
  struct timespec t;
  int s = clock_gettime(CLOCK_REALTIME, &t);
  assert(s == 0);
  return t.tv_sec;
}


x86 assembly (clang, -O0):
<real_seconds>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    0x2eb1(%rip),%rax
mov    (%rax),%edi
lea    -0x8(%rbp),%rsi
call   1030 <clock_gettime@plt>
mov    %eax,-0xc(%rbp)
cmpl   $0x0,-0xc(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
mov    -0x8(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<real_seconds>:
push   %rax
mov    0x2eb8(%rip),%rax
mov    (%rax),%edi
mov    %rsp,%rsi
call   1030 <clock_gettime@plt>
xor    %edi,%edi
test   %eax,%eax
sete   %dil
call   1040 <assert@plt>
mov    (%rsp),%eax
pop    %rcx
ret

LLVM IR (-O0):
%struct.timespec = type { i32 }
@CLOCK_REALTIME = global i32 0
define i32 @real_seconds() {
%1 = alloca %struct.timespec
%2 = alloca i32
%3 = load i32, i32* @CLOCK_REALTIME
%4 = call i32 @clock_gettime(i32 %3, %struct.timespec* %1)
store i32 %4, i32* %2
%5 = load i32, i32* %2
%6 = icmp eq i32 %5, 0
%7 = zext i1 %6 to i32
%8 = call i32 @assert(i32 %7)
%9 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i32 0, i32 0
%10 = load i32, i32* %9
ret i32 %10
}

LLVM IR (-O2):
%struct.timespec = type { i32 }
@CLOCK_REALTIME = global i32 0
define i32 @real_seconds() {
%1 = alloca %struct.timespec
%2 = bitcast %struct.timespec* %1 to i8*
%3 = load i32, i32* @CLOCK_REALTIME
%4 = call i32 @clock_gettime(i32 %3, %struct.timespec* %1)
%5 = icmp eq i32 %4, 0
%6 = zext i1 %5 to i32
%7 = call i32 @assert(i32 %6)
%8 = getelementptr inbounds %struct.timespec, %struct.timespec* %1, i64 0, i32 0
%9 = load i32, i32* %8
ret i32 %9
}
/* Variables and functions */
int /*<<< orphan*/ min(int *, int *, int **);
int /*<<< orphan*/ printf(char *, ...);
int /*<<< orphan*/ scanf(char *, int *, int *);
int main(void) {
  int a, b;
  int *w;
  printf("Podaj a i b: ");
  scanf("%d %d", &a, &b);
  min(&a, &b, &w);
  printf("Mniejsza jest liczba %d\n", *w);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
lea    0xeba(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
lea    0xeba(%rip),%rdi
lea    -0x8(%rbp),%rsi
lea    -0xc(%rbp),%rdx
call   1050 <scanf@plt>
lea    -0x8(%rbp),%rdi
lea    -0xc(%rbp),%rsi
lea    -0x18(%rbp),%rdx
call   1040 <min@plt>
mov    -0x18(%rbp),%rax
mov    (%rax),%esi
lea    0xe95(%rip),%rdi
mov    $0x0,%al
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %r14
push   %rbx
sub    $0x18,%rsp
lea    0xec2(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
lea    0xec2(%rip),%rdi
lea    0x14(%rsp),%rbx
lea    0x10(%rsp),%r14
mov    %rbx,%rsi
mov    %r14,%rdx
call   1050 <scanf@plt>
lea    0x8(%rsp),%rdx
mov    %rbx,%rdi
mov    %r14,%rsi
call   1040 <min@plt>
mov    0x8(%rsp),%rax
mov    (%rax),%esi
lea    0xe95(%rip),%rdi
xor    %eax,%eax
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x18,%rsp
pop    %rbx
pop    %r14
ret

LLVM IR (-O0):
@.str = [14 x i8] c"Podaj a i b: \00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [25 x i8] c"Mniejsza jest liczba %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32
%4 = alloca i32*
store i32 0, i32* %1
%5 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %2, i32* %3)
%7 = call i32 @min(i32* %2, i32* %3, i32** %4)
%8 = load i32*, i32** %4
%9 = load i32, i32* %8
%10 = call i32 (i8*, ...) @printf(i8* getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %9)
ret i32 0
}

LLVM IR (-O2):
@.str = [14 x i8] c"Podaj a i b: \00"
@.str.1 = [6 x i8] c"%d %d\00"
@.str.2 = [25 x i8] c"Mniejsza jest liczba %d\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca i32
%3 = alloca i32*
%4 = bitcast i32* %1 to i8*
%5 = bitcast i32* %2 to i8*
%6 = bitcast i32** %3 to i8*
%7 = tail call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([14 x i8], [14 x i8]* @.str, i64 0, i64 0))
%8 = call i32 @scanf(i8* getelementptr inbounds ([6 x i8], [6 x i8]* @.str.1, i64 0, i64 0), i32* %1, i32* %2)
%9 = call i32 @min(i32* %1, i32* %2, i32** %3)
%10 = load i32*, i32** %3
%11 = load i32, i32* %10
%12 = call i32 (i8*, ...) @printf(i8* dereferenceable(1) getelementptr inbounds ([25 x i8], [25 x i8]* @.str.2, i64 0, i64 0), i32 %11)
ret i32 0
}
/* Variables and functions */
void *malloc(size_t);
void *DefMalloc(size_t size, void *pUser) {
  (void)pUser;
  return malloc(size);
}


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

x86 assembly (clang, -O2):
<DefMalloc>:
jmp    1030 <malloc@plt>

LLVM IR (-O0):
define i8* @DefMalloc(i64 %0, i8* %1) {
%3 = alloca i64
%4 = alloca i8*
store i64 %0, i64* %3
store i8* %1, i8** %4
%5 = load i8*, i8** %4
%6 = load i64, i64* %3
%7 = call i8* @malloc(i64 %6)
ret i8* %7
}

LLVM IR (-O2):
define noalias i8* @DefMalloc(i64 %0, i8* nocapture readnone %1) {
%3 = tail call i8* @malloc(i64 %0)
ret i8* %3
}
/* Variables and functions */
int /*<<< orphan*/ foo(int);
int /*<<< orphan*/ set_eax(int /*<<< orphan*/);
int bar(int x) {
  if (x) {
    set_eax(0);
    return x;
  }
  foo(x);
}


x86 assembly (clang, -O0):
<bar>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     1147 <bar+0x27>
xor    %edi,%edi
call   1030 <set_eax@plt>
mov    -0x8(%rbp),%eax
mov    %eax,-0x4(%rbp)
jmp    114f <bar+0x2f>
mov    -0x8(%rbp),%edi
call   1040 <foo@plt>
mov    -0x4(%rbp),%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bar>:
push   %rbx
mov    %edi,%ebx
test   %edi,%edi
je     1130 <bar+0x10>
xor    %edi,%edi
call   1030 <set_eax@plt>
jmp    1137 <bar+0x17>
xor    %edi,%edi
call   1040 <foo@plt>
mov    %ebx,%eax
pop    %rbx
ret

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

LLVM IR (-O2):
define i32 @bar(i32 returned %0) {
%2 = icmp eq i32 %0, 0
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = tail call i32 @set_eax(i32 0)
br label %7
5: ; preds = %1
%6 = tail call i32 @foo(i32 0)
br label %7
7: ; preds = %5, %3
ret i32 %0
}
/* Variables and functions */
int /*<<< orphan*/ gen_arithm_shift_right();
int /*<<< orphan*/ gen_immediate();
int /*<<< orphan*/ gen_push(int);
int /*<<< orphan*/ newline();
int /*<<< orphan*/ output_number(int);
void gen_divide_by_two(void) {
  gen_push(1 << 1);
  gen_immediate();
  output_number(1);
  newline();
  gen_arithm_shift_right();
}


x86 assembly (clang, -O0):
<gen_divide_by_two>:
push   %rbp
mov    %rsp,%rbp
mov    $0x2,%edi
call   1050 <gen_push@plt>
mov    $0x0,%al
call   1070 <gen_immediate@plt>
mov    $0x1,%edi
call   1060 <output_number@plt>
mov    $0x0,%al
call   1030 <newline@plt>
mov    $0x0,%al
call   1040 <gen_arithm_shift_right@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<gen_divide_by_two>:
push   %rax
mov    $0x2,%edi
call   1050 <gen_push@plt>
xor    %eax,%eax
call   1070 <gen_immediate@plt>
mov    $0x1,%edi
call   1060 <output_number@plt>
xor    %eax,%eax
call   1030 <newline@plt>
xor    %eax,%eax
pop    %rcx
jmp    1040 <gen_arithm_shift_right@plt>

LLVM IR (-O0):
define void @gen_divide_by_two() {
%1 = call i32 @gen_push(i32 2)
%2 = call i32 (...) @gen_immediate()
%3 = call i32 @output_number(i32 1)
%4 = call i32 (...) @newline()
%5 = call i32 (...) @gen_arithm_shift_right()
ret void
}

LLVM IR (-O2):
define void @gen_divide_by_two() {
%1 = tail call i32 @gen_push(i32 2)
%2 = tail call i32 (...) @gen_immediate()
%3 = tail call i32 @output_number(i32 1)
%4 = tail call i32 (...) @newline()
%5 = tail call i32 (...) @gen_arithm_shift_right()
ret void
}
short int shortint_ignoring_unsignedshortint(short int x,
                                             unsigned short int y) {
  return x;
}


x86 assembly (clang, -O0):
<shortint_ignoring_unsignedshortint>:
push   %rbp
mov    %rsp,%rbp
mov    %si,%ax
mov    %di,%cx
mov    %cx,-0x2(%rbp)
mov    %ax,-0x4(%rbp)
movswl -0x2(%rbp),%eax
pop    %rbp
ret

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

LLVM IR (-O0):
define signext i16 @shortint_ignoring_unsignedshortint(i16 signext %0, i16 zeroext %1) {
%3 = alloca i16
%4 = alloca i16
store i16 %0, i16* %3
store i16 %1, i16* %4
%5 = load i16, i16* %3
ret i16 %5
}

LLVM IR (-O2):
define signext i16 @shortint_ignoring_unsignedshortint(i16 returned signext %0, i16 zeroext %1) {
ret i16 %0
}