#define NULL ((void *)0)
typedef unsigned long size_t; // Customize by platform.
typedef long intptr_t;
typedef unsigned long uintptr_t;
typedef long scalar_t__; // Either arithmetic or pointer type.
/* By default, we understand bool (as a convenience). */
typedef int bool;
#define false 0
#define true 1

/* Forward declarations */

/* Type definitions */

/* Variables and functions */
int /*<<< orphan*/ gets(char *);
int /*<<< orphan*/ printf(char *);
scalar_t__ strcmp(char *, char *);
int main() {
  char buffer[5];
  char passwd[] = "1234\0";
  printf("jelszo: ");
  gets(buffer);
  if (strcmp(buffer, passwd)) {
    printf("jo jelszo\n");
  } else {
    printf("nem jo\n");
  }
  return 0;
}


x86 assembly (clang, -O0):
<main>:
push   %rbp
mov    %rsp,%rbp
sub    $0x10,%rsp
movl   $0x0,-0x4(%rbp)
mov    0xebb(%rip),%eax
mov    %eax,-0xf(%rbp)
mov    0xeb5(%rip),%ax
mov    %ax,-0xb(%rbp)
lea    0xeac(%rip),%rdi
call   1030 <printf@plt>
lea    -0x9(%rbp),%rdi
call   1050 <gets@plt>
lea    -0x9(%rbp),%rdi
lea    -0xf(%rbp),%rsi
call   1040 <strcmp@plt>
cmp    $0x0,%rax
je     1190 <main+0x60>
lea    0xe89(%rip),%rdi
call   1030 <printf@plt>
jmp    119c <main+0x6c>
lea    0xe83(%rip),%rdi
call   1030 <printf@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbp
ret

x86 assembly (clang, -O2):
<main>:
push   %rbx
sub    $0x10,%rsp
movw   $0x0,0x8(%rsp)
movl   $0x34333231,0x4(%rsp)
34
lea    0xeab(%rip),%rdi
call   1040 <printf@plt>
lea    0xb(%rsp),%rbx
mov    %rbx,%rdi
call   1060 <gets@plt>
lea    0x4(%rsp),%rsi
mov    %rbx,%rdi
call   1050 <strcmp@plt>
test   %rax,%rax
lea    0xe8b(%rip),%rax
lea    0xe8b(%rip),%rdi
cmove  %rax,%rdi
call   1030 <puts@plt>
xor    %eax,%eax
add    $0x10,%rsp
pop    %rbx
ret

LLVM IR (-O0):
@__const.main.passwd = [6 x i8] c"1234\00\00"
@.str = [9 x i8] c"jelszo: \00"
@.str.1 = [11 x i8] c"jo jelszo\0A\00"
@.str.2 = [8 x i8] c"nem jo\0A\00"
define i32 @main() {
%1 = alloca i32
%2 = alloca [5 x i8]
%3 = alloca [6 x i8]
store i32 0, i32* %1
%4 = bitcast [6 x i8]* %3 to i8*
%5 = call i32 @printf(i8* getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%6 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%7 = call i32 @gets(i8* %6)
%8 = getelementptr inbounds [5 x i8], [5 x i8]* %2, i64 0, i64 0
%9 = getelementptr inbounds [6 x i8], [6 x i8]* %3, i64 0, i64 0
%10 = call i64 @strcmp(i8* %8, i8* %9)
%11 = icmp ne i64 %10, 0
br i1 %11, label %12, label %14
12: ; preds = %0
%13 = call i32 @printf(i8* getelementptr inbounds ([11 x i8], [11 x i8]* @.str.1, i64 0, i64 0))
br label %16
14: ; preds = %0
%15 = call i32 @printf(i8* getelementptr inbounds ([8 x i8], [8 x i8]* @.str.2, i64 0, i64 0))
br label %16
16: ; preds = %14, %12
ret i32 0
}

LLVM IR (-O2):
@__const.main.passwd = [6 x i8] c"1234\00\00"
@.str = [9 x i8] c"jelszo: \00"
@str = [7 x i8] c"nem jo\00"
@str.3 = [10 x i8] c"jo jelszo\00"
define i32 @main() {
%1 = alloca [5 x i8]
%2 = alloca [6 x i8]
%3 = getelementptr inbounds [5 x i8], [5 x i8]* %1, i64 0, i64 0
%4 = getelementptr inbounds [6 x i8], [6 x i8]* %2, i64 0, i64 0
%5 = tail call i32 @printf(i8* dereferenceable(1) getelementptr inbounds ([9 x i8], [9 x i8]* @.str, i64 0, i64 0))
%6 = call i32 @gets(i8* %3)
%7 = call i64 @strcmp(i8* %3, i8* %4)
%8 = icmp eq i64 %7, 0
%9 = select i1 %8, i8* getelementptr inbounds ([7 x i8], [7 x i8]* @str, i64 0, i64 0), i8* getelementptr inbounds ([10 x i8], [10 x i8]* @str.3, i64 0, i64 0)
%10 = call i32 @puts(i8* dereferenceable(1) %9)
ret i32 0
}