xunge/DecIR huggingface dataset:
/* Type definitions */
struct timezone {
  int dummy;
};
struct timeval {
  int tv_sec;
  int tv_usec;
};

/* Variables and functions */
int /*<<< orphan*/ gettimeofday(struct timeval *, struct timezone *);
unsigned int GetTimerMS() {
  struct timeval tv;
  struct timezone tz;
  gettimeofday(&tv, &tz);
  return (tv.tv_sec * 1000 + tv.tv_usec / 1000);
}


x86 assembly (clang, -O0):
<GetTimerMS>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
lea    -0x8(%rbp),%rdi
lea    -0x10(%rbp),%rsi
call   1030 <gettimeofday@plt>
imul   $0x3e8,-0x8(%rbp),%eax
mov    %eax,-0x14(%rbp)
mov    -0x4(%rbp),%eax
mov    $0x3e8,%ecx
cltd
idiv   %ecx
mov    %eax,%ecx
mov    -0x14(%rbp),%eax
add    %ecx,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<GetTimerMS>:
sub    $0x18,%rsp
lea    0x8(%rsp),%rdi
lea    0x10(%rsp),%rsi
call   1030 <gettimeofday@plt>
imul   $0x3e8,0x8(%rsp),%ecx
movslq 0xc(%rsp),%rax
imul   $0x10624dd3,%rax,%rax
mov    %rax,%rdx
shr    $0x3f,%rdx
sar    $0x26,%rax
add    %edx,%eax
add    %ecx,%eax
add    $0x18,%rsp
ret

LLVM IR (-O0):
%struct.timeval = type { i32, i32 }
%struct.timezone = type { i32 }
define i32 @GetTimerMS() {
%1 = alloca %struct.timeval
%2 = alloca %struct.timezone
%3 = call i32 @gettimeofday(%struct.timeval* %1, %struct.timezone* %2)
%4 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 0
%5 = load i32, i32* %4
%6 = mul nsw i32 %5, 1000
%7 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i32 0, i32 1
%8 = load i32, i32* %7
%9 = sdiv i32 %8, 1000
%10 = add nsw i32 %6, %9
ret i32 %10
}

LLVM IR (-O2):
%struct.timeval = type { i32, i32 }
%struct.timezone = type { i32 }
define i32 @GetTimerMS() {
%1 = alloca %struct.timeval
%2 = alloca %struct.timezone
%3 = bitcast %struct.timeval* %1 to i8*
%4 = bitcast %struct.timezone* %2 to i8*
%5 = call i32 @gettimeofday(%struct.timeval* %1, %struct.timezone* %2)
%6 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 0
%7 = load i32, i32* %6
%8 = mul nsw i32 %7, 1000
%9 = getelementptr inbounds %struct.timeval, %struct.timeval* %1, i64 0, i32 1
%10 = load i32, i32* %9
%11 = sdiv i32 %10, 1000
%12 = add nsw i32 %11, %8
ret i32 %12
}
void ptrace_sandbox_permit_read(struct pt_sandbox *p_sandbox) {
  (void)p_sandbox;
}


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

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

LLVM IR (-O0):
%struct.pt_sandbox = type opaque
define void @ptrace_sandbox_permit_read(%struct.pt_sandbox* %0) {
%2 = alloca %struct.pt_sandbox*
store %struct.pt_sandbox* %0, %struct.pt_sandbox** %2
%3 = load %struct.pt_sandbox*, %struct.pt_sandbox** %2
ret void
}

LLVM IR (-O2):
%struct.pt_sandbox = type opaque
define void @ptrace_sandbox_permit_read(%struct.pt_sandbox* nocapture %0) {
ret void
}
void amaret_local_A1_targetInit__I() {}


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

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

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

