1. Список говнокодов пользователя kcalbCube

    Всего: 46

  2. Ruby / Говнокод #28073

    0

    1. 1
    http://mainisusuallyafunction.blogspot.com/2014/02/x86-is-turing-complete-with-no-registers.html

    посмотрите в комменты

    kcalbCube, 06 Марта 2022

    Комментарии (4)
  3. C++ / Говнокод #28066

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    #define CONSTRUCT_JUMP(name_, opcode_) else if(mnemonic.name == #name_) \
    	subcompileMnemonic(mnemonic, {\
    	{constructDescription(CONSTANT), opcode_},\
    	{constructDescription(LABEL), opcode_}})
    
    	CONSTRUCT_JUMP(JMP, JMP);
    
    	CONSTRUCT_JUMP(JE, JZ);
    	CONSTRUCT_JUMP(JZ, JZ);
    
    	CONSTRUCT_JUMP(JNZ, JNZ);
    	CONSTRUCT_JUMP(JNE, JNZ);
    
    	CONSTRUCT_JUMP(JG, JG);
    	CONSTRUCT_JUMP(JNLE, JG);
    	CONSTRUCT_JUMP(JNLZ, JG);
    
    	CONSTRUCT_JUMP(JLE, JNG);
    	CONSTRUCT_JUMP(JLZ, JNG);
    	CONSTRUCT_JUMP(JNG, JNG);
    
    	CONSTRUCT_JUMP(JGE, JGZ);
    	CONSTRUCT_JUMP(JGZ, JGZ);
    	CONSTRUCT_JUMP(JNL, JGZ);
    
    	CONSTRUCT_JUMP(JNGZ, JL);
    	CONSTRUCT_JUMP(JNGE, JL);
    	CONSTRUCT_JUMP(JL  , JL);
    
    	CONSTRUCT_JUMP(JB, JB);
    	CONSTRUCT_JUMP(JNAE, JB);
    	CONSTRUCT_JUMP(JNAZ, JB);
    	CONSTRUCT_JUMP(JC, JB);
    
    	CONSTRUCT_JUMP(JNB, JNB);
    	CONSTRUCT_JUMP(JAE, JNB);
    	CONSTRUCT_JUMP(JAZ, JNB);
    	CONSTRUCT_JUMP(JNC, JNB);
    
    	CONSTRUCT_JUMP(JBE, JBZ);
    	CONSTRUCT_JUMP(JBZ, JBZ);
    	CONSTRUCT_JUMP(JNA, JBZ);
    
    	CONSTRUCT_JUMP(JA, JA);
    	CONSTRUCT_JUMP(JNBE, JA);
    	CONSTRUCT_JUMP(JNBZ, JA);
    
    	CONSTRUCT_JUMP(CALL, CALL);
    #undef CONSTRUCT_JUMP

    kcalbCube, 01 Марта 2022

    Комментарии (22)
  4. C++ / Говнокод #28065

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    #define CONSTRUCT_JUMP(name_, opcode_) else if(mnemonic.name == #name_) \
    	subcompileMnemonic(mnemonic, {\
    	{constructDescription(CONSTANT), opcode_},\
    	{constructDescription(LABEL), opcode_}})
    
    	CONSTRUCT_JUMP(JMP, JMP);
    
    	CONSTRUCT_JUMP(JE, JZ);
    	CONSTRUCT_JUMP(JZ, JZ);
    
    	CONSTRUCT_JUMP(JNZ, JNZ);
    	CONSTRUCT_JUMP(JNE, JNZ);
    
    	CONSTRUCT_JUMP(JG, JG);
    	CONSTRUCT_JUMP(JNLE, JG);
    	CONSTRUCT_JUMP(JNLZ, JG);
    
    	CONSTRUCT_JUMP(JLE, JNG);
    	CONSTRUCT_JUMP(JLZ, JNG);
    	CONSTRUCT_JUMP(JNG, JNG);
    
    	CONSTRUCT_JUMP(JGE, JGZ);
    	CONSTRUCT_JUMP(JGZ, JGZ);
    	CONSTRUCT_JUMP(JNL, JGZ);
    
    	CONSTRUCT_JUMP(JNGZ, JL);
    	CONSTRUCT_JUMP(JNGE, JL);
    	CONSTRUCT_JUMP(JL  , JL);
    
    	CONSTRUCT_JUMP(JB, JB);
    	CONSTRUCT_JUMP(JNAE, JB);
    	CONSTRUCT_JUMP(JNAZ, JB);
    	CONSTRUCT_JUMP(JC, JB);
    
    	CONSTRUCT_JUMP(JNB, JNB);
    	CONSTRUCT_JUMP(JAE, JNB);
    	CONSTRUCT_JUMP(JAZ, JNB);
    	CONSTRUCT_JUMP(JNC, JNB);
    
    	CONSTRUCT_JUMP(JBE, JBZ);
    	CONSTRUCT_JUMP(JBZ, JBZ);
    	CONSTRUCT_JUMP(JNA, JBZ);
    
    	CONSTRUCT_JUMP(JA, JA);
    	CONSTRUCT_JUMP(JNBE, JA);
    	CONSTRUCT_JUMP(JNBZ, JA);
    
    	CONSTRUCT_JUMP(CALL, CALL);
    #undef CONSTRUCT_JUMP

    kcalbCube, 01 Марта 2022

    Комментарии (3)
  5. Си / Говнокод #28061

    +1

    1. 1
    2. 2
    3. 3
    4. 4
    #pragma aux __cdecl "_*"                            \
                    parm caller [ ]                          \
                    value struct float struct routine [eax] \
                    modify [eax ecx edx]

    kcalbCube, 28 Февраля 2022

    Комментарии (11)
  6. Assembler / Говнокод #28059

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    39. 39
    40. 40
    41. 41
    42. 42
    43. 43
    44. 44
    45. 45
    46. 46
    47. 47
    48. 48
    49. 49
    50. 50
    51. 51
    52. 52
    53. 53
    54. 54
    55. 55
    56. 56
    57. 57
    58. 58
    59. 59
    60. 60
    61. 61
    62. 62
    63. 63
    64. 64
    65. 65
    66. 66
    67. 67
    68. 68
    69. 69
    70. 70
    71. 71
    72. 72
    73. 73
    74. 74
    75. 75
    76. 76
    77. 77
    78. 78
    79. 79
    80. 80
    81. 81
    82. 82
    83. 83
    84. 84
    85. 85
    86. 86
    .org 80h
    inc:
    	push %bp
    	mov %bp %sp
    	sub %sp 0010h
    	mov [%bp + FFFEh] %sp
    	mov [%bp + FFFCh] %b
    	lea %a [%bp + FFFCh]
    	mov %a [%a]
    	push %a
    	inc %a
    	pop %si
    	mov [%si] %a
    	jmp @.return.inc
    .return.inc:
    	mov %sp %bp
    	pop %bp
    	ret
    main:
    	push %bp
    	mov %bp %sp
    	sub %sp 0010h
    	mov [%bp + FFFCh] %sp
    	memset [%bp + FFFEh] 0002h 0h
    	lea %a [%bp + FFFEh]
    	push %a
    	mov %a 0000h
    	pop %si
    	mov [%si] %a
    .L.begin.1:
    	mov %a 0001h
    	cmp %a 0h
    	jz @.0
    	lea %a [%bp + FFFEh]
    	push %a
    	pop %b
    	call @inc
    	push %a
    	mov %a 0050h
    	pop %si
    	cmp %si %a
    	jgz @.compare3
    	mov %al 1h
    	.compare3:
    	mov %ah 0h
    	cmp %a 0h
    	jz  @.else.2
    	jmp @.0
    	jmp @.end.2
    .else.2:
    .end.2:
    .1:
    	jmp @.L.begin.1
    .0:
    .return.main:
    	mov %sp %bp
    	pop %bp
    	ret
    start:
    	mov %sp FFFFh
    	call @main
    .return.start:
    	int 0h
    
    <-------------------->
    
    short inc(short* i)
    {
    	return ++(*i);
    }
    
    void main(void)
    {
    	short i = 0s;
    	while(1) 
    	{
    		if(inc(&i) > 0x50)
    			break;
    	}
    }
    
    void start(void)
    {
    	asm("mov %sp FFFFh");
    	main();
    }

    да что вы знаете о неоптимизированном коде

    kcalbCube, 27 Февраля 2022

    Комментарии (0)
  7. Си / Говнокод #28058

    +1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    #include <stdio.h>
    
    int main(void)
    {
    	(
    		*********************
    		**  **     ** ***** *
    		* ** * **** ** *** **
    		* ** * **** *** * ***
    		* ** * **** **** ****
    		* ** * **** *** * ***
    		* ** **    *** *** **
    		*********************
    	printf)("pidor");
    }

    kcalbCube, 26 Февраля 2022

    Комментарии (13)
  8. Си / Говнокод #28056

    +1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    static char *cast_table[][11] = {
      // i8   i16     i32     i64     u8     u16     u32     u64     f32     f64     f80
      {NULL,  NULL,   NULL,   i32i64, i32u8, i32u16, NULL,   i32i64, i32f32, i32f64, i32f80}, // i8
      {i32i8, NULL,   NULL,   i32i64, i32u8, i32u16, NULL,   i32i64, i32f32, i32f64, i32f80}, // i16
      {i32i8, i32i16, NULL,   i32i64, i32u8, i32u16, NULL,   i32i64, i32f32, i32f64, i32f80}, // i32
      {i32i8, i32i16, NULL,   NULL,   i32u8, i32u16, NULL,   NULL,   i64f32, i64f64, i64f80}, // i64
    
      {i32i8, NULL,   NULL,   i32i64, NULL,  NULL,   NULL,   i32i64, i32f32, i32f64, i32f80}, // u8
      {i32i8, i32i16, NULL,   i32i64, i32u8, NULL,   NULL,   i32i64, i32f32, i32f64, i32f80}, // u16
      {i32i8, i32i16, NULL,   u32i64, i32u8, i32u16, NULL,   u32i64, u32f32, u32f64, u32f80}, // u32
      {i32i8, i32i16, NULL,   NULL,   i32u8, i32u16, NULL,   NULL,   u64f32, u64f64, u64f80}, // u64
    
      {f32i8, f32i16, f32i32, f32i64, f32u8, f32u16, f32u32, f32u64, NULL,   f32f64, f32f80}, // f32
      {f64i8, f64i16, f64i32, f64i64, f64u8, f64u16, f64u32, f64u64, f64f32, NULL,   f64f80}, // f64
      {f80i8, f80i16, f80i32, f80i64, f80u8, f80u16, f80u32, f80u64, f80f32, f80f64, NULL},   // f80
    };

    красивое

    kcalbCube, 26 Февраля 2022

    Комментарии (2)
  9. Си / Говнокод #28055

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    // Takes a printf-style format string and returns a formatted string.
    char *format(char *fmt, ...) {
      char *buf;
      size_t buflen;
      FILE *out = open_memstream(&buf, &buflen);
    
      va_list ap;
      va_start(ap, fmt);
      vfprintf(out, fmt, ap);
      va_end(ap);
      fclose(out);
      return buf;
    }

    kcalbCube, 25 Февраля 2022

    Комментарии (6)
  10. Си / Говнокод #28054

    −1

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    typedef enum {
      FILE_NONE, FILE_C, FILE_ASM, FILE_OBJ, FILE_AR, FILE_DSO,
    } FileType;
    
    StringArray include_paths;
    bool opt_fcommon = true;
    bool opt_fpic;
    
    static FileType opt_x;
    static StringArray opt_include;
    static bool opt_E;
    static bool opt_M;
    static bool opt_MD;
    static bool opt_MMD;
    static bool opt_MP;
    static bool opt_S;
    static bool opt_c;
    static bool opt_cc1;
    static bool opt_hash_hash_hash;
    static bool opt_static;
    static bool opt_shared;
    static char *opt_MF;
    static char *opt_MT;
    static char *opt_o;
    
    static StringArray ld_extra_args;
    static StringArray std_include_paths;
    
    char *base_file;
    static char *output_file;
    
    static StringArray input_paths;
    static StringArray tmpfiles;

    благо поиск по проекту работает

    kcalbCube, 25 Февраля 2022

    Комментарии (23)
  11. Си / Говнокод #28041

    0

    1. 01
    2. 02
    3. 03
    4. 04
    5. 05
    6. 06
    7. 07
    8. 08
    9. 09
    10. 10
    11. 11
    12. 12
    13. 13
    14. 14
    15. 15
    16. 16
    17. 17
    18. 18
    19. 19
    20. 20
    21. 21
    22. 22
    23. 23
    24. 24
    25. 25
    26. 26
    27. 27
    28. 28
    29. 29
    30. 30
    31. 31
    32. 32
    33. 33
    34. 34
    35. 35
    36. 36
    37. 37
    38. 38
    void pong_game(void)
       {
          /*Set the first random direction the ball will be traviling*/
          direction=random_direction();
          
          /*Play the game while the ESC key is not pressed*/
          while(!key[KEY_ESC]) {
             /*Move the Ball*/
             move_ball();
             /*Respond to the input*/
             key_respond();
             
             /*Put the information on the Screen*/
             textout(buffer,pong_datafile[pong_text].dat,"Player 1 Score:",
                     150,0,254);
             textout(buffer,pong_datafile[pong_text].dat,itoa(score_p1,NULL,10),
                     text_length(pong_datafile[pong_text].dat,
                     "Player 1 Score:")+150,0,10);
             textout(buffer,pong_datafile[pong_text].dat,"Player 2 Score:",
                     350,0,254);
             textout(buffer,pong_datafile[pong_text].dat,itoa(score_p2,NULL,10),
                     text_length(pong_datafile[pong_text].dat,
                                 "Player 2 Score:")+350,0,10);
             textout(buffer,pong_datafile[pong_text].dat,"keyboard",0,0,255);
             textout(buffer,pong_datafile[pong_text].dat,"joystick",
                     640-text_length(pong_datafile[pong_text].dat,"joystick"),
                     0,255);
             /*Draw a line to set the boundries*/
             line(buffer,0,30,640,30,10);
             
             /*Put the buffer screen on the screen*/
             blit(buffer,screen,0,0,0,0,640,480);
             
             /*Clear the buffer*/
             clear(buffer);
          }
          return;
       }

    помните?

    kcalbCube, 20 Февраля 2022

    Комментарии (6)