LLVM IR (-O2):
define void @amaret_local_A1_targetInit__I() {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ backup_region(char *, int, int);
void backup_task() {
  backup_region("ML/LOGS/ROM1.BIN", 0xF8000000, 0x01000000);
  backup_region("ML/LOGS/ROM0.BIN", 0xF0000000, 0x01000000);
}


x86 assembly (clang, -O0):
<backup_task>:
push   %rbp
mov    %rsp,%rbp
lea    0xee5(%rip),%rdi
mov    $0xf8000000,%esi
mov    $0x1000000,%edx
call   1030 <backup_region@plt>
lea    0xee0(%rip),%rdi
mov    $0xf0000000,%esi
mov    $0x1000000,%edx
call   1030 <backup_region@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<backup_task>:
push   %rax
lea    0xee8(%rip),%rdi
mov    $0xf8000000,%esi
mov    $0x1000000,%edx
call   1030 <backup_region@plt>
lea    0xee3(%rip),%rdi
mov    $0xf0000000,%esi
mov    $0x1000000,%edx
pop    %rax
jmp    1030 <backup_region@plt>

LLVM IR (-O0):
@.str = [17 x i8] c"ML/LOGS/ROM1.BIN\00"
@.str.1 = [17 x i8] c"ML/LOGS/ROM0.BIN\00"
define void @backup_task() {
%1 = call i32 @backup_region(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 -134217728, i32 16777216)
%2 = call i32 @backup_region(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 -268435456, i32 16777216)
ret void
}

LLVM IR (-O2):
@.str = [17 x i8] c"ML/LOGS/ROM1.BIN\00"
@.str.1 = [17 x i8] c"ML/LOGS/ROM0.BIN\00"
define void @backup_task() {
%1 = tail call i32 @backup_region(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str, i64 0, i64 0), i32 -134217728, i32 16777216)
%2 = tail call i32 @backup_region(i8* getelementptr inbounds ([17 x i8], [17 x i8]* @.str.1, i64 0, i64 0), i32 -268435456, i32 16777216)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ chdir(char *);
int main(void) {
  chdir("..");
  return 0;
}


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

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

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

LLVM IR (-O2):
@.str = [3 x i8] c"..\00"
define i32 @main() {
%1 = tail call i32 @chdir(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
int gettimeofday(struct timeval *tv, struct timezone *tz) {
  int r;
  __asm__ __volatile__("\tint $0x80\n"
                       : "=a"(r)
                       : "a"(78), "b"(tv), "c"(tz)
                       : "memory");
  return r;
}


x86 assembly (clang, -O0):
<gettimeofday>:
push   %rbp
mov    %rsp,%rbp
push   %rbx
mov    %rdi,-0x10(%rbp)
mov    %rsi,-0x18(%rbp)
mov    -0x10(%rbp),%rbx
mov    -0x18(%rbp),%rcx
mov    $0x4e,%eax
int    $0x80
mov    %eax,-0x1c(%rbp)
mov    -0x1c(%rbp),%eax
pop    %rbx
pop    %rbp
ret

x86 assembly (clang, -O2):
<gettimeofday>:
push   %rbx
mov    %rsi,%rcx
mov    %rdi,%rbx
mov    $0x4e,%eax
int    $0x80
pop    %rbx
ret

LLVM IR (-O0):
%struct.timeval = type opaque
%struct.timezone = type opaque
define i32 @gettimeofday(%struct.timeval* %0, %struct.timezone* %1) {
%3 = alloca %struct.timeval*
%4 = alloca %struct.timezone*
%5 = alloca i32
store %struct.timeval* %0, %struct.timeval** %3
store %struct.timezone* %1, %struct.timezone** %4
%6 = load %struct.timeval*, %struct.timeval** %3
%7 = load %struct.timezone*, %struct.timezone** %4
%8 = call i32 asm sideeffect "\09int $$0x80\0A", "={ax},{ax},{bx},{cx},~{memory},~{dirflag},~{fpsr},~{flags}"(i32 78, %struct.timeval* %6, %struct.timezone* %7)
store i32 %8, i32* %5
%9 = load i32, i32* %5
ret i32 %9
}

LLVM IR (-O2):
%struct.timeval = type opaque
%struct.timezone = type opaque
define i32 @gettimeofday(%struct.timeval* %0, %struct.timezone* %1) {
%3 = tail call i32 asm sideeffect "\09int $$0x80\0A", "={ax},{ax},{bx},{cx},~{memory},~{dirflag},~{fpsr},~{flags}"(i32 78, %struct.timeval* %0, %struct.timezone* %1)
ret i32 %3
}
void calc(int day) {}


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

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

LLVM IR (-O0):
define void @calc(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
ret void
}

LLVM IR (-O2):
define void @calc(i32 %0) {
ret void
}
/* Variables and functions */
char getchar();
void clearIBuffer() {
  char c;
  do {
    c = getchar();
  } while (c != '\n' && c != 'EOF');
}


x86 assembly (clang, -O0):
<clearIBuffer>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    $0x0,%al
call   1030 <getchar@plt>
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%ecx
xor    %eax,%eax
cmp    $0xa,%ecx
mov    %al,-0x2(%rbp)
je     1143 <clearIBuffer+0x33>
movsbl -0x1(%rbp),%eax
cmp    $0x454f46,%eax
setne  %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
test   $0x1,%al
jne    1118 <clearIBuffer+0x8>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<clearIBuffer>:
push   %rax
cs nopw 0x0(%rax,%rax,1)
nopl   0x0(%rax,%rax,1)
xor    %eax,%eax
call   1030 <getchar@plt>
cmp    $0xa,%al
jne    1120 <clearIBuffer+0x10>
pop    %rax
ret

LLVM IR (-O0):
define void @clearIBuffer() {
%1 = alloca i8
br label %2
2: ; preds = %12, %0
%3 = call signext i8 (...) @getchar()
store i8 %3, i8* %1
br label %4
4: ; preds = %2
%5 = load i8, i8* %1
%6 = sext i8 %5 to i32
%7 = icmp ne i32 %6, 10
br i1 %7, label %8, label %12
8: ; preds = %4
%9 = load i8, i8* %1
%10 = sext i8 %9 to i32
%11 = icmp ne i32 %10, 4542278
br label %12
12: ; preds = %8, %4
%13 = phi i1 [ false, %4 ], [ %11, %8 ]
br i1 %13, label %2, label %14
14: ; preds = %12
ret void
}

LLVM IR (-O2):
define void @clearIBuffer() {
br label %1
1: ; preds = %1, %0
%2 = tail call signext i8 (...) @getchar()
%3 = icmp eq i8 %2, 10
br i1 %3, label %4, label %1
4: ; preds = %1
ret void
}
/* Variables and functions */
int /*<<< orphan*/ clearLCDLine(int);
void clearScreen() {
  clearLCDLine(0);
  clearLCDLine(1);
}


x86 assembly (clang, -O0):
<clearScreen>:
push   %rbp
mov    %rsp,%rbp
xor    %edi,%edi
call   1030 <clearLCDLine@plt>
mov    $0x1,%edi
call   1030 <clearLCDLine@plt>
pop    %rbp
ret

x86 assembly (clang, -O2):
<clearScreen>:
push   %rax
xor    %edi,%edi
call   1030 <clearLCDLine@plt>
mov    $0x1,%edi
pop    %rax
jmp    1030 <clearLCDLine@plt>

LLVM IR (-O0):
define void @clearScreen() {
%1 = call i32 @clearLCDLine(i32 0)
%2 = call i32 @clearLCDLine(i32 1)
ret void
}

LLVM IR (-O2):
define void @clearScreen() {
%1 = tail call i32 @clearLCDLine(i32 0)
%2 = tail call i32 @clearLCDLine(i32 1)
ret void
}
int prot2(double ro, double to, double trot, double *r, double *t) {
  *t = to + trot;
  *r = ro;
  return 0;
}


x86 assembly (clang, -O0):
<prot2>:
push   %rbp
mov    %rsp,%rbp
movsd  %xmm0,-0x8(%rbp)
movsd  %xmm1,-0x10(%rbp)
movsd  %xmm2,-0x18(%rbp)
mov    %rdi,-0x20(%rbp)
mov    %rsi,-0x28(%rbp)
movsd  -0x10(%rbp),%xmm0
addsd  -0x18(%rbp),%xmm0
mov    -0x28(%rbp),%rax
movsd  %xmm0,(%rax)
movsd  -0x8(%rbp),%xmm0
mov    -0x20(%rbp),%rax
movsd  %xmm0,(%rax)
xor    %eax,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<prot2>:
addsd  %xmm2,%xmm1
movsd  %xmm1,(%rsi)
movsd  %xmm0,(%rdi)
xor    %eax,%eax
ret

LLVM IR (-O0):
define i32 @prot2(double %0, double %1, double %2, double* %3, double* %4) {
%6 = alloca double
%7 = alloca double
%8 = alloca double
%9 = alloca double*
%10 = alloca double*
store double %0, double* %6
store double %1, double* %7
store double %2, double* %8
store double* %3, double** %9
store double* %4, double** %10
%11 = load double, double* %7
%12 = load double, double* %8
%13 = fadd double %11, %12
%14 = load double*, double** %10
store double %13, double* %14
%15 = load double, double* %6
%16 = load double*, double** %9
store double %15, double* %16
ret i32 0
}

LLVM IR (-O2):
define i32 @prot2(double %0, double %1, double %2, double* nocapture writeonly %3, double* nocapture writeonly %4) {
%6 = fadd double %1, %2
store double %6, double* %4
store double %0, double* %3
ret i32 0
}
/* Variables and functions */
int db_delete_playlist_item(char **, int, int);
int pi_db_delete_playlist_item(char **pe, int playlistid, int songid) {
  return db_delete_playlist_item(pe, playlistid, songid);
}


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

x86 assembly (clang, -O2):
<pi_db_delete_playlist_item>:
jmp    1030 <db_delete_playlist_item@plt>

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

LLVM IR (-O2):
define i32 @pi_db_delete_playlist_item(i8** %0, i32 %1, i32 %2) {
%4 = tail call i32 @db_delete_playlist_item(i8** %0, i32 %1, i32 %2)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ exit(int /*<<< orphan*/);
int /*<<< orphan*/ printf(char *);
void winning(void) {
  printf("Congrats, you beat the final challenge!\n");
  exit(0);
}


x86 assembly (clang, -O0):
<winning>:
push   %rbp
mov    %rsp,%rbp
lea    0xed5(%rip),%rdi
call   1030 <printf@plt>
xor    %edi,%edi
call   1040 <exit@plt>

x86 assembly (clang, -O2):
<winning>:
push   %rax
lea    0xed8(%rip),%rdi
call   1030 <puts@plt>
xor    %edi,%edi
call   1040 <exit@plt>

LLVM IR (-O0):
@.str = [41 x i8] c"Congrats, you beat the final challenge!\0A\00"
define void @winning() {
%1 = call i32 @printf(i8* getelementptr inbounds ([41 x i8], [41 x i8]* @.str, i64 0, i64 0))
%2 = call i32 @exit(i32 0)
unreachable
}

LLVM IR (-O2):
@str = [40 x i8] c"Congrats, you beat the final challenge!\00"
define void @winning() {
%1 = tail call i32 @puts(i8* dereferenceable(1) getelementptr inbounds ([40 x i8], [40 x i8]* @str, i64 0, i64 0))
%2 = tail call i32 @exit(i32 0)
unreachable
}
void kvm_pmu_destroy(struct kvm_vcpu *vcpu) {}


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

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

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

LLVM IR (-O2):
%struct.kvm_vcpu = type opaque
define void @kvm_pmu_destroy(%struct.kvm_vcpu* nocapture %0) {
ret void
}
int MP_digin(int VV_device) {
  int PV_value = 0;
  return (PV_value);
}


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

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

LLVM IR (-O0):
define i32 @MP_digin(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 @MP_digin(i32 %0) {
ret i32 0
}
/* Variables and functions */
int /*<<< orphan*/ strlen(char const *);
int strncmp(char const *, char const *, int /*<<< orphan*/);
int prefixcmp(const char *str, const char *prefix) {
  return strncmp(str, prefix, strlen(prefix));
}


x86 assembly (clang, -O0):
<prefixcmp>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
mov    %rdi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    -0x8(%rbp),%rax
mov    %rax,-0x20(%rbp)
mov    -0x10(%rbp),%rax
mov    %rax,-0x18(%rbp)
mov    -0x10(%rbp),%rdi
call   1040 <strlen@plt>
mov    -0x20(%rbp),%rdi
mov    -0x18(%rbp),%rsi
mov    %eax,%edx
call   1030 <strncmp@plt>
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<prefixcmp>:
push   %r14
push   %rbx
push   %rax
mov    %rsi,%rbx
mov    %rdi,%r14
mov    %rsi,%rdi
call   1040 <strlen@plt>
mov    %r14,%rdi
mov    %rbx,%rsi
mov    %eax,%edx
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <strncmp@plt>

LLVM IR (-O0):
define i32 @prefixcmp(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 = load i8*, i8** %4
%7 = load i8*, i8** %4
%8 = call i32 @strlen(i8* %7)
%9 = call i32 @strncmp(i8* %5, i8* %6, i32 %8)
ret i32 %9
}

LLVM IR (-O2):
define i32 @prefixcmp(i8* %0, i8* %1) {
%3 = tail call i32 @strlen(i8* %1)
%4 = tail call i32 @strncmp(i8* %0, i8* %1, i32 %3)
ret i32 %4
}
int begin_t(int *box) {
  if ((box[0] == 9 && box[1] == 7 && box[2] == 8) ||
      (box[0] == 9 && box[1] == 7 && box[2] == 9)) {
    return 1;
  }
  return 0;
}


x86 assembly (clang, -O0):
<begin_t>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x10(%rbp)
mov    -0x10(%rbp),%rax
cmpl   $0x9,(%rax)
jne    1131 <begin_t+0x31>
mov    -0x10(%rbp),%rax
cmpl   $0x7,0x4(%rax)
jne    1131 <begin_t+0x31>
mov    -0x10(%rbp),%rax
cmpl   $0x8,0x8(%rax)
je     115a <begin_t+0x5a>
mov    -0x10(%rbp),%rax
cmpl   $0x9,(%rax)
jne    1166 <begin_t+0x66>
mov    -0x10(%rbp),%rax
cmpl   $0x7,0x4(%rax)
jne    1166 <begin_t+0x66>
mov    -0x10(%rbp),%rax
cmpl   $0x9,0x8(%rax)
jne    1166 <begin_t+0x66>
movl   $0x1,-0x4(%rbp)
jmp    116d <begin_t+0x6d>
movl   $0x0,-0x4(%rbp)
mov    -0x4(%rbp),%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<begin_t>:
cmpl   $0x9,(%rdi)
jne    111c <begin_t+0x1c>
cmpl   $0x7,0x4(%rdi)
jne    111c <begin_t+0x1c>
mov    $0x1,%eax
cmpl   $0x8,0x8(%rdi)
je     111e <begin_t+0x1e>
cmpl   $0x9,0x8(%rdi)
je     111e <begin_t+0x1e>
xor    %eax,%eax
ret

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

LLVM IR (-O2):
define i32 @begin_t(i32* nocapture %0) {
%2 = load i32, i32* %0
%3 = icmp eq i32 %2, 9
br i1 %3, label %4, label %16
4: ; preds = %1
%5 = getelementptr inbounds i32, i32* %0, i64 1
%6 = load i32, i32* %5
%7 = icmp eq i32 %6, 7
br i1 %7, label %8, label %16
8: ; preds = %4
%9 = getelementptr inbounds i32, i32* %0, i64 2
%10 = load i32, i32* %9
%11 = icmp eq i32 %10, 8
br i1 %11, label %17, label %12
12: ; preds = %8
%13 = getelementptr inbounds i32, i32* %0, i64 2
%14 = load i32, i32* %13
%15 = icmp eq i32 %14, 9
br i1 %15, label %17, label %16
16: ; preds = %4, %1, %12
br label %17
17: ; preds = %8, %12, %16
%18 = phi i32 [ 0, %16 ], [ 1, %12 ], [ 1, %8 ]
ret i32 %18
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ SEEK_CUR;
int fgetc(int /*<<< orphan*/ *);
int /*<<< orphan*/ fseek(int /*<<< orphan*/ *, long, int /*<<< orphan*/);
int read_file_backwards(FILE *input) {
  (void)fseek(input, -2L, SEEK_CUR);
  return fgetc(input);
}


x86 assembly (clang, -O0):
<read_file_backwards>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rdi
mov    0x2eb1(%rip),%rax
mov    (%rax),%edx
mov    $0xfffffffffffffffe,%rsi
call   1040 <fseek@plt>
mov    -0x8(%rbp),%rdi
call   1030 <fgetc@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<read_file_backwards>:
push   %rbx
mov    %rdi,%rbx
mov    0x2ebd(%rip),%rax
mov    (%rax),%edx
mov    $0xfffffffffffffffe,%rsi
call   1040 <fseek@plt>
mov    %rbx,%rdi
pop    %rbx
jmp    1030 <fgetc@plt>

LLVM IR (-O0):
@SEEK_CUR = global i32 0
define i32 @read_file_backwards(i32* %0) {
%2 = alloca i32*
store i32* %0, i32** %2
%3 = load i32*, i32** %2
%4 = load i32, i32* @SEEK_CUR
%5 = call i32 @fseek(i32* %3, i64 -2, i32 %4)
%6 = load i32*, i32** %2
%7 = call i32 @fgetc(i32* %6)
ret i32 %7
}

LLVM IR (-O2):
@SEEK_CUR = global i32 0
define i32 @read_file_backwards(i32* nocapture %0) {
%2 = load i32, i32* @SEEK_CUR
%3 = tail call i32 @fseek(i32* %0, i64 -2, i32 %2)
%4 = tail call i32 @fgetc(i32* %0)
ret i32 %4
}
/* Variables and functions */
int /*<<< orphan*/ printf_(char *);
int main(void) {
  printf_("Hello, World.\n");
  return 0;
}


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

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

LLVM IR (-O0):
@.str = [15 x i8] c"Hello, World.\0A\00"
define i32 @main() {
%1 = alloca i32
store i32 0, i32* %1
%2 = call i32 @printf_(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret i32 0
}

LLVM IR (-O2):
@.str = [15 x i8] c"Hello, World.\0A\00"
define i32 @main() {
%1 = tail call i32 @printf_(i8* getelementptr inbounds ([15 x i8], [15 x i8]* @.str, i64 0, i64 0))
ret i32 0
}
int do_441() { return 441; }


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

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

LLVM IR (-O0):
define i32 @do_441() {
ret i32 441
}

LLVM IR (-O2):
define i32 @do_441() {
ret i32 441
}
/* Variables and functions */
void bootloader_ana_clock_glitch_reset_config(bool enable) { (void)enable; }


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

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

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

LLVM IR (-O2):
define void @bootloader_ana_clock_glitch_reset_config(i32 %0) {
ret void
}
/* Variables and functions */
int /*<<< orphan*/ assert(int);
size_t strspn(char *, char *);
int main(int argc, char **argv) {
  size_t r;
  char s2[] = "ab";
  char s1[] = {'a', 'c'};
  char s3 = 0;
  r = strspn(s1, s2);
  assert(r == 1);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    0xec3(%rip),%ax
mov    %ax,-0x1b(%rbp)
mov    0xebb(%rip),%al
mov    %al,-0x19(%rbp)
mov    0xeb2(%rip),%ax
mov    %ax,-0x1d(%rbp)
movb   $0x0,-0x1e(%rbp)
lea    -0x1d(%rbp),%rdi
lea    -0x1b(%rbp),%rsi
call   1030 <strspn@plt>
mov    %rax,-0x18(%rbp)
cmpq   $0x1,-0x18(%rbp)
sete   %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <assert@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

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

LLVM IR (-O0):
@__const.main.s2 = [3 x i8] c"ab\00"
@__const.main.s1 = [2 x i8] c"ac"
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i64
%7 = alloca [3 x i8]
%8 = alloca [2 x i8]
%9 = alloca i8
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = bitcast [3 x i8]* %7 to i8*
%11 = bitcast [2 x i8]* %8 to i8*
store i8 0, i8* %9
%12 = getelementptr inbounds [2 x i8], [2 x i8]* %8, i64 0, i64 0
%13 = getelementptr inbounds [3 x i8], [3 x i8]* %7, i64 0, i64 0
%14 = call i64 @strspn(i8* %12, i8* %13)
store i64 %14, i64* %6
%15 = load i64, i64* %6
%16 = icmp eq i64 %15, 1
%17 = zext i1 %16 to i32
%18 = call i32 @assert(i32 %17)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 @assert(i32 1)
ret i32 0
}
int frag_curs_step_inward(struct frag_curs *fc) { return -1; }


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

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

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

LLVM IR (-O2):
%struct.frag_curs = type opaque
define i32 @frag_curs_step_inward(%struct.frag_curs* nocapture readnone %0) {
ret i32 -1
}
int wstopsig(int stat_val) { return -1; }


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

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

LLVM IR (-O0):
define i32 @wstopsig(i32 %0) {
%2 = alloca i32
store i32 %0, i32* %2
ret i32 -1
}

LLVM IR (-O2):
define i32 @wstopsig(i32 %0) {
ret i32 -1
}
int fn3(int a, int b) {
  int tem1 = a + b;
  int tem2 = b & a;
  return tem1 - tem2;
}


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

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

LLVM IR (-O0):
define i32 @fn3(i32 %0, i32 %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i32
%6 = alloca i32
store i32 %0, i32* %3
store i32 %1, i32* %4
%7 = load i32, i32* %3
%8 = load i32, i32* %4
%9 = add nsw i32 %7, %8
store i32 %9, i32* %5
%10 = load i32, i32* %4
%11 = load i32, i32* %3
%12 = and i32 %10, %11
store i32 %12, i32* %6
%13 = load i32, i32* %5
%14 = load i32, i32* %6
%15 = sub nsw i32 %13, %14
ret i32 %15
}

LLVM IR (-O2):
define i32 @fn3(i32 %0, i32 %1) {
%3 = or i32 %1, %0
ret i32 %3
}
void kasan_unpoison_task_stack(struct task_struct *task) {}


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

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

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

LLVM IR (-O2):
%struct.task_struct = type opaque
define void @kasan_unpoison_task_stack(%struct.task_struct* nocapture %0) {
ret void
}
int config_HAVE_DVBAPI(void) { return 0; }


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

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

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

LLVM IR (-O2):
define i32 @config_HAVE_DVBAPI() {
ret i32 0
}
/* Type definitions */
typedef int /*<<< orphan*/ FILE;

/* Variables and functions */
int /*<<< orphan*/ *FindFptr(void *, char const *);
int genungetchar(void *, int);
int /*<<< orphan*/ *stdin;
int ungetc(int, int /*<<< orphan*/ *);
int UngetcFile(void *theEnv, int ch, const char *logicalName) {
  FILE *fptr;
  fptr = FindFptr(theEnv, logicalName);
  if (fptr == stdin) {
    return (genungetchar(theEnv, ch));
  } else {
    return (ungetc(ch, fptr));
  }
}


x86 assembly (clang, -O0):
<UngetcFile>:
push   %rbp
mov    %rsp,%rbp
sub    $0x30,%rsp
mov    %rdi,-0x10(%rbp)
mov    %esi,-0x14(%rbp)
mov    %rdx,-0x20(%rbp)
mov    -0x10(%rbp),%rdi
mov    -0x20(%rbp),%rsi
call   1030 <FindFptr@plt>
mov    %rax,-0x28(%rbp)
mov    -0x28(%rbp),%rax
mov    0x2e89(%rip),%rcx
cmp    (%rcx),%rax
jne    117c <UngetcFile+0x4c>
mov    -0x10(%rbp),%rdi
mov    -0x14(%rbp),%esi
call   1040 <genungetchar@plt>
mov    %eax,-0x4(%rbp)
jmp    118b <UngetcFile+0x5b>
mov    -0x14(%rbp),%edi
mov    -0x28(%rbp),%rsi
call   1050 <ungetc@plt>
mov    %eax,-0x4(%rbp)
mov    -0x4(%rbp),%eax
add    $0x30,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<UngetcFile>:
push   %rbp
push   %rbx
push   %rax
mov    %esi,%ebp
mov    %rdi,%rbx
mov    %rdx,%rsi
call   1030 <FindFptr@plt>
mov    0x2ea1(%rip),%rcx
cmp    (%rcx),%rax
je     115c <UngetcFile+0x2c>
mov    %ebp,%edi
mov    %rax,%rsi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1050 <ungetc@plt>
mov    %rbx,%rdi
mov    %ebp,%esi
add    $0x8,%rsp
pop    %rbx
pop    %rbp
jmp    1040 <genungetchar@plt>

LLVM IR (-O0):
@stdin = global i32* null
define i32 @UngetcFile(i8* %0, i32 %1, i8* %2) {
%4 = alloca i32
%5 = alloca i8*
%6 = alloca i32
%7 = alloca i8*
%8 = alloca i32*
store i8* %0, i8** %5
store i32 %1, i32* %6
store i8* %2, i8** %7
%9 = load i8*, i8** %5
%10 = load i8*, i8** %7
%11 = call i32* @FindFptr(i8* %9, i8* %10)
store i32* %11, i32** %8
%12 = load i32*, i32** %8
%13 = load i32*, i32** @stdin
%14 = icmp eq i32* %12, %13
br i1 %14, label %15, label %19
15: ; preds = %3
%16 = load i8*, i8** %5
%17 = load i32, i32* %6
%18 = call i32 @genungetchar(i8* %16, i32 %17)
store i32 %18, i32* %4
br label %23
19: ; preds = %3
%20 = load i32, i32* %6
%21 = load i32*, i32** %8
%22 = call i32 @ungetc(i32 %20, i32* %21)
store i32 %22, i32* %4
br label %23
23: ; preds = %19, %15
%24 = load i32, i32* %4
ret i32 %24
}

LLVM IR (-O2):
@stdin = global i32* null
define i32 @UngetcFile(i8* %0, i32 %1, i8* %2) {
%4 = tail call i32* @FindFptr(i8* %0, i8* %2)
%5 = load i32*, i32** @stdin
%6 = icmp eq i32* %4, %5
br i1 %6, label %7, label %9
7: ; preds = %3
%8 = tail call i32 @genungetchar(i8* %0, i32 %1)
br label %11
9: ; preds = %3
%10 = tail call i32 @ungetc(i32 %1, i32* %4)
br label %11
11: ; preds = %9, %7
%12 = phi i32 [ %8, %7 ], [ %10, %9 ]
ret i32 %12
}
/* Type definitions */
struct i8x_object {
  int dummy;
};
struct i8x_funcref {
  int dummy;
};

/* Variables and functions */
scalar_t__ i8x_ob_ref(struct i8x_object *);
struct i8x_funcref *__attribute__((always_))
i8x_funcref_ref(struct i8x_funcref *x) {
  return (struct i8x_funcref *)i8x_ob_ref((struct i8x_object *)x);
}


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

x86 assembly (clang, -O2):
<i8x_funcref_ref>:
jmp    1030 <i8x_ob_ref@plt>

LLVM IR (-O0):
%struct.i8x_funcref = type { i32 }
%struct.i8x_object = type { i32 }
define %struct.i8x_funcref* @i8x_funcref_ref(%struct.i8x_funcref* %0) {
%2 = alloca %struct.i8x_funcref*
store %struct.i8x_funcref* %0, %struct.i8x_funcref** %2
%3 = load %struct.i8x_funcref*, %struct.i8x_funcref** %2
%4 = bitcast %struct.i8x_funcref* %3 to %struct.i8x_object*
%5 = call i64 @i8x_ob_ref(%struct.i8x_object* %4)
%6 = inttoptr i64 %5 to %struct.i8x_funcref*
ret %struct.i8x_funcref* %6
}

LLVM IR (-O2):
%struct.i8x_funcref = type { i32 }
%struct.i8x_object = type { i32 }
define %struct.i8x_funcref* @i8x_funcref_ref(%struct.i8x_funcref* %0) {
%2 = bitcast %struct.i8x_funcref* %0 to %struct.i8x_object*
%3 = tail call i64 @i8x_ob_ref(%struct.i8x_object* %2)
%4 = inttoptr i64 %3 to %struct.i8x_funcref*
ret %struct.i8x_funcref* %4
}
/* Variables and functions */
int /*<<< orphan*/ assume(int);
int /*<<< orphan*/ static_assert(int);
int unknown1();
int main(int argc, char *argv[]) {
  int n;
  int i, k, j;
  n = unknown1();
  assume(n > 0);
  assume(k > n);
  j = 0;
  while (j < n) {
    j++;
    k--;
  }
  static_assert(k >= 0);
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x20,%rsp
movl   $0x0,-0x4(%rbp)
mov    %edi,-0x8(%rbp)
mov    %rsi,-0x10(%rbp)
mov    $0x0,%al
call   1030 <unknown1@plt>
mov    %eax,-0x14(%rbp)
cmpl   $0x0,-0x14(%rbp)
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assume@plt>
mov    -0x1c(%rbp),%eax
cmp    -0x14(%rbp),%eax
setg   %al
and    $0x1,%al
movzbl %al,%edi
call   1050 <assume@plt>
movl   $0x0,-0x20(%rbp)
mov    -0x20(%rbp),%eax
cmp    -0x14(%rbp),%eax
jge    119e <main+0x6e>
mov    -0x20(%rbp),%eax
add    $0x1,%eax
mov    %eax,-0x20(%rbp)
mov    -0x1c(%rbp),%eax
add    $0xffffffff,%eax
mov    %eax,-0x1c(%rbp)
jmp    117b <main+0x4b>
cmpl   $0x0,-0x1c(%rbp)
setge  %al
and    $0x1,%al
movzbl %al,%edi
call   1040 <static_assert@plt>
xor    %eax,%eax
add    $0x20,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rax
xor    %eax,%eax
call   1030 <unknown1@plt>
xor    %edi,%edi
test   %eax,%eax
setg   %dil
call   1050 <assume@plt>
xor    %edi,%edi
call   1050 <assume@plt>
xor    %edi,%edi
call   1040 <static_assert@plt>
xor    %eax,%eax
pop    %rcx
ret

LLVM IR (-O0):
define i32 @main(i32 %0, i8** %1) {
%3 = alloca i32
%4 = alloca i32
%5 = alloca i8**
%6 = alloca i32
%7 = alloca i32
%8 = alloca i32
%9 = alloca i32
store i32 0, i32* %3
store i32 %0, i32* %4
store i8** %1, i8*** %5
%10 = call i32 (...) @unknown1()
store i32 %10, i32* %6
%11 = load i32, i32* %6
%12 = icmp sgt i32 %11, 0
%13 = zext i1 %12 to i32
%14 = call i32 @assume(i32 %13)
%15 = load i32, i32* %8
%16 = load i32, i32* %6
%17 = icmp sgt i32 %15, %16
%18 = zext i1 %17 to i32
%19 = call i32 @assume(i32 %18)
store i32 0, i32* %9
br label %20
20: ; preds = %24, %2
%21 = load i32, i32* %9
%22 = load i32, i32* %6
%23 = icmp slt i32 %21, %22
br i1 %23, label %24, label %29
24: ; preds = %20
%25 = load i32, i32* %9
%26 = add nsw i32 %25, 1
store i32 %26, i32* %9
%27 = load i32, i32* %8
%28 = add nsw i32 %27, -1
store i32 %28, i32* %8
br label %20
29: ; preds = %20
%30 = load i32, i32* %8
%31 = icmp sge i32 %30, 0
%32 = zext i1 %31 to i32
%33 = call i32 @static_assert(i32 %32)
ret i32 0
}

LLVM IR (-O2):
define i32 @main(i32 %0, i8** nocapture readnone %1) {
%3 = tail call i32 (...) @unknown1()
%4 = icmp sgt i32 %3, 0
%5 = zext i1 %4 to i32
%6 = tail call i32 @assume(i32 %5)
%7 = tail call i32 @assume(i32 0)
%8 = tail call i32 @static_assert(i32 0)
ret i32 0
}
void z80sio(void) { return; }


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

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

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

LLVM IR (-O2):
define void @z80sio() {
ret void
}
int test_imm_06int8_mem(signed char *val) {
  return ((*val) & (-0x06 << 0)) ? -20 : -40;
}


x86 assembly (clang, -O0):
<test_imm_06int8_mem>:
push   %rbp
mov    %rsp,%rbp
mov    %rdi,-0x8(%rbp)
mov    -0x8(%rbp),%rax
movsbl (%rax),%edx
and    $0xfffffffa,%edx
mov    $0xffffffd8,%eax
mov    $0xffffffec,%ecx
cmp    $0x0,%edx
cmovne %ecx,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<test_imm_06int8_mem>:
testb  $0xfa,(%rdi)
mov    $0xffffffd8,%ecx
mov    $0xffffffec,%eax
cmove  %ecx,%eax
ret

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

LLVM IR (-O2):
define i32 @test_imm_06int8_mem(i8* nocapture %0) {
%2 = load i8, i8* %0
%3 = and i8 %2, -6
%4 = icmp eq i8 %3, 0
%5 = select i1 %4, i32 -40, i32 -20
ret i32 %5
}
int invalid(char b) {
  return ((b < 0x20 && (b != 0x09 && b != 0x0A && b != 0x0D)) || (b > 0x7e));
}


x86 assembly (clang, -O0):
<invalid>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
movsbl -0x1(%rbp),%eax
cmp    $0x20,%eax
jge    1143 <invalid+0x43>
movsbl -0x1(%rbp),%eax
cmp    $0x9,%eax
je     1143 <invalid+0x43>
movsbl -0x1(%rbp),%eax
cmp    $0xa,%eax
je     1143 <invalid+0x43>
movsbl -0x1(%rbp),%ecx
mov    $0x1,%al
cmp    $0xd,%ecx
mov    %al,-0x2(%rbp)
jne    1150 <invalid+0x50>
movsbl -0x1(%rbp),%eax
cmp    $0x7e,%eax
setg   %al
mov    %al,-0x2(%rbp)
mov    -0x2(%rbp),%al
and    $0x1,%al
movzbl %al,%eax
pop    %rbp
ret

x86 assembly (clang, -O2):
<invalid>:
cmp    $0x1f,%dil
jg     1124 <invalid+0x24>
add    $0xf7,%dil
mov    $0x1,%eax
cmp    $0x5,%dil
jae    1123 <invalid+0x23>
movsbq %dil,%rax
lea    0xee0(%rip),%rcx
mov    (%rcx,%rax,4),%eax
ret
xor    %eax,%eax
cmp    $0x7f,%dil
sete   %al
ret

LLVM IR (-O0):
define i32 @invalid(i8 signext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load i8, i8* %2
%4 = sext i8 %3 to i32
%5 = icmp slt i32 %4, 32
br i1 %5, label %6, label %18
6: ; preds = %1
%7 = load i8, i8* %2
%8 = sext i8 %7 to i32
%9 = icmp ne i32 %8, 9
br i1 %9, label %10, label %18
10: ; preds = %6
%11 = load i8, i8* %2
%12 = sext i8 %11 to i32
%13 = icmp ne i32 %12, 10
br i1 %13, label %14, label %18
14: ; preds = %10
%15 = load i8, i8* %2
%16 = sext i8 %15 to i32
%17 = icmp ne i32 %16, 13
br i1 %17, label %22, label %18
18: ; preds = %14, %10, %6, %1
%19 = load i8, i8* %2
%20 = sext i8 %19 to i32
%21 = icmp sgt i32 %20, 126
br label %22
22: ; preds = %18, %14
%23 = phi i1 [ true, %14 ], [ %21, %18 ]
%24 = zext i1 %23 to i32
ret i32 %24
}

LLVM IR (-O2):
@switch.table.invalid = [5 x i32] [i32 0, i32 0, i32 1, i32 1, i32 0]
define i32 @invalid(i8 signext %0) {
%2 = icmp slt i8 %0, 32
br i1 %2, label %3, label %6
3: ; preds = %1
%4 = add i8 %0, -9
%5 = icmp ult i8 %4, 5
br i1 %5, label %9, label %13
6: ; preds = %1
%7 = icmp eq i8 %0, 127
%8 = zext i1 %7 to i32
br label %13
9: ; preds = %3
%10 = sext i8 %4 to i64
%11 = getelementptr inbounds [5 x i32], [5 x i32]* @switch.table.invalid, i64 0, i64 %10
%12 = load i32, i32* %11
br label %13
13: ; preds = %9, %3, %6
%14 = phi i32 [ %8, %6 ], [ 1, %3 ], [ %12, %9 ]
ret i32 %14
}
/* Type definitions */
typedef int uint32_t;

/* Variables and functions */
void TimerPrescaleSet(uint32_t ui32Base, uint32_t ui32Timer,
                      uint32_t ui32Value) {
  ;

  ;
  ;
  if (ui32Timer & 0x000000FF) {
    (*((volatile unsigned long *)(ui32Base + 0x00000038))) = ui32Value;
  }
  if (ui32Timer & 0x0000FF00) {
    (*((volatile unsigned long *)(ui32Base + 0x0000003C))) = ui32Value;
  }
}


x86 assembly (clang, -O0):
<TimerPrescaleSet>:
push   %rbp
mov    %rsp,%rbp
mov    %edi,-0x4(%rbp)
mov    %esi,-0x8(%rbp)
mov    %edx,-0xc(%rbp)
mov    -0x8(%rbp),%eax
and    $0xff,%eax
cmp    $0x0,%eax
je     112d <TimerPrescaleSet+0x2d>
movslq -0xc(%rbp),%rcx
mov    -0x4(%rbp),%eax
add    $0x38,%eax
cltq
mov    %rcx,(%rax)
mov    -0x8(%rbp),%eax
and    $0xff00,%eax
cmp    $0x0,%eax
je     114d <TimerPrescaleSet+0x4d>
movslq -0xc(%rbp),%rcx
mov    -0x4(%rbp),%eax
add    $0x3c,%eax
cltq
mov    %rcx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<TimerPrescaleSet>:
movslq %edx,%rax
movslq %edi,%rcx
test   %sil,%sil
je     110f <TimerPrescaleSet+0xf>
mov    %rax,0x38(%rcx)
test   $0xff00,%esi
je     111b <TimerPrescaleSet+0x1b>
mov    %rax,0x3c(%rcx)
ret

LLVM IR (-O0):
define void @TimerPrescaleSet(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* %5
%8 = and i32 %7, 255
%9 = icmp ne i32 %8, 0
br i1 %9, label %10, label %17
10: ; preds = %3
%11 = load i32, i32* %6
%12 = sext i32 %11 to i64
%13 = load i32, i32* %4
%14 = add nsw i32 %13, 56
%15 = sext i32 %14 to i64
%16 = inttoptr i64 %15 to i64*
store volatile i64 %12, i64* %16
br label %17
17: ; preds = %10, %3
%18 = load i32, i32* %5
%19 = and i32 %18, 65280
%20 = icmp ne i32 %19, 0
br i1 %20, label %21, label %28
21: ; preds = %17
%22 = load i32, i32* %6
%23 = sext i32 %22 to i64
%24 = load i32, i32* %4
%25 = add nsw i32 %24, 60
%26 = sext i32 %25 to i64
%27 = inttoptr i64 %26 to i64*
store volatile i64 %23, i64* %27
br label %28
28: ; preds = %21, %17
ret void
}

LLVM IR (-O2):
define void @TimerPrescaleSet(i32 %0, i32 %1, i32 %2) {
%4 = and i32 %1, 255
%5 = icmp eq i32 %4, 0
br i1 %5, label %11, label %6
6: ; preds = %3
%7 = sext i32 %2 to i64
%8 = add nsw i32 %0, 56
%9 = sext i32 %8 to i64
%10 = inttoptr i64 %9 to i64*
store volatile i64 %7, i64* %10
br label %11
11: ; preds = %6, %3
%12 = and i32 %1, 65280
%13 = icmp eq i32 %12, 0
br i1 %13, label %19, label %14
14: ; preds = %11
%15 = sext i32 %2 to i64
%16 = add nsw i32 %0, 60
%17 = sext i32 %16 to i64
%18 = inttoptr i64 %17 to i64*
store volatile i64 %15, i64* %18
br label %19
19: ; preds = %14, %11
ret void
}
int do_857() { return 857; }


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

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

LLVM IR (-O0):
define i32 @do_857() {
ret i32 857
}

LLVM IR (-O2):
define i32 @do_857() {
ret i32 857
}
void gpio_set(unsigned char val) {
  *((volatile unsigned short *)0x4000134) =
      (*((volatile unsigned short *)0x4000134) & 0xfff0) | (val & 0xf);
}


x86 assembly (clang, -O0):
<gpio_set>:
push   %rbp
mov    %rsp,%rbp
mov    %dil,%al
mov    %al,-0x1(%rbp)
mov    $0x4000134,%eax
mov    (%rax),%ax
movzwl %ax,%eax
and    $0xfff0,%eax
movzbl -0x1(%rbp),%ecx
and    $0xf,%ecx
or     %ecx,%eax
mov    %ax,%cx
mov    $0x4000134,%eax
mov    %cx,(%rax)
pop    %rbp
ret

x86 assembly (clang, -O2):
<gpio_set>:
movzwl 0x4000134,%eax
04
and    $0xfffffff0,%eax
and    $0xf,%edi
or     %eax,%edi
mov    %di,0x4000134
04
ret

LLVM IR (-O0):
define void @gpio_set(i8 zeroext %0) {
%2 = alloca i8
store i8 %0, i8* %2
%3 = load volatile i16, i16* inttoptr (i64 67109172 to i16*)
%4 = zext i16 %3 to i32
%5 = and i32 %4, 65520
%6 = load i8, i8* %2
%7 = zext i8 %6 to i32
%8 = and i32 %7, 15
%9 = or i32 %5, %8
%10 = trunc i32 %9 to i16
store volatile i16 %10, i16* inttoptr (i64 67109172 to i16*)
ret void
}

LLVM IR (-O2):
define void @gpio_set(i8 zeroext %0) {
%2 = load volatile i16, i16* inttoptr (i64 67109172 to i16*)
%3 = and i16 %2, -16
%4 = and i8 %0, 15
%5 = zext i8 %4 to i16
%6 = or i16 %3, %5
store volatile i16 %6, i16* inttoptr (i64 67109172 to i16*)
ret void
}
main() {
  __attribute(()) x = 3;
  return x;
}


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

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

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

LLVM IR (-O2):
define i32 @main() {
ret i32 3
}
/* Variables and functions */
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *, char *);
int /*<<< orphan*/ stderr;
void usage(char *exe) { fprintf(stderr, "Usage: %s <password>\n", exe); }


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

x86 assembly (clang, -O2):
<usage>:
mov    %rdi,%rdx
mov    0x2ec6(%rip),%rax
mov    (%rax),%edi
lea    0xedd(%rip),%rsi
jmp    1030 <fprintf@plt>

LLVM IR (-O0):
@stderr = global i32 0
@.str = [22 x i8] c"Usage: %s <password>\0A\00"
define void @usage(i8* %0) {
%2 = alloca i8*
store i8* %0, i8** %2
%3 = load i32, i32* @stderr
%4 = load i8*, i8** %2
%5 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %4)
ret void
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [22 x i8] c"Usage: %s <password>\0A\00"
define void @usage(i8* %0) {
%2 = load i32, i32* @stderr
%3 = tail call i32 @fprintf(i32 %2, i8* getelementptr inbounds ([22 x i8], [22 x i8]* @.str, i64 0, i64 0), i8* %0)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ execvp(char *, char **);
void run_child(int argc, char **argv) { execvp(argv[0], argv); }


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

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

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

LLVM IR (-O2):
define void @run_child(i32 %0, i8** %1) {
%3 = load i8*, i8** %1
%4 = tail call i32 @execvp(i8* %3, i8** %1)
ret void
}
/* Variables and functions */
int /*<<< orphan*/ exit(int);
int /*<<< orphan*/ fprintf(int /*<<< orphan*/, char *);
int /*<<< orphan*/ stderr;
void showusage() {
  fprintf(stderr, "usage: brp input column-index output1 output2 output3...\n");
  fprintf(stderr, "       can specify '-' for input, to read from stdin\n");
  exit(1);
}


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

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

LLVM IR (-O0):
@stderr = global i32 0
@.str = [58 x i8] c"usage: brp input column-index output1 output2 output3...\0A\00"
@.str.1 = [54 x i8] c" can specify '-' for input, to read from stdin\0A\00"
define void @showusage() {
%1 = load i32, i32* @stderr
%2 = call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stderr
%4 = call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0))
%5 = call i32 @exit(i32 1)
unreachable
}

LLVM IR (-O2):
@stderr = global i32 0
@.str = [58 x i8] c"usage: brp input column-index output1 output2 output3...\0A\00"
@.str.1 = [54 x i8] c" can specify '-' for input, to read from stdin\0A\00"
define void @showusage() {
%1 = load i32, i32* @stderr
%2 = tail call i32 @fprintf(i32 %1, i8* getelementptr inbounds ([58 x i8], [58 x i8]* @.str, i64 0, i64 0))
%3 = load i32, i32* @stderr
%4 = tail call i32 @fprintf(i32 %3, i8* getelementptr inbounds ([54 x i8], [54 x i8]* @.str.1, i64 0, i64 0))
%5 = tail call i32 @exit(i32 1)
unreachable
}
/* Variables and functions */
int /*<<< orphan*/ printf(char *, unsigned int);
void bin_to_ascii(unsigned int value) {
  int qt;
  qt = value / 10;
  if (qt != 0)
    bin_to_ascii(qt);
  printf("%c", '0' + (value % 10));
}


x86 assembly (clang, -O0):
<bin_to_ascii>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
mov    %edi,-0x4(%rbp)
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
mov    %eax,-0x8(%rbp)
cmpl   $0x0,-0x8(%rbp)
je     114c <bin_to_ascii+0x2c>
mov    -0x8(%rbp),%edi
call   1040 <bin_to_ascii@plt>
mov    -0x4(%rbp),%eax
mov    $0xa,%ecx
xor    %edx,%edx
div    %ecx
mov    %edx,%esi
add    $0x30,%esi
lea    0xe9c(%rip),%rdi
call   1030 <printf@plt>
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<bin_to_ascii>:
push   %r14
push   %rbx
push   %rax
mov    %edi,%ebx
mov    %edi,%r14d
cmp    $0xa,%edi
jb     1140 <bin_to_ascii+0x20>
mov    $0xcccccccd,%edi
imul   %r14,%rdi
shr    $0x23,%rdi
call   1040 <bin_to_ascii@plt>
mov    $0xcccccccd,%eax
imul   %r14,%rax
shr    $0x23,%rax
add    %eax,%eax
lea    (%rax,%rax,4),%eax
sub    %eax,%ebx
or     $0x30,%ebx
lea    0xea2(%rip),%rdi
mov    %ebx,%esi
add    $0x8,%rsp
pop    %rbx
pop    %r14
jmp    1030 <printf@plt>

LLVM IR (-O0):
@.str = [3 x i8] c"%c\00"
define void @bin_to_ascii(i32 %0) {
%2 = alloca i32
%3 = alloca i32
store i32 %0, i32* %2
%4 = load i32, i32* %2
%5 = udiv i32 %4, 10
store i32 %5, i32* %3
%6 = load i32, i32* %3
%7 = icmp ne i32 %6, 0
br i1 %7, label %8, label %10
8: ; preds = %1
%9 = load i32, i32* %3
br label %10
10: ; preds = %8, %1
%11 = load i32, i32* %2
%12 = urem i32 %11, 10
%13 = add i32 48, %12
%14 = call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %13)
ret void
}

LLVM IR (-O2):
@.str = [3 x i8] c"%c\00"
define void @bin_to_ascii(i32 %0) {
%2 = icmp ult i32 %0, 10
br i1 %2, label %5, label %3
3: ; preds = %1
%4 = udiv i32 %0, 10
tail call void @bin_to_ascii(i32 %4)
br label %5
5: ; preds = %3, %1
%6 = urem i32 %0, 10
%7 = or i32 %6, 48
%8 = tail call i32 @printf(i8* getelementptr inbounds ([3 x i8], [3 x i8]* @.str, i64 0, i64 0), i32 %7)
ret void
}